Skip to content
Permalink
Browse files

Add tests for complex input rendering.

  • Loading branch information...
markstory committed Jan 15, 2014
1 parent 9bf5c3e commit e8ed1f58f5e39d79182fda355da30cd35ca4e464
Showing with 44 additions and 0 deletions.
  1. +44 −0 tests/TestCase/View/Input/MultiCheckboxTest.php
@@ -81,6 +81,50 @@ public function testRenderSimple() {
$this->assertTags($result, $expected);
}
/**
* Test render complex and additional attributes.
*
* @return void
*/
public function testRenderComplex() {
$input = new MultiCheckbox($this->templates);
$data = [
'name' => 'Tags[id]',
'options' => [
['value' => '1', 'text' => 'CakePHP', 'data-test' => 'val'],
['value' => '2', 'text' => 'Development', 'class' => 'custom'],
]
];
$result = $input->render($data);
$expected = [
['div' => ['class' => 'checkbox']],
['input' => [
'type' => 'checkbox',
'name' => 'Tags[id][]',
'value' => 1,
'id' => 'tags-id-1',
'data-test' => 'val',
]],
['label' => ['for' => 'tags-id-1']],
'CakePHP',
'/label',
'/div',
['div' => ['class' => 'checkbox']],
['input' => [
'type' => 'checkbox',
'name' => 'Tags[id][]',
'value' => 2,
'id' => 'tags-id-2',
'class' => 'custom',
]],
['label' => ['for' => 'tags-id-2']],
'Development',
'/label',
'/div',
];
$this->assertTags($result, $expected);
}
/**
* Test render escpaing options.
*

0 comments on commit e8ed1f5

Please sign in to comment.
You can’t perform that action at this time.