Skip to content

Commit

Permalink
[Form] Add missing checks for testable features
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Apr 6, 2015
1 parent 60d3c34 commit a79b57b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
Expand Up @@ -240,14 +240,16 @@ public function testSingleChoiceAttributes()
'expanded' => false,
));

$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';

$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
[@name="name"]
[@class="my&class form-control"]
[not(@required)]
[
./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][@class="foo&bar"][not(@selected)][.="[trans]Choice&B[/trans]"]
/following-sibling::option[@value="&b"]'.$classPart.'[not(@selected)][.="[trans]Choice&B[/trans]"]
]
[count(./option)=2]
'
Expand Down Expand Up @@ -529,6 +531,8 @@ public function testMultipleChoiceAttributes()
'expanded' => false,
));

$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';

$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
[@name="name[]"]
Expand All @@ -537,7 +541,7 @@ public function testMultipleChoiceAttributes()
[@multiple="multiple"]
[
./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][@class="foo&bar"][not(@selected)][.="[trans]Choice&B[/trans]"]
/following-sibling::option[@value="&b"]'.$classPart.'[not(@selected)][.="[trans]Choice&B[/trans]"]
]
[count(./option)=2]
'
Expand Down Expand Up @@ -634,6 +638,8 @@ public function testSingleChoiceExpandedAttributes()
'expanded' => true,
));

$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';

$this->assertWidgetMatchesXpath($form->createView(), array(),
'/div
[
Expand All @@ -652,7 +658,7 @@ public function testSingleChoiceExpandedAttributes()
./label
[.="[trans]Choice&B[/trans]"]
[
./input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][not(@checked)][@class="foo&bar"]
./input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][not(@checked)]'.$classPart.'
]
]
/following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"]
Expand Down Expand Up @@ -796,6 +802,8 @@ public function testMultipleChoiceExpandedAttributes()
'required' => true,
));

$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';

$this->assertWidgetMatchesXpath($form->createView(), array(),
'/div
[
Expand All @@ -814,7 +822,7 @@ public function testMultipleChoiceExpandedAttributes()
./label
[.="[trans]Choice&B[/trans]"]
[
./input[@type="checkbox"][@name="name[]"][@id="name_1"][not(@checked)][not(@required)][@class="foo&bar"]
./input[@type="checkbox"][@name="name[]"][@id="name_1"][not(@checked)][not(@required)]'.$classPart.'
]
]
/following-sibling::div
Expand Down

0 comments on commit a79b57b

Please sign in to comment.