Skip to content

Commit

Permalink
Fixed test break of Html.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed May 22, 2014
1 parent cbf27d1 commit 96feeb8
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/unit/framework/helpers/HtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,23 @@ public function testListBox()
<option value="value2">text2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems(), ['size' => 5, 'encodeSpaces' => true]));
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems(), ['size' => 5]));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value 2">text&nbsp;&nbsp;2</option>
<option value="value 2">text 2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2()));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value 2">text&nbsp;&nbsp;2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2(), ['encodeSpaces' => true]));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1">text1</option>
<option value="value2" selected>text2</option>
</select>
Expand Down Expand Up @@ -499,7 +506,15 @@ public function testRenderOptions()
];
$this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));

$attributes['encodeSpaces'] = false;
$attributes = [
'prompt' => 'please select<>',
'options' => [
'value111' => ['class' => 'option'],
],
'groups' => [
'group12' => ['class' => 'group'],
],
];
$this->assertEqualsWithoutLE(str_replace('&nbsp;', ' ', $expected), Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));
}

Expand Down

0 comments on commit 96feeb8

Please sign in to comment.