diff --git a/src/Orchard.Specs/Boolean.feature b/src/Orchard.Specs/Boolean.feature
index 9104dc5a3..5335a953f 100644
--- a/src/Orchard.Specs/Boolean.feature
+++ b/src/Orchard.Specs/Boolean.feature
@@ -53,7 +53,7 @@ Scenario: Creating and using Boolean fields
And I go to "Admin/Contents/Create/Event"
Then I should see "Check if the event is active"
- # The default value should be used on creation
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
@@ -63,40 +63,14 @@ Scenario: Creating and using Boolean fields
Then I should see "checked=\"checked\""
# The value should be required
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.Optional | false |
- | Fields[0].BooleanFieldSettings.DefaultValue | Neutral |
- And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.NotSetLabel | May be |
- And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.SelectionMode | Radiobutton |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Active.Value | |
- And I hit "Save"
- Then I should see "The field Active is mandatory."
-
- # If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].BooleanFieldSettings.Optional | false |
- | Fields[0].BooleanFieldSettings.DefaultValue | True |
- And I fill in
- | name | value |
- | Fields[0].BooleanFieldSettings.SelectionMode | Dropdown list |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Active.Value | |
And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- And I should see "selected=\"selected\" value=\"true\""
\ No newline at end of file
+ Then I should see "The field Active is mandatory."
\ No newline at end of file
diff --git a/src/Orchard.Specs/Boolean.feature.cs b/src/Orchard.Specs/Boolean.feature.cs
index 5eddd627f..937fa3e32 100644
--- a/src/Orchard.Specs/Boolean.feature.cs
+++ b/src/Orchard.Specs/Boolean.feature.cs
@@ -193,90 +193,25 @@ this.ScenarioSetup(scenarioInfo);
table6.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.Optional",
"false"});
- table6.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.DefaultValue",
- "Neutral"});
#line 67
testRunner.And("I fill in", ((string)(null)), table6, "And ");
+#line 70
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 71
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table7.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.NotSetLabel",
- "May be"});
-#line 71
+ "Event.Active.Value",
+ ""});
+#line 72
testRunner.And("I fill in", ((string)(null)), table7, "And ");
-#line hidden
- TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table8.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.SelectionMode",
- "Radiobutton"});
-#line 74
- testRunner.And("I fill in", ((string)(null)), table8, "And ");
-#line 77
+#line 75
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 78
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table9.AddRow(new string[] {
- "Event.Active.Value",
- ""});
-#line 79
- testRunner.And("I fill in", ((string)(null)), table9, "And ");
-#line 82
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 83
+#line 76
testRunner.Then("I should see \"The field Active is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 86
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table10.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.Optional",
- "false"});
- table10.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.DefaultValue",
- "True"});
-#line 87
- testRunner.And("I fill in", ((string)(null)), table10, "And ");
-#line hidden
- TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table11.AddRow(new string[] {
- "Fields[0].BooleanFieldSettings.SelectionMode",
- "Dropdown list"});
-#line 91
- testRunner.And("I fill in", ((string)(null)), table11, "And ");
-#line 94
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 95
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table12.AddRow(new string[] {
- "Event.Active.Value",
- ""});
-#line 96
- testRunner.And("I fill in", ((string)(null)), table12, "And ");
-#line 99
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 100
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 101
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 102
- testRunner.And("I should see \"selected=\\\"selected\\\" value=\\\"true\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();
}
diff --git a/src/Orchard.Specs/DateTime.feature b/src/Orchard.Specs/DateTime.feature
index 00c848706..d5861da70 100644
--- a/src/Orchard.Specs/DateTime.feature
+++ b/src/Orchard.Specs/DateTime.feature
@@ -139,67 +139,22 @@ Scenario: Creating and using Date fields
When I hit "Save"
Then I should see "Date of the event is required."
- # If not required and no value, the default value should be used
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].DateTimeFieldSettings.Display | DateAndTime |
- | Fields[0].DateTimeFieldSettings.Required | false |
- | Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2012 |
- | Fields[0].DateTimeFieldSettings.Editor.Time | 11:00 AM |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- Then I should see "Event.EventDate.Editor.Date"
- When I fill in
- | name | value |
- | Event.EventDate.Editor.Date | |
- | Event.EventDate.Editor.Time | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Date of the event"
- And I should see "1/31/2012 11:00"
-
- # If required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].DateTimeFieldSettings.Display | DateAndTime |
- | Fields[0].DateTimeFieldSettings.Required | true |
- | Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2012 |
+ | Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2016 |
| Fields[0].DateTimeFieldSettings.Editor.Time | 10:00 AM |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Event.EventDate.Editor.Date"
- When I fill in
- | name | value |
- | Event.EventDate.Editor.Date | |
- | Event.EventDate.Editor.Time | |
- And I hit "Save"
+ When I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Date of the event"
- And I should see "1/31/2012 10:00"
-
- # If required and the default value is incomplete, the value should be required
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].DateTimeFieldSettings.Display | DateAndTime |
- | Fields[0].DateTimeFieldSettings.Required | true |
- | Fields[0].DateTimeFieldSettings.Editor.Date | |
- | Fields[0].DateTimeFieldSettings.Editor.Time | 12:00 AM |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- Then I should see "Event.EventDate.Editor.Date"
- When I fill in
- | name | value |
- | Event.EventDate.Editor.Date | |
- | Event.EventDate.Editor.Time | |
- And I hit "Save"
- Then I should see "Date of the event is required."
+ And I should see "1/31/2016 10:00"
Scenario: Creating and using date time fields in another culture
diff --git a/src/Orchard.Specs/DateTime.feature.cs b/src/Orchard.Specs/DateTime.feature.cs
index 00e9c93ea..120475091 100644
--- a/src/Orchard.Specs/DateTime.feature.cs
+++ b/src/Orchard.Specs/DateTime.feature.cs
@@ -359,139 +359,32 @@ this.ScenarioSetup(scenarioInfo);
table15.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
- table15.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Required",
- "false"});
table15.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Date",
- "01/31/2012"});
+ "01/31/2016"});
table15.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Editor.Time",
- "11:00 AM"});
-#line 144
- testRunner.And("I fill in", ((string)(null)), table15, "And ");
-#line 150
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 151
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 152
- testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
- TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table16.AddRow(new string[] {
- "Event.EventDate.Editor.Date",
- ""});
- table16.AddRow(new string[] {
- "Event.EventDate.Editor.Time",
- ""});
-#line 153
- testRunner.When("I fill in", ((string)(null)), table16, "When ");
-#line 157
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 158
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 159
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 160
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 161
- testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 162
- testRunner.And("I should see \"1/31/2012 11:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 165
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table17.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Display",
- "DateAndTime"});
- table17.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Required",
- "true"});
- table17.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Editor.Date",
- "01/31/2012"});
- table17.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Time",
"10:00 AM"});
-#line 166
- testRunner.And("I fill in", ((string)(null)), table17, "And ");
-#line 172
+#line 144
+ testRunner.And("I fill in", ((string)(null)), table15, "And ");
+#line 149
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 173
+#line 150
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 174
+#line 151
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
- TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table18.AddRow(new string[] {
- "Event.EventDate.Editor.Date",
- ""});
- table18.AddRow(new string[] {
- "Event.EventDate.Editor.Time",
- ""});
-#line 175
- testRunner.When("I fill in", ((string)(null)), table18, "When ");
-#line 179
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 180
+#line 152
+ testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 153
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 181
+#line 154
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 182
+#line 155
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 183
+#line 156
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 184
- testRunner.And("I should see \"1/31/2012 10:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 187
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table19.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Display",
- "DateAndTime"});
- table19.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Required",
- "true"});
- table19.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Editor.Date",
- ""});
- table19.AddRow(new string[] {
- "Fields[0].DateTimeFieldSettings.Editor.Time",
- "12:00 AM"});
-#line 188
- testRunner.And("I fill in", ((string)(null)), table19, "And ");
-#line 194
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 195
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 196
- testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
- TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table20.AddRow(new string[] {
- "Event.EventDate.Editor.Date",
- ""});
- table20.AddRow(new string[] {
- "Event.EventDate.Editor.Time",
- ""});
-#line 197
- testRunner.When("I fill in", ((string)(null)), table20, "When ");
-#line 201
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 202
- testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 157
+ testRunner.And("I should see \"1/31/2016 10:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();
}
@@ -501,119 +394,119 @@ this.ScenarioSetup(scenarioInfo);
public virtual void CreatingAndUsingDateTimeFieldsInAnotherCulture()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null)));
-#line 204
+#line 159
this.ScenarioSetup(scenarioInfo);
-#line 207
+#line 162
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line 208
+#line 163
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 209
+#line 164
testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" +
"chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 210
+#line 165
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 211
+#line 166
testRunner.Then("I should see \"]*>.*?Create new type\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 212
+#line 167
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
- TechTalk.SpecFlow.Table table21 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table21.AddRow(new string[] {
+ table16.AddRow(new string[] {
"DisplayName",
"Event"});
- table21.AddRow(new string[] {
+ table16.AddRow(new string[] {
"Name",
"Event"});
-#line 213
- testRunner.And("I fill in", ((string)(null)), table21, "And ");
-#line 217
+#line 168
+ testRunner.And("I fill in", ((string)(null)), table16, "And ");
+#line 172
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 218
+#line 173
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 219
+#line 174
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 222
+#line 177
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 223
+#line 178
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
- TechTalk.SpecFlow.Table table22 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table22.AddRow(new string[] {
+ table17.AddRow(new string[] {
"DisplayName",
"Date of the event"});
- table22.AddRow(new string[] {
+ table17.AddRow(new string[] {
"Name",
"EventDate"});
- table22.AddRow(new string[] {
+ table17.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
-#line 224
- testRunner.And("I fill in", ((string)(null)), table22, "And ");
-#line 229
+#line 179
+ testRunner.And("I fill in", ((string)(null)), table17, "And ");
+#line 184
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 230
+#line 185
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 231
+#line 186
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 234
+#line 189
testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 235
+#line 190
testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
- TechTalk.SpecFlow.Table table23 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table23.AddRow(new string[] {
+ table18.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
- table23.AddRow(new string[] {
+ table18.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
-#line 236
- testRunner.And("I fill in", ((string)(null)), table23, "And ");
-#line 240
+#line 191
+ testRunner.And("I fill in", ((string)(null)), table18, "And ");
+#line 195
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 241
+#line 196
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
- TechTalk.SpecFlow.Table table24 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table24.AddRow(new string[] {
+ table19.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"01/31/2012"});
- table24.AddRow(new string[] {
+ table19.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"12:00 AM"});
-#line 242
- testRunner.And("I fill in", ((string)(null)), table24, "And ");
-#line 246
+#line 197
+ testRunner.And("I fill in", ((string)(null)), table19, "And ");
+#line 201
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 247
+#line 202
testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 248
+#line 203
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
- TechTalk.SpecFlow.Table table25 = new TechTalk.SpecFlow.Table(new string[] {
+ TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table25.AddRow(new string[] {
+ table20.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"31/01/2012"});
- table25.AddRow(new string[] {
+ table20.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"18:00"});
-#line 249
- testRunner.And("I fill in", ((string)(null)), table25, "And ");
-#line 253
+#line 204
+ testRunner.And("I fill in", ((string)(null)), table20, "And ");
+#line 208
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 254
+#line 209
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 255
+#line 210
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/Enumeration.feature b/src/Orchard.Specs/Enumeration.feature
index 55b5efd3e..bee7b46ec 100644
--- a/src/Orchard.Specs/Enumeration.feature
+++ b/src/Orchard.Specs/Enumeration.feature
@@ -108,7 +108,7 @@ Scenario: Creating and using Enumeration fields
And I hit "Save"
Then I should see "The field Location is mandatory."
- # The default value should be used on creation
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
@@ -118,84 +118,23 @@ Scenario: Creating and using Enumeration fields
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "selected=\"selected">Seattle"
-
- # If not required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].EnumerationFieldSettings.Required | false |
- | Fields[0].EnumerationFieldSettings.Options | Boston |
- | Fields[0].EnumerationFieldSettings.ListMode | Checkbox |
- | Fields[0].EnumerationFieldSettings.DefaultValue | foo;Boston;bar |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- Then I should see "Location"
- When I fill in
- | name | value |
- | Event.Location.SelectedValues | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Location:"
- And I should see "Boston"
-
- # If required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].EnumerationFieldSettings.Required | true |
- | Fields[0].EnumerationFieldSettings.Options | Phoenix |
- | Fields[0].EnumerationFieldSettings.ListMode | Checkbox |
- | Fields[0].EnumerationFieldSettings.DefaultValue | foo;Phoenix;bar |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- Then I should see "Location"
- When I fill in
- | name | value |
- | Event.Location.SelectedValues | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Location:"
- And I should see "Phoenix"
-
- # If required and the default value is not valid, the value should be required
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].EnumerationFieldSettings.Required | true |
- | Fields[0].EnumerationFieldSettings.Options | Phoenix |
- | Fields[0].EnumerationFieldSettings.ListMode | Checkbox |
- | Fields[0].EnumerationFieldSettings.DefaultValue | foo;bar |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- Then I should see "Location"
- When I fill in
- | name | value |
- | Event.Location.SelectedValues | |
- And I hit "Save"
- Then I should see "The field Location is mandatory."
- # If required and no default value, the list box should have the required attribute
+ # The required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Required | true |
| Fields[0].EnumerationFieldSettings.ListMode | Listbox |
- | Fields[0].EnumerationFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
- # If required and a default value is set, the list box should not have the required attribute
+ # The required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
- | Fields[0].EnumerationFieldSettings.Required | true |
+ | Fields[0].EnumerationFieldSettings.Required | false |
| Fields[0].EnumerationFieldSettings.ListMode | Listbox |
- | Fields[0].EnumerationFieldSettings.DefaultValue | Phoenix |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""
diff --git a/src/Orchard.Specs/Enumeration.feature.cs b/src/Orchard.Specs/Enumeration.feature.cs
index 5d8e0495d..6f62ed7f9 100644
--- a/src/Orchard.Specs/Enumeration.feature.cs
+++ b/src/Orchard.Specs/Enumeration.feature.cs
@@ -304,176 +304,37 @@ this.ScenarioSetup(scenarioInfo);
"value"});
table12.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Required",
- "false"});
- table12.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Options",
- "Boston"});
+ "true"});
table12.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
- "Checkbox"});
- table12.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.DefaultValue",
- "foo;Boston;bar"});
+ "Listbox"});
#line 124
testRunner.And("I fill in", ((string)(null)), table12, "And ");
-#line 130
+#line 128
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 131
+#line 129
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 132
- testRunner.Then("I should see \"Location\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 130
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 133
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
- "Event.Location.SelectedValues",
- ""});
-#line 133
- testRunner.When("I fill in", ((string)(null)), table13, "When ");
-#line 136
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 137
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ "Fields[0].EnumerationFieldSettings.Required",
+ "false"});
+ table13.AddRow(new string[] {
+ "Fields[0].EnumerationFieldSettings.ListMode",
+ "Listbox"});
+#line 134
+ testRunner.And("I fill in", ((string)(null)), table13, "And ");
#line 138
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 139
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 140
- testRunner.Then("I should see \"Location:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 141
- testRunner.And("I should see \"Boston\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 144
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table14.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Required",
- "true"});
- table14.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Options",
- "Phoenix"});
- table14.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.ListMode",
- "Checkbox"});
- table14.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.DefaultValue",
- "foo;Phoenix;bar"});
-#line 145
- testRunner.And("I fill in", ((string)(null)), table14, "And ");
-#line 151
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 152
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 153
- testRunner.Then("I should see \"Location\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
- TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table15.AddRow(new string[] {
- "Event.Location.SelectedValues",
- ""});
-#line 154
- testRunner.When("I fill in", ((string)(null)), table15, "When ");
-#line 157
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 158
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 159
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 160
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 161
- testRunner.Then("I should see \"Location:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 162
- testRunner.And("I should see \"Phoenix\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 165
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table16.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Required",
- "true"});
- table16.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Options",
- "Phoenix"});
- table16.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.ListMode",
- "Checkbox"});
- table16.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.DefaultValue",
- "foo;bar"});
-#line 166
- testRunner.And("I fill in", ((string)(null)), table16, "And ");
-#line 172
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 173
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 174
- testRunner.Then("I should see \"Location\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
- TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table17.AddRow(new string[] {
- "Event.Location.SelectedValues",
- ""});
-#line 175
- testRunner.When("I fill in", ((string)(null)), table17, "When ");
-#line 178
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 179
- testRunner.Then("I should see \"The field Location is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 182
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table18.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Required",
- "true"});
- table18.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.ListMode",
- "Listbox"});
- table18.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.DefaultValue",
- ""});
-#line 183
- testRunner.And("I fill in", ((string)(null)), table18, "And ");
-#line 188
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 189
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 190
- testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 193
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table19.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.Required",
- "true"});
- table19.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.ListMode",
- "Listbox"});
- table19.AddRow(new string[] {
- "Fields[0].EnumerationFieldSettings.DefaultValue",
- "Phoenix"});
-#line 194
- testRunner.And("I fill in", ((string)(null)), table19, "And ");
-#line 199
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 200
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 201
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/Input.feature b/src/Orchard.Specs/Input.feature
index 54af4f43a..2db7cb2c2 100644
--- a/src/Orchard.Specs/Input.feature
+++ b/src/Orchard.Specs/Input.feature
@@ -129,58 +129,29 @@ Scenario: Creating and using Input fields
Then I should see "Contact:"
And I should see "contact@orchardproject.net"
- # If not required and no value, the default value should be used
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
- | Fields[0].InputFieldSettings.Required | false |
- | Fields[0].InputFieldSettings.DefaultValue | contact1@orchardproject.net |
+ | Fields[0].InputFieldSettings.DefaultValue | contact@orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Contact.Value | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Contact:"
- And I should see "contact1@orchardproject.net"
+ Then I should see "value=\"contact@orchardproject.net\""
- # If required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].InputFieldSettings.Required | true |
- | Fields[0].InputFieldSettings.DefaultValue | contact2@orchardproject.net |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Contact.Value | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Contact:"
- And I should see "contact2@orchardproject.net"
-
- # If required and no default value, the required attribute should be used
+ # The required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].InputFieldSettings.Required | true |
- | Fields[0].InputFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
- # If required and a default value is set, the required attribute should not be used
+ # The required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
- | name | value |
- | Fields[0].InputFieldSettings.Required | true |
- | Fields[0].InputFieldSettings.DefaultValue | contact@orchardproject.net |
+ | name | value |
+ | Fields[0].InputFieldSettings.Required | false |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Input.feature.cs b/src/Orchard.Specs/Input.feature.cs
index 0f7c48698..7d3df6de0 100644
--- a/src/Orchard.Specs/Input.feature.cs
+++ b/src/Orchard.Specs/Input.feature.cs
@@ -303,39 +303,34 @@ this.ScenarioSetup(scenarioInfo);
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table13.AddRow(new string[] {
- "Fields[0].InputFieldSettings.Required",
- "false"});
table13.AddRow(new string[] {
"Fields[0].InputFieldSettings.DefaultValue",
- "contact1@orchardproject.net"});
+ "contact@orchardproject.net"});
#line 134
testRunner.And("I fill in", ((string)(null)), table13, "And ");
-#line 138
+#line 137
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 139
+#line 138
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 139
+ testRunner.Then("I should see \"value=\\\"contact@orchardproject.net\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 142
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
- "Event.Contact.Value",
- ""});
-#line 140
- testRunner.And("I fill in", ((string)(null)), table14, "And ");
+ "Fields[0].InputFieldSettings.Required",
+ "true"});
#line 143
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 144
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 145
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+ testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 146
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 147
- testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 148
- testRunner.And("I should see \"contact1@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 151
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
@@ -344,76 +339,14 @@ this.ScenarioSetup(scenarioInfo);
"value"});
table15.AddRow(new string[] {
"Fields[0].InputFieldSettings.Required",
- "true"});
- table15.AddRow(new string[] {
- "Fields[0].InputFieldSettings.DefaultValue",
- "contact2@orchardproject.net"});
+ "false"});
#line 152
testRunner.And("I fill in", ((string)(null)), table15, "And ");
+#line 155
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 156
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 157
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table16.AddRow(new string[] {
- "Event.Contact.Value",
- ""});
-#line 158
- testRunner.And("I fill in", ((string)(null)), table16, "And ");
-#line 161
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 162
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 163
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 164
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 165
- testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 166
- testRunner.And("I should see \"contact2@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 169
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table17.AddRow(new string[] {
- "Fields[0].InputFieldSettings.Required",
- "true"});
- table17.AddRow(new string[] {
- "Fields[0].InputFieldSettings.DefaultValue",
- ""});
-#line 170
- testRunner.And("I fill in", ((string)(null)), table17, "And ");
-#line 174
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 175
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 176
- testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 179
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table18.AddRow(new string[] {
- "Fields[0].InputFieldSettings.Required",
- "true"});
- table18.AddRow(new string[] {
- "Fields[0].InputFieldSettings.DefaultValue",
- "contact@orchardproject.net"});
-#line 180
- testRunner.And("I fill in", ((string)(null)), table18, "And ");
-#line 184
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 185
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 186
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/Link.feature b/src/Orchard.Specs/Link.feature
index d190a6f27..2916a0a05 100644
--- a/src/Orchard.Specs/Link.feature
+++ b/src/Orchard.Specs/Link.feature
@@ -69,64 +69,29 @@ Scenario: Creating and using Link fields
And I hit "Save"
Then I should see "Url is required for Site Url."
- # If not required and no value, the default value should be used
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
- | Fields[0].LinkFieldSettings.Required | false |
| Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.SiteUrl.Value | |
- And I fill in
- | name | value |
- | Event.SiteUrl.Text | Orchard1 |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Site Url:"
- And I should see "Orchard1"
+ Then I should see "value=\"http://www.orchardproject.net\""
- # If required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].LinkFieldSettings.Required | true |
- | Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.SiteUrl.Value | |
- And I fill in
- | name | value |
- | Event.SiteUrl.Text | Orchard2 |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Site Url:"
- And I should see "Orchard2"
-
- # If required and no default value, the required attribute should be used
+ # The required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].LinkFieldSettings.Required | true |
- | Fields[0].LinkFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
- # If required and a default value is set, the required attribute should not be used
+ # The required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
- | name | value |
- | Fields[0].LinkFieldSettings.Required | true |
- | Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
+ | name | value |
+ | Fields[0].LinkFieldSettings.Required | false |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Link.feature.cs b/src/Orchard.Specs/Link.feature.cs
index 28570e144..6f3b58a63 100644
--- a/src/Orchard.Specs/Link.feature.cs
+++ b/src/Orchard.Specs/Link.feature.cs
@@ -210,135 +210,50 @@ this.ScenarioSetup(scenarioInfo);
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table8.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.Required",
- "false"});
table8.AddRow(new string[] {
"Fields[0].LinkFieldSettings.DefaultValue",
"http://www.orchardproject.net"});
#line 74
testRunner.And("I fill in", ((string)(null)), table8, "And ");
-#line 78
+#line 77
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 79
+#line 78
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 79
+ testRunner.Then("I should see \"value=\\\"http://www.orchardproject.net\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 82
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table9.AddRow(new string[] {
- "Event.SiteUrl.Value",
- ""});
-#line 80
+ "Fields[0].LinkFieldSettings.Required",
+ "true"});
+#line 83
testRunner.And("I fill in", ((string)(null)), table9, "And ");
+#line 86
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 87
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 88
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 91
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table10.AddRow(new string[] {
- "Event.SiteUrl.Text",
- "Orchard1"});
-#line 83
+ "Fields[0].LinkFieldSettings.Required",
+ "false"});
+#line 92
testRunner.And("I fill in", ((string)(null)), table10, "And ");
-#line 86
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 87
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 88
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 89
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 90
- testRunner.Then("I should see \"Site Url:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 91
- testRunner.And("I should see \"Orchard1\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 94
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table11.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.Required",
- "true"});
- table11.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.DefaultValue",
- "http://www.orchardproject.net"});
#line 95
- testRunner.And("I fill in", ((string)(null)), table11, "And ");
-#line 99
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 100
+#line 96
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table12.AddRow(new string[] {
- "Event.SiteUrl.Value",
- ""});
-#line 101
- testRunner.And("I fill in", ((string)(null)), table12, "And ");
-#line hidden
- TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table13.AddRow(new string[] {
- "Event.SiteUrl.Text",
- "Orchard2"});
-#line 104
- testRunner.And("I fill in", ((string)(null)), table13, "And ");
-#line 107
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 108
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 109
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 110
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 111
- testRunner.Then("I should see \"Site Url:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 112
- testRunner.And("I should see \"Orchard2\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 115
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table14.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.Required",
- "true"});
- table14.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.DefaultValue",
- ""});
-#line 116
- testRunner.And("I fill in", ((string)(null)), table14, "And ");
-#line 120
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 121
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 122
- testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 125
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table15.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.Required",
- "true"});
- table15.AddRow(new string[] {
- "Fields[0].LinkFieldSettings.DefaultValue",
- "http://www.orchardproject.net"});
-#line 126
- testRunner.And("I fill in", ((string)(null)), table15, "And ");
-#line 130
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 131
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 132
+#line 97
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/Numeric.feature b/src/Orchard.Specs/Numeric.feature
index 05f87e8f5..4e76bfd2f 100644
--- a/src/Orchard.Specs/Numeric.feature
+++ b/src/Orchard.Specs/Numeric.feature
@@ -99,101 +99,36 @@ Scenario: Creating and using numeric fields
And I should see "The value 'b' is not valid for Maximum."
# The value should be validated
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].NumericFieldSettings.Required | false |
- | Fields[0].NumericFieldSettings.DefaultValue | 4 |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
+ When I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Guests.Value | a |
And I hit "Save"
- Then I should see "Guests or its default value is an invalid number"
+ Then I should see "Guests is an invalid number"
- # If not required and no value, the default value should be used
+ # The default value should be proposed on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
- | Fields[0].NumericFieldSettings.Required | false |
- | Fields[0].NumericFieldSettings.DefaultValue | 4 |
+ | Fields[0].NumericFieldSettings.DefaultValue | 1234 |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Guests.Value | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Guests:"
- And I should see "4"
+ Then I should see "value=\"1234\""
- # If required and no value, the default value should be used
+ # The required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | true |
- | Fields[0].NumericFieldSettings.DefaultValue | 5 |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Guests.Value | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- When I go to "Admin/Contents/List"
- Then I should see "Guests:"
- And I should see "5"
-
- # The default value should be validated
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].NumericFieldSettings.Required | false |
- | Fields[0].NumericFieldSettings.DefaultValue | a |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Guests.Value | |
- And I hit "Save"
- Then I should see "Guests or its default value is an invalid number"
-
- # The default value should be bound
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].NumericFieldSettings.Required | false |
- | Fields[0].NumericFieldSettings.Minimum | -10 |
- | Fields[0].NumericFieldSettings.Maximum | 100 |
- | Fields[0].NumericFieldSettings.DefaultValue | -20 |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Guests.Value | |
- And I hit "Save"
- Then I should see "The value must be greater than -10"
-
- # If required and no default value, the required attribute should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].NumericFieldSettings.Required | true |
- | Fields[0].NumericFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
- # If required and a default value is set, the required attribute should not be used
+ # The required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
- | Fields[0].NumericFieldSettings.Required | true |
- | Fields[0].NumericFieldSettings.DefaultValue | 6 |
+ | Fields[0].NumericFieldSettings.Required | false |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Numeric.feature.cs b/src/Orchard.Specs/Numeric.feature.cs
index ba4bda9ce..4b7744a44 100644
--- a/src/Orchard.Specs/Numeric.feature.cs
+++ b/src/Orchard.Specs/Numeric.feature.cs
@@ -266,37 +266,38 @@ this.ScenarioSetup(scenarioInfo);
#line 99
testRunner.And("I should see \"The value 'b' is not valid for Maximum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 102
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+ testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Required",
- "false"});
- table11.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- "4"});
+ "Event.Guests.Value",
+ "a"});
#line 103
testRunner.And("I fill in", ((string)(null)), table11, "And ");
-#line 107
+#line 106
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 108
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 107
+ testRunner.Then("I should see \"Guests is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 110
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
- "Event.Guests.Value",
- "a"});
-#line 109
+ "Fields[0].NumericFieldSettings.DefaultValue",
+ "1234"});
+#line 111
testRunner.And("I fill in", ((string)(null)), table12, "And ");
-#line 112
+#line 114
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 113
- testRunner.Then("I should see \"Guests or its default value is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 115
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 116
+ testRunner.Then("I should see \"value=\\\"1234\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 119
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
@@ -304,183 +305,31 @@ this.ScenarioSetup(scenarioInfo);
"value"});
table13.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
- "false"});
- table13.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- "4"});
-#line 117
+ "true"});
+#line 120
testRunner.And("I fill in", ((string)(null)), table13, "And ");
-#line 121
+#line 123
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 122
+#line 124
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 125
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 128
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
- "Event.Guests.Value",
- ""});
-#line 123
- testRunner.And("I fill in", ((string)(null)), table14, "And ");
-#line 126
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 127
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 128
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+ "Fields[0].NumericFieldSettings.Required",
+ "false"});
#line 129
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 130
- testRunner.Then("I should see \"Guests:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 131
- testRunner.And("I should see \"4\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.And("I fill in", ((string)(null)), table14, "And ");
+#line 132
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 133
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 134
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table15.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Required",
- "true"});
- table15.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- "5"});
-#line 135
- testRunner.And("I fill in", ((string)(null)), table15, "And ");
-#line 139
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 140
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table16.AddRow(new string[] {
- "Event.Guests.Value",
- ""});
-#line 141
- testRunner.And("I fill in", ((string)(null)), table16, "And ");
-#line 144
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 145
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 146
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 147
- testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 148
- testRunner.Then("I should see \"Guests:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 149
- testRunner.And("I should see \"5\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 152
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table17.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Required",
- "false"});
- table17.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- "a"});
-#line 153
- testRunner.And("I fill in", ((string)(null)), table17, "And ");
-#line 157
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 158
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table18.AddRow(new string[] {
- "Event.Guests.Value",
- ""});
-#line 159
- testRunner.And("I fill in", ((string)(null)), table18, "And ");
-#line 162
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 163
- testRunner.Then("I should see \"Guests or its default value is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 166
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table19.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Required",
- "false"});
- table19.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Minimum",
- "-10"});
- table19.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Maximum",
- "100"});
- table19.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- "-20"});
-#line 167
- testRunner.And("I fill in", ((string)(null)), table19, "And ");
-#line 173
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 174
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table20.AddRow(new string[] {
- "Event.Guests.Value",
- ""});
-#line 175
- testRunner.And("I fill in", ((string)(null)), table20, "And ");
-#line 178
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 179
- testRunner.Then("I should see \"The value must be greater than -10\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 182
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table21 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table21.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Required",
- "true"});
- table21.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- ""});
-#line 183
- testRunner.And("I fill in", ((string)(null)), table21, "And ");
-#line 187
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 188
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 189
- testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 192
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table22 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table22.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.Required",
- "true"});
- table22.AddRow(new string[] {
- "Fields[0].NumericFieldSettings.DefaultValue",
- "6"});
-#line 193
- testRunner.And("I fill in", ((string)(null)), table22, "And ");
-#line 197
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 198
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 199
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Specs/Text.feature b/src/Orchard.Specs/Text.feature
index 3ddeaee99..0be4fc693 100644
--- a/src/Orchard.Specs/Text.feature
+++ b/src/Orchard.Specs/Text.feature
@@ -67,60 +67,35 @@ Scenario: Creating and using Text fields
Then I should see "Subject"
When I fill in
| name | value |
- | Event.Subject.Text | Orchard Harvest 2013 |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- And I should see "Orchard Harvest 2013"
-
- # If not required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | false |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | Orchard Harvest 2014 |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Subject.Text | |
- And I hit "Save"
- And I am redirected
- Then I should see "Your Event has been created."
- And I should see "Orchard Harvest 2014"
-
- # If required and no value, the default value should be used
- When I go to "Admin/ContentTypes/Edit/Event"
- And I fill in
- | name | value |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | Orchard Harvest 2015 |
- And I hit "Save"
- And I go to "Admin/Contents/Create/Event"
- And I fill in
- | name | value |
- | Event.Subject.Text | |
+ | Event.Subject.Text | Orchard Harvest 2015 |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
And I should see "Orchard Harvest 2015"
- # If required and no default value, the required attribute should be used
+ # The default value should be proposed on creation
+ When I go to "Admin/ContentTypes/Edit/Event"
+ And I fill in
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | Orchard Harvest 2016 |
+ And I hit "Save"
+ And I go to "Admin/Contents/Create/Event"
+ Then I should see "value=\"Orchard Harvest 2016\""
+
+ # The required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
- # If required and a default value is set, the required attribute should not be used
+ # The required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
- | name | value |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | true |
- | Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue | Orchard Harvest 2015 |
+ | name | value |
+ | Fields[0].TextFieldSettingsEventsViewModel.Settings.Required | false |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""
\ No newline at end of file
diff --git a/src/Orchard.Specs/Text.feature.cs b/src/Orchard.Specs/Text.feature.cs
index bb37125eb..922a28491 100644
--- a/src/Orchard.Specs/Text.feature.cs
+++ b/src/Orchard.Specs/Text.feature.cs
@@ -197,7 +197,7 @@ this.ScenarioSetup(scenarioInfo);
"value"});
table7.AddRow(new string[] {
"Event.Subject.Text",
- "Orchard Harvest 2013"});
+ "Orchard Harvest 2015"});
#line 68
testRunner.When("I fill in", ((string)(null)), table7, "When ");
#line 71
@@ -207,43 +207,42 @@ this.ScenarioSetup(scenarioInfo);
#line 73
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 74
- testRunner.And("I should see \"Orchard Harvest 2013\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.And("I should see \"Orchard Harvest 2015\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 77
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
- table8.AddRow(new string[] {
- "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
- "false"});
table8.AddRow(new string[] {
"Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue",
- "Orchard Harvest 2014"});
+ "Orchard Harvest 2016"});
#line 78
testRunner.And("I fill in", ((string)(null)), table8, "And ");
-#line 82
+#line 81
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 83
+#line 82
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 83
+ testRunner.Then("I should see \"value=\\\"Orchard Harvest 2016\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 86
+ testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table9.AddRow(new string[] {
- "Event.Subject.Text",
- ""});
-#line 84
- testRunner.And("I fill in", ((string)(null)), table9, "And ");
+ "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
+ "true"});
#line 87
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 88
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 89
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+ testRunner.And("I fill in", ((string)(null)), table9, "And ");
#line 90
- testRunner.And("I should see \"Orchard Harvest 2014\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 93
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 91
+ testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 92
+ testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
+#line 95
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
@@ -251,72 +250,14 @@ this.ScenarioSetup(scenarioInfo);
"value"});
table10.AddRow(new string[] {
"Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
- "true"});
- table10.AddRow(new string[] {
- "Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue",
- "Orchard Harvest 2015"});
-#line 94
+ "false"});
+#line 96
testRunner.And("I fill in", ((string)(null)), table10, "And ");
-#line 98
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 99
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table11.AddRow(new string[] {
- "Event.Subject.Text",
- ""});
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 100
- testRunner.And("I fill in", ((string)(null)), table11, "And ");
-#line 103
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 104
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 105
- testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 106
- testRunner.And("I should see \"Orchard Harvest 2015\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 109
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table12.AddRow(new string[] {
- "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
- "true"});
- table12.AddRow(new string[] {
- "Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue",
- ""});
-#line 110
- testRunner.And("I fill in", ((string)(null)), table12, "And ");
-#line 114
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 115
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 116
- testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 119
- testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
- TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table13.AddRow(new string[] {
- "Fields[0].TextFieldSettingsEventsViewModel.Settings.Required",
- "true"});
- table13.AddRow(new string[] {
- "Fields[0].TextFieldSettingsEventsViewModel.Settings.DefaultValue",
- "Orchard Harvest 2015"});
-#line 120
- testRunner.And("I fill in", ((string)(null)), table13, "And ");
-#line 124
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 125
- testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 126
+#line 101
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
index 24b455019..8b8b92abc 100644
--- a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
+++ b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
@@ -45,10 +45,13 @@ namespace Orchard.Core.Common.Drivers {
protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) {
return ContentShape("Fields_Common_Text_Edit", GetDifferentiator(field, part),
() => {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ var text = part.IsNew() ? settings.DefaultValue : field.Value;
+
var viewModel = new TextFieldDriverViewModel {
Field = field,
- Text = field.Value,
- Settings = field.PartFieldDefinition.Settings.GetModel(),
+ Text = text,
+ Settings = settings,
ContentItem = part.ContentItem
};
@@ -65,10 +68,6 @@ namespace Orchard.Core.Common.Drivers {
field.Value = viewModel.Text;
- if (String.IsNullOrWhiteSpace(field.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
- field.Value = settings.DefaultValue;
- }
-
if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
updater.AddModelError("Text", T("The field {0} is mandatory", T(field.DisplayName)));
}
diff --git a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml
index bbd84d350..01bdbffde 100644
--- a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml
+++ b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/TextFieldDefaultValueEditor.cshtml
@@ -1,8 +1,6 @@
@model Orchard.Core.Common.ViewModels.TextFieldSettingsEventsViewModel
-@* This is a token-less default value editor that can be overridden from features that can depend on Orchard.Tokens. *@
-
@Html.TextBoxFor(m => m.Settings.DefaultValue, new { @class = "text large" })
-@T("Default value for the field. If there is no value given for the actual field, this will be filled in. (optional)")
+@T("The default value proposed when creating a content item. (optional)")
@Html.ValidationMessageFor(m => m.Settings.DefaultValue)
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml
index ad7b3ea1f..833887b1a 100644
--- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml
+++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml
@@ -1,20 +1,15 @@
@model Orchard.Core.Common.ViewModels.TextFieldDriverViewModel
-@{
- var isRequired = Model.Settings.Required && String.IsNullOrWhiteSpace(Model.Settings.DefaultValue);
-}
+
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/BooleanFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/BooleanFieldDriver.cs
index 683e712e9..012009b37 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/BooleanFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/BooleanFieldDriver.cs
@@ -34,26 +34,22 @@ namespace Orchard.Fields.Drivers {
}
protected override DriverResult Editor(ContentPart part, BooleanField field, dynamic shapeHelper) {
- // if the content item is new, assign the default value
- if(!part.HasDraft() && !part.HasPublished()) {
- var settings = field.PartFieldDefinition.Settings.GetModel();
- field.Value = settings.DefaultValue;
- }
-
return ContentShape("Fields_Boolean_Edit", GetDifferentiator(field, part),
- () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part)));
+ () => {
+ if (part.IsNew()) {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ field.Value = settings.DefaultValue;
+ }
+ return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
+ });
}
protected override DriverResult Editor(ContentPart part, BooleanField field, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel();
+
if (!settings.Optional && !field.Value.HasValue) {
- if (settings.DefaultValue.HasValue) {
- field.Value = settings.DefaultValue;
- }
- else {
- updater.AddModelError(field.Name, T("The field {0} is mandatory.", T(field.DisplayName)));
- }
+ updater.AddModelError(field.Name, T("The field {0} is mandatory.", T(field.DisplayName)));
}
}
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/DateTimeFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/DateTimeFieldDriver.cs
index af36b27b3..b134a716f 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/DateTimeFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/DateTimeFieldDriver.cs
@@ -75,7 +75,7 @@ namespace Orchard.Fields.Drivers {
protected override DriverResult Editor(ContentPart part, DateTimeField field, dynamic shapeHelper) {
var settings = field.PartFieldDefinition.Settings.GetModel();
- var value = field.DateTime;
+ var value = part.IsNew() ? settings.DefaultValue : field.DateTime;
var options = new DateLocalizationOptions();
// Don't do any time zone conversion if field is semantically a date-only field, because that might mutate the date component.
@@ -96,7 +96,6 @@ namespace Orchard.Fields.Drivers {
Name = field.DisplayName,
Hint = settings.Hint,
IsRequired = settings.Required,
- HasDefaultValue = settings.DefaultValue.HasValue,
Editor = new DateTimeEditor() {
Date = showDate ? DateLocalizationServices.ConvertToLocalizedDateString(value, options) : null,
Time = showTime ? DateLocalizationServices.ConvertToLocalizedTimeString(value, options) : null,
@@ -133,37 +132,26 @@ namespace Orchard.Fields.Drivers {
var showTime = settings.Display == DateTimeFieldDisplays.DateAndTime || settings.Display == DateTimeFieldDisplays.TimeOnly;
DateTime? value = null;
- var IsParseError = false;
- // If required and one field is missing, don't try to parse data.
- if (settings.Required && ((showDate && String.IsNullOrWhiteSpace(viewModel.Editor.Date)) || (showTime && String.IsNullOrWhiteSpace(viewModel.Editor.Time)))) {
- // And use the default value only if all required fields are empty.
- if (!showDate || !showTime || (String.IsNullOrWhiteSpace(viewModel.Editor.Date) && String.IsNullOrWhiteSpace(viewModel.Editor.Time))) {
- value = settings.DefaultValue;
- }
- }
- else {
+ // Try to parse data if not required or if there are no missing fields.
+ if (!settings.Required || ((!showDate || !String.IsNullOrWhiteSpace(viewModel.Editor.Date)) && (!showTime || !String.IsNullOrWhiteSpace(viewModel.Editor.Time)))) {
try {
- var utcDateTime = DateLocalizationServices.ConvertFromLocalizedString(viewModel.Editor.Date, viewModel.Editor.Time, options);
- value = utcDateTime.HasValue ? utcDateTime : settings.DefaultValue;
+ value = DateLocalizationServices.ConvertFromLocalizedString(viewModel.Editor.Date, viewModel.Editor.Time, options);
}
catch {
- IsParseError = true;
updater.AddModelError(GetPrefix(field, part), T("{0} could not be parsed as a valid date and time.", field.DisplayName));
}
}
- if (!IsParseError) {
- // Hackish workaround to make sure a time-only field with an entered time equivalent to
- // 00:00 UTC doesn't get stored as a full DateTime.MinValue in the database, resulting
- // in it being interpreted as an empty value when subsequently retrieved.
- if (value.HasValue && settings.Display == DateTimeFieldDisplays.TimeOnly && value == DateTime.MinValue) {
- value = value.Value.AddDays(1);
- }
+ // Hackish workaround to make sure a time-only field with an entered time equivalent to
+ // 00:00 UTC doesn't get stored as a full DateTime.MinValue in the database, resulting
+ // in it being interpreted as an empty value when subsequently retrieved.
+ if (value.HasValue && settings.Display == DateTimeFieldDisplays.TimeOnly && value == DateTime.MinValue) {
+ value = value.Value.AddDays(1);
+ }
- if (settings.Required && (!value.HasValue || (settings.Display != DateTimeFieldDisplays.TimeOnly && value.Value.Date == DateTime.MinValue))) {
- updater.AddModelError(GetPrefix(field, part), T("{0} is required.", field.DisplayName));
- }
+ if (settings.Required && (!value.HasValue || (settings.Display != DateTimeFieldDisplays.TimeOnly && value.Value.Date == DateTime.MinValue))) {
+ updater.AddModelError(GetPrefix(field, part), T("{0} is required.", field.DisplayName));
}
field.DateTime = value.HasValue ? value.Value : DateTime.MinValue;
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs
index 46082bf7a..3f5f379f6 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs
@@ -4,7 +4,6 @@ using Orchard.ContentManagement.Handlers;
using Orchard.Fields.Fields;
using Orchard.Fields.Settings;
using Orchard.Localization;
-using Orchard.Tokens;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,11 +12,9 @@ namespace Orchard.Fields.Drivers {
public class EnumerationFieldDriver : ContentFieldDriver {
public IOrchardServices Services { get; set; }
private const string TemplateName = "Fields/Enumeration.Edit";
- private readonly ITokenizer _tokenizer;
- public EnumerationFieldDriver(IOrchardServices services, ITokenizer tokenizer) {
+ public EnumerationFieldDriver(IOrchardServices services) {
Services = services;
- _tokenizer = tokenizer;
T = NullLocalizer.Instance;
}
@@ -39,13 +36,12 @@ namespace Orchard.Fields.Drivers {
protected override DriverResult Editor(ContentPart part, EnumerationField field, dynamic shapeHelper) {
return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field, part),
() => {
- if (field.Value == null) {
+ if (part.IsNew()) {
var settings = field.PartFieldDefinition.Settings.GetModel();
if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
- field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary { { "Content", part.ContentItem } });
+ field.Value = settings.DefaultValue;
}
}
-
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
});
}
@@ -54,15 +50,6 @@ namespace Orchard.Fields.Drivers {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel();
- if (field.SelectedValues.Length == 0 && !String.IsNullOrWhiteSpace(settings.DefaultValue) && !String.IsNullOrWhiteSpace(settings.Options)) {
- field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary { { "Content", part.ContentItem } });
-
- string[] options = settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
- var selectedValues = field.SelectedValues.ToList();
- selectedValues.RemoveAll(value => !options.Any(value.Equals));
- field.SelectedValues = selectedValues.ToArray();
- }
-
if (settings.Required && field.SelectedValues.Length == 0) {
updater.AddModelError(field.Name, T("The field {0} is mandatory", T(field.DisplayName)));
}
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/InputFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/InputFieldDriver.cs
index b56fdc79d..1300df8c1 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/InputFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/InputFieldDriver.cs
@@ -4,19 +4,15 @@ using Orchard.ContentManagement.Handlers;
using Orchard.Fields.Fields;
using Orchard.Fields.Settings;
using Orchard.Localization;
-using Orchard.Tokens;
using System;
-using System.Collections.Generic;
namespace Orchard.Fields.Drivers {
public class InputFieldDriver : ContentFieldDriver {
public IOrchardServices Services { get; set; }
private const string TemplateName = "Fields/Input.Edit";
- private readonly ITokenizer _tokenizer;
- public InputFieldDriver(IOrchardServices services, ITokenizer tokenizer) {
+ public InputFieldDriver(IOrchardServices services) {
Services = services;
- _tokenizer = tokenizer;
T = NullLocalizer.Instance;
}
@@ -39,17 +35,19 @@ namespace Orchard.Fields.Drivers {
protected override DriverResult Editor(ContentPart part, InputField field, dynamic shapeHelper) {
return ContentShape("Fields_Input_Edit", GetDifferentiator(field, part),
- () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part)));
+ () => {
+ if (part.IsNew()) {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ field.Value = settings.DefaultValue;
+ }
+ return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
+ });
}
protected override DriverResult Editor(ContentPart part, InputField field, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel();
- if (String.IsNullOrWhiteSpace(field.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
- field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary { { "Content", part.ContentItem } });
- }
-
if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
updater.AddModelError(GetPrefix(field, part), T("The field {0} is mandatory.", T(field.DisplayName)));
}
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
index 0cf563921..554dee027 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/LinkFieldDriver.cs
@@ -4,7 +4,6 @@ using Orchard.ContentManagement.Handlers;
using Orchard.Fields.Fields;
using Orchard.Fields.Settings;
using Orchard.Localization;
-using Orchard.Tokens;
using System;
using System.Collections.Generic;
@@ -12,11 +11,9 @@ namespace Orchard.Fields.Drivers {
public class LinkFieldDriver : ContentFieldDriver {
public IOrchardServices Services { get; set; }
private const string TemplateName = "Fields/Link.Edit";
- private readonly ITokenizer _tokenizer;
- public LinkFieldDriver(IOrchardServices services, ITokenizer tokenizer) {
+ public LinkFieldDriver(IOrchardServices services) {
Services = services;
- _tokenizer = tokenizer;
T = NullLocalizer.Instance;
}
@@ -39,21 +36,20 @@ namespace Orchard.Fields.Drivers {
protected override DriverResult Editor(ContentPart part, LinkField field, dynamic shapeHelper) {
return ContentShape("Fields_Link_Edit", GetDifferentiator(field, part),
- () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part)));
+ () => {
+ if (part.IsNew()) {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ field.Value = settings.DefaultValue;
+ field.Text = settings.TextDefaultValue;
+ }
+ return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
+ });
}
protected override DriverResult Editor(ContentPart part, LinkField field, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel();
- if (String.IsNullOrWhiteSpace(field.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
- field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary { { "Content", part.ContentItem } });
- }
-
- if(!String.IsNullOrWhiteSpace(settings.TextDefaultValue) && String.IsNullOrWhiteSpace(field.Text)) {
- field.Text = _tokenizer.Replace(settings.TextDefaultValue, new Dictionary { { "Content", part.ContentItem } });
- }
-
if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
updater.AddModelError(GetPrefix(field, part), T("Url is required for {0}", field.DisplayName));
}
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/NumericFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/NumericFieldDriver.cs
index 22d1dbeef..583c225e6 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/NumericFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/NumericFieldDriver.cs
@@ -5,7 +5,6 @@ using Orchard.Fields.Fields;
using Orchard.Fields.Settings;
using Orchard.Fields.ViewModels;
using Orchard.Localization;
-using Orchard.Tokens;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -15,11 +14,9 @@ namespace Orchard.Fields.Drivers {
public IOrchardServices Services { get; set; }
private const string TemplateName = "Fields/Numeric.Edit";
private readonly Lazy _cultureInfo;
- private readonly ITokenizer _tokenizer;
- public NumericFieldDriver(IOrchardServices services, ITokenizer tokenizer) {
+ public NumericFieldDriver(IOrchardServices services) {
Services = services;
- _tokenizer = tokenizer;
T = NullLocalizer.Instance;
_cultureInfo = new Lazy(() => CultureInfo.GetCultureInfo(Services.WorkContext.CurrentCulture));
@@ -46,10 +43,13 @@ namespace Orchard.Fields.Drivers {
protected override DriverResult Editor(ContentPart part, NumericField field, dynamic shapeHelper) {
return ContentShape("Fields_Numeric_Edit", GetDifferentiator(field, part),
() => {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ var value = part.IsNew() ? settings.DefaultValue : Convert.ToString(field.Value, _cultureInfo.Value);
+
var model = new NumericFieldViewModel {
Field = field,
- Settings = field.PartFieldDefinition.Settings.GetModel(),
- Value = Convert.ToString(field.Value, _cultureInfo.Value)
+ Settings = settings,
+ Value = value
};
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: GetPrefix(field, part));
@@ -64,10 +64,6 @@ namespace Orchard.Fields.Drivers {
var settings = field.PartFieldDefinition.Settings.GetModel();
- if (String.IsNullOrWhiteSpace(viewModel.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
- viewModel.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary { { "Content", part.ContentItem } });
- }
-
field.Value = null;
if (String.IsNullOrWhiteSpace(viewModel.Value)) {
@@ -76,7 +72,7 @@ namespace Orchard.Fields.Drivers {
}
}
else if (!Decimal.TryParse(viewModel.Value, NumberStyles.Any, _cultureInfo.Value, out value)) {
- updater.AddModelError(GetPrefix(field, part), T("{0} or its default value is an invalid number", field.DisplayName));
+ updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid number", field.DisplayName));
}
else {
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/TextFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/TextFieldDriver.cs
deleted file mode 100644
index dfb816aa4..000000000
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/TextFieldDriver.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Orchard.ContentManagement;
-using Orchard.ContentManagement.Drivers;
-using Orchard.Core.Common.Fields;
-using Orchard.Core.Common.Settings;
-using Orchard.Localization;
-using Orchard.Tokens;
-using System;
-using System.Collections.Generic;
-
-namespace Orchard.Fields.Drivers {
- // The original driver of the TextField is in Orchard.Core, where tokenization can not be used.
- // This driver was added so the default value of the TextField can be tokenized.
- public class TextFieldDriver : ContentFieldDriver {
- private readonly ITokenizer _tokenizer;
-
- public TextFieldDriver(ITokenizer tokenizer) {
- _tokenizer = tokenizer;
- T = NullLocalizer.Instance;
- }
-
- public Localizer T { get; set; }
-
- protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) {
- var settings = field.PartFieldDefinition.Settings.GetModel();
-
- if (!String.IsNullOrWhiteSpace(settings.DefaultValue) && (String.IsNullOrWhiteSpace(field.Value) || field.Value.Equals(settings.DefaultValue))) {
- field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary { { "Content", part.ContentItem } });
-
- if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
- updater.AddModelError("Text", T("The field {0} is mandatory", T(field.DisplayName)));
- }
- }
-
- return null;
- }
- }
-}
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj b/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj
index c910f9cfb..c3d876013 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj
@@ -100,7 +100,6 @@
-
@@ -178,9 +177,6 @@
-
-
-
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs b/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs
index 5fea628c6..d140dcbd0 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/ViewModels/DateTimeFieldViewModel.cs
@@ -6,6 +6,5 @@ namespace Orchard.Fields.ViewModels {
public string Hint { get; set; }
public bool IsRequired { get; set; }
public DateTimeEditor Editor { get; set; }
- public bool HasDefaultValue { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml
index b6b72d301..304fbce36 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/DateTimeFieldSettings.cshtml
@@ -32,7 +32,7 @@
@Html.EditorFor(m => m.Editor)
- @T("Pick a default date for the field. (optional)")
+ @T("Pick a default date to be proposed when creating a content item. (optional)")
@Html.ValidationMessageFor(m => m.Editor)
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml
index ffd253bff..3bb5e88d2 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/EnumerationFieldSettings.cshtml
@@ -31,8 +31,9 @@
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml
index 59ea5b344..34fbee18f 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/DefinitionTemplates/InputFieldSettings.cshtml
@@ -1,5 +1,4 @@
@model Orchard.Fields.Settings.InputFieldSettings
-@using Orchard.Fields.Settings;