Commit 5227d2db by Qiang Xue

refactoring.

parent 2422a134
...@@ -233,9 +233,26 @@ class HtmlTest extends \yii\test\TestCase ...@@ -233,9 +233,26 @@ class HtmlTest extends \yii\test\TestCase
public function testDropDownList() public function testDropDownList()
{ {
$this->assertEquals("<select name=\"test\">\n\n</select>", Html::dropDownList('test')); $expected = <<<EOD
$this->assertEquals("<select name=\"test\">\n<option value=\"value1\">text1</option>\n<option value=\"value2\">text2</option>\n</select>", Html::dropDownList('test', null, $this->getDataItems())); <select name="test">
$this->assertEquals("<select name=\"test\">\n<option value=\"value1\">text1</option>\n<option value=\"value2\" selected=\"selected\">text2</option>\n</select>", Html::dropDownList('test', 'value2', $this->getDataItems()));
</select>
EOD;
$this->assertEquals($expected, Html::dropDownList('test'));
$expected = <<<EOD
<select name="test">
<option value="value1">text1</option>
<option value="value2">text2</option>
</select>
EOD;
$this->assertEquals($expected, Html::dropDownList('test', null, $this->getDataItems()));
$expected = <<<EOD
<select name="test">
<option value="value1">text1</option>
<option value="value2" selected="selected">text2</option>
</select>
EOD;
$this->assertEquals($expected, Html::dropDownList('test', 'value2', $this->getDataItems()));
} }
public function testListBox() public function testListBox()
......
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