mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Fix #19098: Add yii\helper\BaseHtml::$normalizeClassAttribute to fix duplicate classes
This commit is contained in:
@ -1082,12 +1082,14 @@ EOD;
|
||||
$this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(['1.10'], $data, $attributes));
|
||||
}
|
||||
|
||||
public function testRenderAttributes()
|
||||
public function testRenderTagAttributes()
|
||||
{
|
||||
$this->assertEquals('', Html::renderTagAttributes([]));
|
||||
$this->assertEquals(' name="test" value="1<>"', Html::renderTagAttributes(['name' => 'test', 'empty' => null, 'value' => '1<>']));
|
||||
$this->assertEquals(' checked disabled', Html::renderTagAttributes(['checked' => true, 'disabled' => true, 'hidden' => false]));
|
||||
$this->assertEquals(' class="first second"', Html::renderTagAttributes(['class' => ['first', 'second']]));
|
||||
Html::$normalizeClassAttribute = true;
|
||||
$this->assertEquals(' class="first second"', Html::renderTagAttributes(['class' => ['first second', 'first']]));
|
||||
$this->assertEquals('', Html::renderTagAttributes(['class' => []]));
|
||||
$this->assertEquals(' style="width: 100px; height: 200px;"', Html::renderTagAttributes(['style' => ['width' => '100px', 'height' => '200px']]));
|
||||
$this->assertEquals('', Html::renderTagAttributes(['style' => []]));
|
||||
|
||||
Reference in New Issue
Block a user