Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test to show that select() doesn't always auto select options …

…named 'Array'. Disproves #412
  • Loading branch information...
commit e304c48ec4f3569c1d1b17cefed3bdd94a7c415d 1 parent 677ff2d
@markstory markstory authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 cake/tests/cases/libs/view/helpers/form.test.php
View
30 cake/tests/cases/libs/view/helpers/form.test.php
@@ -3237,6 +3237,36 @@ function testSelectMultipleCheckboxes() {
'/div'
);
$this->assertTags($result, $expected);
+
+ $this->Form->data = array('Model' => array('tags' => array(1)));
+ $result = $this->Form->select(
+ 'Model.tags', array('1' => 'first', 'Array' => 'Array'), null, array('multiple' => 'checkbox')
+ );
+ $expected = array(
+ 'input' => array(
+ 'type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'
+ ),
+ array('div' => array('class' => 'checkbox')),
+ array('input' => array(
+ 'type' => 'checkbox', 'name' => 'data[Model][tags][]',
+ 'value' => '1', 'id' => 'ModelTags1', 'checked' => 'checked'
+ )),
+ array('label' => array('for' => 'ModelTags1', 'class' => 'selected')),
+ 'first',
+ '/label',
+ '/div',
+
+ array('div' => array('class' => 'checkbox')),
+ array('input' => array(
+ 'type' => 'checkbox', 'name' => 'data[Model][tags][]',
+ 'value' => 'Array', 'id' => 'ModelTagsArray'
+ )),
+ array('label' => array('for' => 'ModelTagsArray')),
+ 'Array',
+ '/label',
+ '/div'
+ );
+ $this->assertTags($result, $expected);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.