Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…s false
  • Loading branch information...
commit d5426f0a7609d97f5fa52a77be79a1280bddd460 1 parent 120547c
@stloyd authored
View
17 src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.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
*/
View
19 src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.