mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 02:44:52 +08:00
Adding "select" tags management in specflow tests
--HG-- branch : dev extra : transplant_source : %9C/%97%155%22%94w%07%FF%0A%0D5%02%ED%C3.%97%8E%C9
This commit is contained in:
@@ -206,7 +206,7 @@ namespace Orchard.Specs.Bindings {
|
||||
[When(@"I fill in")]
|
||||
public void WhenIFillIn(Table table) {
|
||||
var inputs = _doc.DocumentNode
|
||||
.SelectNodes("(//input|//textarea)") ?? Enumerable.Empty<HtmlNode>();
|
||||
.SelectNodes("(//input|//textarea|//select)") ?? Enumerable.Empty<HtmlNode>();
|
||||
|
||||
foreach (var row in table.Rows) {
|
||||
var r = row;
|
||||
@@ -244,7 +244,19 @@ namespace Orchard.Specs.Bindings {
|
||||
|
||||
break;
|
||||
default:
|
||||
input.Attributes.Add("value", row["value"]);
|
||||
if (string.Equals(input.Name, "select", StringComparison.OrdinalIgnoreCase)) {
|
||||
var options = input.ChildNodes;
|
||||
foreach (var option in options) {
|
||||
if (option.GetAttributeValue("value", "") == row["value"])
|
||||
option.Attributes.Add("selected", "selected");
|
||||
else if (option.Attributes.Contains("selected"))
|
||||
option.Attributes.Remove("selected");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
input.Attributes.Add("value", row["value"]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user