Skip to content

Commit

Permalink
Merge pull request #71 from kschroeder/develop
Browse files Browse the repository at this point in the history
Updated to better handle permittedValues in <select> elements
  • Loading branch information
kschroeder committed May 25, 2017
2 parents b7915c1 + de64aaf commit 8490381
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/View/Controllers/View.php
Expand Up @@ -137,7 +137,7 @@ protected function getSourceData(\SimpleXMLElement $node)
} else if (isset($node->permittedValues)) {
$source = [];
foreach ($node->permittedValues->children() as $value) {
$source[] = (string)$value;
$source[(string)$value] = (string)$value;
}
return $source;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/View/ViewTest.php
Expand Up @@ -73,8 +73,8 @@ public function testViewRendering()
self::assertXpathExists($simpleXml, '//input[@type="text" and @name="section1_test_element"]'); // we do this separately to test if the element exists apart from whether it has a value.
self::assertXpathExists($simpleXml, '//input[@type="text" and @name="section1_test_element" and @value="Element Value"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="yes"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="no"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="yes" and @value="yes"]');
self::assertXpathExists($simpleXml, '//select[@name="section1_test_permitted"]/option[.="no" and @value="no"]');
}

public function getViewConfiguration(array $params = [], $method = 'GET')
Expand Down

0 comments on commit 8490381

Please sign in to comment.