Commit 96feeb89 by Qiang Xue

Fixed test break of Html.

parent cbf27d14
...@@ -289,16 +289,23 @@ EOD; ...@@ -289,16 +289,23 @@ EOD;
<option value="value2">text2</option> <option value="value2">text2</option>
</select> </select>
EOD; 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 $expected = <<<EOD
<select name="test" size="4"> <select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option> <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> </select>
EOD; EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2())); $this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2()));
$expected = <<<EOD $expected = <<<EOD
<select name="test" size="4"> <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="value1">text1</option>
<option value="value2" selected>text2</option> <option value="value2" selected>text2</option>
</select> </select>
...@@ -499,7 +506,15 @@ EOD; ...@@ -499,7 +506,15 @@ EOD;
]; ];
$this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(['value111', 'value1'], $data, $attributes)); $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)); $this->assertEqualsWithoutLE(str_replace('&nbsp;', ' ', $expected), Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment