diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs
index 3d3a6660e..94bd33e4f 100644
--- a/src/Orchard.Specs/Bindings/WebAppHosting.cs
+++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs
@@ -170,8 +170,10 @@ namespace Orchard.Specs.Bindings {
[When(@"I follow ""(.*)""")]
public void WhenIFollow(string linkText) {
var link = _doc.DocumentNode
- .SelectNodes("//a")
- .Single(elt => elt.InnerText == linkText);
+ .SelectNodes("//a")
+ .SingleOrDefault(elt => elt.InnerText == linkText)
+ ?? _doc.DocumentNode
+ .SelectSingleNode(string.Format("//a[@title='{0}']", linkText));
var urlPath = link.Attributes["href"].Value;
diff --git a/src/Orchard.Specs/Orchard.Specs.csproj b/src/Orchard.Specs/Orchard.Specs.csproj
index 864d5388b..9b863ec27 100644
--- a/src/Orchard.Specs/Orchard.Specs.csproj
+++ b/src/Orchard.Specs/Orchard.Specs.csproj
@@ -206,6 +206,11 @@
TrueWebHosting.feature
+
+ True
+ True
+ Widgets.feature
+
@@ -278,6 +283,10 @@
SpecFlowSingleFileGeneratorUsingSpecFlow.feature.cs
+
+ SpecFlowSingleFileGenerator
+ Widgets.feature.cs
+
diff --git a/src/Orchard.Specs/Widgets.feature b/src/Orchard.Specs/Widgets.feature
new file mode 100644
index 000000000..feed9f25f
--- /dev/null
+++ b/src/Orchard.Specs/Widgets.feature
@@ -0,0 +1,17 @@
+Feature: Widgets
+ In order to add and manage widgets on my site
+ As an author
+ I want to create and edit widgets and layers
+
+Scenario: I can edit a default layer
+ Given I have installed Orchard
+ When I go to "admin/widgets"
+ And I follow "Edit Default layer"
+ And I fill in
+ | name | value |
+ | Description | This is the default layer. |
+ And I hit "Save"
+ And I am redirected
+ Then I should see "Your Layer has been saved"
+ When I follow "Edit Default layer"
+ Then I should see ""
diff --git a/src/Orchard.Specs/Widgets.feature.cs b/src/Orchard.Specs/Widgets.feature.cs
new file mode 100644
index 000000000..a25672125
--- /dev/null
+++ b/src/Orchard.Specs/Widgets.feature.cs
@@ -0,0 +1,93 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.4.0.0
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+#region Designer generated code
+namespace Orchard.Specs
+{
+ using TechTalk.SpecFlow;
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [NUnit.Framework.TestFixtureAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Widgets")]
+ public partial class WidgetsFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "Widgets.feature"
+#line hidden
+
+ [NUnit.Framework.TestFixtureSetUpAttribute()]
+ public virtual void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Widgets", "In order to add and manage widgets on my site\r\nAs an author\r\nI want to create and" +
+ " edit widgets and layers", GenerationTargetLanguage.CSharp, ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [NUnit.Framework.TestFixtureTearDownAttribute()]
+ public virtual void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [NUnit.Framework.TearDownAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("I can edit a default layer")]
+ public virtual void ICanEditADefaultLayer()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can edit a default layer", ((string[])(null)));
+#line 6
+this.ScenarioSetup(scenarioInfo);
+#line 7
+ testRunner.Given("I have installed Orchard");
+#line 8
+ testRunner.When("I go to \"admin/widgets\"");
+#line 9
+ testRunner.And("I follow \"Edit Default layer\"");
+#line hidden
+ TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table1.AddRow(new string[] {
+ "Description",
+ "This is the default layer."});
+#line 10
+ testRunner.And("I fill in", ((string)(null)), table1);
+#line 13
+ testRunner.And("I hit \"Save\"");
+#line 14
+ testRunner.And("I am redirected");
+#line 15
+ testRunner.Then("I should see \"Your Layer has been saved\"");
+#line 16
+ testRunner.When("I follow \"Edit Default layer\"");
+#line 17
+ testRunner.Then("I should see \"\"");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
+#endregion
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs
index 61cc18316..a26c88a73 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs
@@ -44,16 +44,19 @@ namespace Orchard.ContentTypes.Controllers {
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type.")))
return new HttpUnauthorizedResult();
- if(String.IsNullOrWhiteSpace(viewModel.DisplayName)) {
- ModelState.AddModelError("DisplayName", T("The Content Type name can't be empty.").ToString());
+ viewModel.DisplayName = viewModel.DisplayName ?? String.Empty;
+ viewModel.Name = viewModel.Name ?? String.Empty;
+
+ if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) {
+ ModelState.AddModelError("DisplayName", T("The Display Name name can't be empty.").ToString());
}
if ( _contentDefinitionService.GetTypes().Any(t => String.Equals(t.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase)) ) {
- ModelState.AddModelError("Name", T("A type with the same technical name already exists.").ToString());
+ ModelState.AddModelError("Name", T("A type with the same Id already exists.").ToString());
}
if ( _contentDefinitionService.GetTypes().Any(t => String.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase)) ) {
- ModelState.AddModelError("DisplayName", T("A type with the same name already exists.").ToString());
+ ModelState.AddModelError("DisplayName", T("A type with the same Name already exists.").ToString());
}
if (!ModelState.IsValid) {
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml
index 5d9312b55..1ab25ecf9 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml
@@ -5,7 +5,7 @@