mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
@ -16,8 +16,17 @@ use yii\web\AssetManager;
|
|||||||
*/
|
*/
|
||||||
class ActiveFieldTest extends \yiiunit\TestCase
|
class ActiveFieldTest extends \yiiunit\TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var ActiveField
|
||||||
|
*/
|
||||||
private $activeField;
|
private $activeField;
|
||||||
|
/**
|
||||||
|
* @var DynamicModel
|
||||||
|
*/
|
||||||
private $helperModel;
|
private $helperModel;
|
||||||
|
/**
|
||||||
|
* @var ActiveForm
|
||||||
|
*/
|
||||||
private $helperForm;
|
private $helperForm;
|
||||||
private $attributeName = 'attributeName';
|
private $attributeName = 'attributeName';
|
||||||
|
|
||||||
@ -246,6 +255,19 @@ EOD;
|
|||||||
'value2' => ['label' => 'value 2'],
|
'value2' => ['label' => 'value 2'],
|
||||||
]]);
|
]]);
|
||||||
$this->assertEqualsWithoutLE($expectedValue, $this->activeField->parts['{input}']);
|
$this->assertEqualsWithoutLE($expectedValue, $this->activeField->parts['{input}']);
|
||||||
|
|
||||||
|
$expectedValue = <<<EOD
|
||||||
|
<input type="hidden" name="DynamicModel[attributeName]" value=""><select id="dynamicmodel-attributename" class="form-control" name="DynamicModel[attributeName]" size="4">
|
||||||
|
<option value="value1" disabled>Item One</option>
|
||||||
|
<option value="value2" selected label="value 2">Item 2</option>
|
||||||
|
</select>
|
||||||
|
EOD;
|
||||||
|
$this->activeField->model->{$this->attributeName} = 'value2';
|
||||||
|
$this->activeField->listBox(["value1" => "Item One", "value2" => "Item 2"], ['options' => [
|
||||||
|
'value1' => ['disabled' => true],
|
||||||
|
'value2' => ['label' => 'value 2'],
|
||||||
|
]]);
|
||||||
|
$this->assertEqualsWithoutLE($expectedValue, $this->activeField->parts['{input}']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetClientOptionsReturnEmpty()
|
public function testGetClientOptionsReturnEmpty()
|
||||||
|
Reference in New Issue
Block a user