Extends
lithium\test\Unit
Demonstrates that the options for a `<label />` element can be passed through the `field()`
method, using the label text as a key.
Source
public function testFieldLabelWithOptions() {
$result = $this->form->field('name', array(
'label' => array('Item Name' => array('class' => 'required'))
));
$this->assertTags($result, array(
'div' => array(),
'label' => array('for' => 'Name', 'class' => 'required'), 'Item Name', '/label',
'input' => array('type' => 'text', 'name' => 'name', 'id' => 'Name')
));
$result = $this->form->field('video_preview', array(
'label' => array('<a href="http://www.youtube.com/">Youtube</a>' => array(
'escape' => false
))
));
$this->assertTags($result, array(
'div' => array(),
'label' => array('for' => 'VideoPreview'),
'a' => array('href' => 'http://www.youtube.com/'), 'Youtube', '/a', '/label',
'input' => array('type' => 'text', 'name' => 'video_preview', 'id' => 'VideoPreview')
));
}