[Form] Add tests to prove that label is not rendered when is marked as false

This commit is contained in:
Joseph Bielawski 2012-12-11 09:37:25 +01:00
parent 120547c8bc
commit d5426f0a76
2 changed files with 36 additions and 0 deletions

View File

@ -526,6 +526,23 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
);
}
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 File

@ -39,6 +39,25 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
);
}
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');