Permalink
Browse files

[Form] Add tests to prove that label is not rendered when is marked a…

…s false
  • Loading branch information...
1 parent 0679b54 commit f16bb460d96d0d7652e217f5b1797c4c57280ceb @stloyd stloyd committed Dec 11, 2012
Showing with 36 additions and 0 deletions.
  1. +17 −0 Tests/AbstractDivLayoutTest.php
  2. +19 −0 Tests/AbstractTableLayoutTest.php
@@ -526,6 +526,23 @@ public function testLabelHasNoId()
);
}
+ public function testLabelIsNotRenderedWhenSetToFalse()
+ {
+ $form = $this->factory->createNamed('name', 'text', null, array(
+ 'label' => false
+ ));
+ $html = $this->renderRow($form->createView());
+
+ $this->assertMatchesXpath($html,
+'/div
+ [
+ ./input[@id="name"]
+ ]
+ [count(//label)=0]
+'
+ );
+ }
+
/**
* @dataProvider themeBlockInheritanceProvider
*/
@@ -39,6 +39,25 @@ public function testRow()
);
}
+ public function testLabelIsNotRenderedWhenSetToFalse()
+ {
+ $form = $this->factory->createNamed('name', 'text', null, array(
+ 'label' => false
+ ));
+ $html = $this->renderRow($form->createView());
+
+ $this->assertMatchesXpath($html,
+'/tr
+ [
+ ./td
+ [count(//label)=0]
+ /following-sibling::td
+ [./input[@id="name"]]
+ ]
+'
+ );
+ }
+
public function testRepeatedRow()
{
$form = $this->factory->createNamed('name', 'repeated');

0 comments on commit f16bb46

Please sign in to comment.