mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding some spec tests around setting a page as the home page
--HG-- branch : dev
This commit is contained in:
@@ -213,6 +213,23 @@ namespace Orchard.Specs.Bindings {
|
|||||||
else if (radio.Attributes.Contains("checked"))
|
else if (radio.Attributes.Contains("checked"))
|
||||||
radio.Attributes.Remove("checked");
|
radio.Attributes.Remove("checked");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "checkbox":
|
||||||
|
if (string.Equals(row["value"], "true", StringComparison.OrdinalIgnoreCase)) {
|
||||||
|
input.Attributes.Add("checked", "checked");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
input.Attributes.Remove("checked");
|
||||||
|
}
|
||||||
|
|
||||||
|
var hiddenForCheckbox = inputs.Where(
|
||||||
|
x =>
|
||||||
|
x.GetAttributeValue("type", "") == "hidden" &&
|
||||||
|
x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]
|
||||||
|
).FirstOrDefault();
|
||||||
|
if (hiddenForCheckbox != null)
|
||||||
|
hiddenForCheckbox.Attributes.Add("value", row["value"]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
input.Attributes.Add("value", row["value"]);
|
input.Attributes.Add("value", row["value"]);
|
||||||
|
@@ -40,3 +40,29 @@ Scenario: If I create a page which gets a conflicting path generated its path is
|
|||||||
And I go to "super-duper-2"
|
And I go to "super-duper-2"
|
||||||
Then I should see "<h1[^>]*>.*?Super Duper.*?</h1>"
|
Then I should see "<h1[^>]*>.*?Super Duper.*?</h1>"
|
||||||
And I should see "This is super number two."
|
And I should see "This is super number two."
|
||||||
|
|
||||||
|
Scenario: A new page marked to be the home page and publish does take over the home page and is not accessible from its own standard path.
|
||||||
|
Given I have installed Orchard
|
||||||
|
When I go to "admin/contents/create/page"
|
||||||
|
And I fill in
|
||||||
|
| name | value |
|
||||||
|
| Routable.Title | Super Duper |
|
||||||
|
| Body.Text | This is a draft of the new home page. |
|
||||||
|
| Routable.PromoteToHomePage | true |
|
||||||
|
And I hit "Publish Now"
|
||||||
|
And I go to "/Default.aspx"
|
||||||
|
Then I should see "<h1>Super Duper</h1>"
|
||||||
|
When I go to "super-duper"
|
||||||
|
Then the status should be 404 "Not Found"
|
||||||
|
|
||||||
|
Scenario: A new page marked to be the home page but only saved as draft does not take over the home page
|
||||||
|
Given I have installed Orchard
|
||||||
|
When I go to "admin/contents/create/page"
|
||||||
|
And I fill in
|
||||||
|
| name | value |
|
||||||
|
| Routable.Title | Drafty |
|
||||||
|
| Body.Text | This is a draft of the new home page. |
|
||||||
|
| Routable.PromoteToHomePage | true |
|
||||||
|
And I hit "Save"
|
||||||
|
And I go to "/Default.aspx"
|
||||||
|
Then I should see "<h1>Welcome to Orchard!</h1>"
|
||||||
|
86
src/Orchard.Specs/Pages.feature.cs
generated
86
src/Orchard.Specs/Pages.feature.cs
generated
@@ -1,7 +1,7 @@
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||||
// SpecFlow Version:1.3.2.0
|
// SpecFlow Version:1.4.0.0
|
||||||
// Runtime Version:4.0.30319.1
|
// Runtime Version:4.0.30319.1
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
@@ -14,7 +14,7 @@ namespace Orchard.Specs
|
|||||||
using TechTalk.SpecFlow;
|
using TechTalk.SpecFlow;
|
||||||
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
|
||||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[NUnit.Framework.TestFixtureAttribute()]
|
[NUnit.Framework.TestFixtureAttribute()]
|
||||||
[NUnit.Framework.DescriptionAttribute("Pages")]
|
[NUnit.Framework.DescriptionAttribute("Pages")]
|
||||||
@@ -31,7 +31,7 @@ namespace Orchard.Specs
|
|||||||
{
|
{
|
||||||
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
|
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
|
||||||
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Pages", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
|
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Pages", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
|
||||||
" and edit pages", ((string[])(null)));
|
" and edit pages", GenerationTargetLanguage.CSharp, ((string[])(null)));
|
||||||
testRunner.OnFeatureStart(featureInfo);
|
testRunner.OnFeatureStart(featureInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,6 +160,86 @@ testRunner.And("I go to \"super-duper-2\"");
|
|||||||
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
|
testRunner.Then("I should see \"<h1[^>]*>.*?Super Duper.*?</h1>\"");
|
||||||
#line 42
|
#line 42
|
||||||
testRunner.And("I should see \"This is super number two.\"");
|
testRunner.And("I should see \"This is super number two.\"");
|
||||||
|
#line hidden
|
||||||
|
testRunner.CollectScenarioErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
[NUnit.Framework.TestAttribute()]
|
||||||
|
[NUnit.Framework.DescriptionAttribute("A new page marked to be the home page and publish does take over the home page an" +
|
||||||
|
"d is not accessible from its own standard path.")]
|
||||||
|
public virtual void ANewPageMarkedToBeTheHomePageAndPublishDoesTakeOverTheHomePageAndIsNotAccessibleFromItsOwnStandardPath_()
|
||||||
|
{
|
||||||
|
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new page marked to be the home page and publish does take over the home page an" +
|
||||||
|
"d is not accessible from its own standard path.", ((string[])(null)));
|
||||||
|
#line 44
|
||||||
|
this.ScenarioSetup(scenarioInfo);
|
||||||
|
#line 45
|
||||||
|
testRunner.Given("I have installed Orchard");
|
||||||
|
#line 46
|
||||||
|
testRunner.When("I go to \"admin/contents/create/page\"");
|
||||||
|
#line hidden
|
||||||
|
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
|
"name",
|
||||||
|
"value"});
|
||||||
|
table4.AddRow(new string[] {
|
||||||
|
"Routable.Title",
|
||||||
|
"Super Duper"});
|
||||||
|
table4.AddRow(new string[] {
|
||||||
|
"Body.Text",
|
||||||
|
"This is a draft of the new home page."});
|
||||||
|
table4.AddRow(new string[] {
|
||||||
|
"Routable.PromoteToHomePage",
|
||||||
|
"true"});
|
||||||
|
#line 47
|
||||||
|
testRunner.And("I fill in", ((string)(null)), table4);
|
||||||
|
#line 52
|
||||||
|
testRunner.And("I hit \"Publish Now\"");
|
||||||
|
#line 53
|
||||||
|
testRunner.And("I go to \"/Default.aspx\"");
|
||||||
|
#line 54
|
||||||
|
testRunner.Then("I should see \"<h1>Super Duper</h1>\"");
|
||||||
|
#line 55
|
||||||
|
testRunner.When("I go to \"super-duper\"");
|
||||||
|
#line 56
|
||||||
|
testRunner.Then("the status should be 404 \"Not Found\"");
|
||||||
|
#line hidden
|
||||||
|
testRunner.CollectScenarioErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
[NUnit.Framework.TestAttribute()]
|
||||||
|
[NUnit.Framework.DescriptionAttribute("A new page marked to be the home page but only saved as draft does not take over " +
|
||||||
|
"the home page")]
|
||||||
|
public virtual void ANewPageMarkedToBeTheHomePageButOnlySavedAsDraftDoesNotTakeOverTheHomePage()
|
||||||
|
{
|
||||||
|
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new page marked to be the home page but only saved as draft does not take over " +
|
||||||
|
"the home page", ((string[])(null)));
|
||||||
|
#line 58
|
||||||
|
this.ScenarioSetup(scenarioInfo);
|
||||||
|
#line 59
|
||||||
|
testRunner.Given("I have installed Orchard");
|
||||||
|
#line 60
|
||||||
|
testRunner.When("I go to \"admin/contents/create/page\"");
|
||||||
|
#line hidden
|
||||||
|
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
|
"name",
|
||||||
|
"value"});
|
||||||
|
table5.AddRow(new string[] {
|
||||||
|
"Routable.Title",
|
||||||
|
"Drafty"});
|
||||||
|
table5.AddRow(new string[] {
|
||||||
|
"Body.Text",
|
||||||
|
"This is a draft of the new home page."});
|
||||||
|
table5.AddRow(new string[] {
|
||||||
|
"Routable.PromoteToHomePage",
|
||||||
|
"true"});
|
||||||
|
#line 61
|
||||||
|
testRunner.And("I fill in", ((string)(null)), table5);
|
||||||
|
#line 66
|
||||||
|
testRunner.And("I hit \"Save\"");
|
||||||
|
#line 67
|
||||||
|
testRunner.And("I go to \"/Default.aspx\"");
|
||||||
|
#line 68
|
||||||
|
testRunner.Then("I should see \"<h1>Welcome to Orchard!</h1>\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
testRunner.CollectScenarioErrors();
|
testRunner.CollectScenarioErrors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user