Updated WebAppHosting to not send radio and checkbox input data for those that aren't checked

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-05-13 17:29:05 -07:00
parent c68ec562eb
commit 4b69a617ab
2 changed files with 72 additions and 66 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -159,7 +160,7 @@ namespace Orchard.Specs.Bindings {
var r = row;
var input = inputs.First(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
Assert.That(input, Is.Not.Null, "Unable to locate <input> name {0} in page html:\r\n\r\n{1}", r["name"], Details.ResponseText);
var inputType = input.Attributes["type"].Value.ToLowerInvariant();
var inputType = input.GetAttributeValue("type", "");
switch(inputType) {
case "radio":
var radios = inputs.Where(
@@ -190,6 +191,7 @@ namespace Orchard.Specs.Bindings {
var urlPath = form.Start.GetAttributeValue("action", Details.UrlPath);
var inputs = form.Children
.SelectMany(elt => elt.DescendantsAndSelf("input"))
.Where(node => !((node.GetAttributeValue("type", "") == "radio" || node.GetAttributeValue("type", "") == "checkbox") && node.GetAttributeValue("checked", "") != "checked"))
.GroupBy(elt => elt.GetAttributeValue("name", elt.GetAttributeValue("id", "")), elt => elt.GetAttributeValue("value", ""))
.ToDictionary(elt => elt.Key, elt => (IEnumerable<string>)elt);

View File

@@ -1,18 +1,21 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.2.0.0
// SpecFlow Version:1.3.0.0
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Multiple tenant management")]
public partial class MultipleTenantManagementFeature
@@ -58,17 +61,17 @@ namespace Orchard.Specs
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 8
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 9
testRunner.When("I go to \"Admin/MultiTenancy\"");
testRunner.When("I go to \"Admin/MultiTenancy\"");
#line 10
testRunner.Then("I should see \"List of Site\'s Tenants\"");
testRunner.Then("I should see \"List of Site\'s Tenants\"");
#line 11
testRunner.And("I should see \"<span class=\"tenantName\">Default</span>\"");
testRunner.And("I should see \"<span class=\"tenantName\">Default</span>\"");
#line 12
testRunner.And("the status should be 200 OK");
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -81,15 +84,15 @@ this.ScenarioSetup(scenarioInfo);
#line 14
this.ScenarioSetup(scenarioInfo);
#line 15
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 16
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 17
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line 18
testRunner.And("I hit \"Save\"");
testRunner.And("I hit \"Save\"");
#line 19
testRunner.Then("I should see \"is required\"");
testRunner.Then("I should see \"is required\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -102,11 +105,11 @@ this.ScenarioSetup(scenarioInfo);
#line 21
this.ScenarioSetup(scenarioInfo);
#line 22
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 23
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 24
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -115,15 +118,15 @@ this.ScenarioSetup(scenarioInfo);
"Name",
"Scott"});
#line 25
testRunner.And("I fill in", ((string)(null)), table1);
testRunner.And("I fill in", ((string)(null)), table1);
#line 28
testRunner.And("I hit \"Save\"");
testRunner.And("I hit \"Save\"");
#line 29
testRunner.And("I am redirected");
testRunner.And("I am redirected");
#line 30
testRunner.Then("I should see \"<span class=\"tenantName\">Scott</span>\"");
testRunner.Then("I should see \"<span class=\"tenantName\">Scott</span>\"");
#line 31
testRunner.And("the status should be 200 OK");
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -136,11 +139,11 @@ this.ScenarioSetup(scenarioInfo);
#line 33
this.ScenarioSetup(scenarioInfo);
#line 34
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 35
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 36
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -149,15 +152,15 @@ this.ScenarioSetup(scenarioInfo);
"Name",
"Scott"});
#line 37
testRunner.And("I fill in", ((string)(null)), table2);
testRunner.And("I fill in", ((string)(null)), table2);
#line 40
testRunner.And("I hit \"Save\"");
testRunner.And("I hit \"Save\"");
#line 41
testRunner.And("I am redirected");
testRunner.And("I am redirected");
#line 42
testRunner.Then("I should see \"<li class=\"tenant Uninitialized\">\"");
testRunner.Then("I should see \"<li class=\"tenant Uninitialized\">\"");
#line 43
testRunner.And("the status should be 200 OK");
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -170,11 +173,11 @@ this.ScenarioSetup(scenarioInfo);
#line 45
this.ScenarioSetup(scenarioInfo);
#line 46
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 47
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 48
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -186,17 +189,17 @@ this.ScenarioSetup(scenarioInfo);
"RequestUrlHost",
"scott.example.org"});
#line 49
testRunner.And("I fill in", ((string)(null)), table3);
testRunner.And("I fill in", ((string)(null)), table3);
#line 53
testRunner.And("I hit \"Save\"");
testRunner.And("I hit \"Save\"");
#line 54
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 55
testRunner.Then("I should see \"Welcome to Orchard\"");
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 56
testRunner.And("I should see \"Finish Setup\"");
testRunner.And("I should see \"Finish Setup\"");
#line 57
testRunner.And("the status should be 200 OK");
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -209,11 +212,11 @@ this.ScenarioSetup(scenarioInfo);
#line 59
this.ScenarioSetup(scenarioInfo);
#line 60
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 61
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 62
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -228,21 +231,21 @@ this.ScenarioSetup(scenarioInfo);
"DataProvider",
"SQLite"});
#line 63
testRunner.And("I fill in", ((string)(null)), table4);
testRunner.And("I fill in", ((string)(null)), table4);
#line 68
testRunner.And("I hit \"Save\"");
testRunner.And("I hit \"Save\"");
#line 69
testRunner.And("I am redirected");
testRunner.And("I am redirected");
#line 70
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 71
testRunner.Then("I should see \"Welcome to Orchard\"");
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 72
testRunner.And("I should see \"Finish Setup\"");
testRunner.And("I should see \"Finish Setup\"");
#line 73
testRunner.And("I should not see \"SQLite\"");
testRunner.And("I should not see \"SQLite\"");
#line 74
testRunner.And("the status should be 200 OK");
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -255,11 +258,11 @@ this.ScenarioSetup(scenarioInfo);
#line 76
this.ScenarioSetup(scenarioInfo);
#line 77
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 78
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 79
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -271,11 +274,11 @@ this.ScenarioSetup(scenarioInfo);
"RequestUrlHost",
"scott.example.org"});
#line 80
testRunner.And("I fill in", ((string)(null)), table5);
testRunner.And("I fill in", ((string)(null)), table5);
#line 84
testRunner.And("I hit \"Save\"");
testRunner.And("I hit \"Save\"");
#line 85
testRunner.And("I go to \"/Setup\" on host scott.example.org");
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -287,15 +290,15 @@ this.ScenarioSetup(scenarioInfo);
"AdminPassword",
"6655321"});
#line 86
testRunner.And("I fill in", ((string)(null)), table6);
testRunner.And("I fill in", ((string)(null)), table6);
#line 90
testRunner.And("I hit \"Finish Setup\"");
testRunner.And("I hit \"Finish Setup\"");
#line 91
testRunner.And("I go to \"/Default.aspx\"");
testRunner.And("I go to \"/Default.aspx\"");
#line 92
testRunner.Then("I should see \"<h1>Scott Site</h1>\"");
testRunner.Then("I should see \"<h1>Scott Site</h1>\"");
#line 93
testRunner.And("I should see \"Welcome, <strong>admin</strong>!\"");
testRunner.And("I should see \"Welcome, <strong>admin</strong>!\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -308,19 +311,20 @@ this.ScenarioSetup(scenarioInfo);
#line 95
this.ScenarioSetup(scenarioInfo);
#line 96
testRunner.Given("I have installed Orchard");
testRunner.Given("I have installed Orchard");
#line 97
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 98
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
#line 99
testRunner.When("I execute >tenant list");
testRunner.When("I execute >tenant list");
#line 100
testRunner.Then("I should see \"Name: Alpha\"");
testRunner.Then("I should see \"Name: Alpha\"");
#line 101
testRunner.And("I should see \"Request Url Host: example.org\"");
testRunner.And("I should see \"Request Url Host: example.org\"");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}
#endregion