Esempio n. 1
0
    /**
     * Method to test prepareAttributes().
     *
     * @return void
     *
     * @covers Windwalker\Form\Field\TextField::prepareAttributes
     */
    public function testRender()
    {
        $html = <<<HTML
<select name="flower" id="flower" class="stub-flower" size="10" disabled="true" onchange="return false;">
\t<option value="" selected="selected"></option>
\t<option value="Yes">1</option>
\t<option value="No">0</option>
</select>
HTML;
        $this->assertDomStringEqualsDomString($html, $this->instance->renderInput());
        $this->instance->setValue(1);
        $html = <<<HTML
<select name="flower" id="flower" class="stub-flower" size="10" disabled="true" onchange="return false;">
\t<option value="" selected="selected"></option>
\t<option value="Yes">1</option>
\t<option value="No">0</option>
</select>
HTML;
        $this->assertDomStringEqualsDomString($html, $this->instance->renderInput());
        $this->instance->setAttribute('multiple', true);
        $html = <<<HTML
<select name="flower[]" id="flower" class="stub-flower" size="10" disabled="true" onchange="return false;" multiple="true">
\t<option value="" selected="selected"></option>
\t<option value="Yes">1</option>
\t<option value="No">0</option>
</select>
HTML;
        $this->assertDomStringEqualsDomString($html, $this->instance->renderInput());
    }