From 8f4a7b696aad1f59ae9378721924ea8a91d85382 Mon Sep 17 00:00:00 2001 From: Adnan Dautovic Date: Thu, 7 Apr 2022 13:10:02 +0200 Subject: [PATCH] Add additional tests for strict --- tests/framework/helpers/HtmlTest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/framework/helpers/HtmlTest.php b/tests/framework/helpers/HtmlTest.php index 6a38a45040b..9c17357ecdd 100644 --- a/tests/framework/helpers/HtmlTest.php +++ b/tests/framework/helpers/HtmlTest.php @@ -775,6 +775,14 @@ public function testCheckboxList() EOD; $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', ['1.1'], ['1' => '1', '1.1' => '1.1', '1.10' => '1.10'], ['strict' => true])); + $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', [1.1], ['1' => '1', '1.1' => '1.1', '1.10' => '1.10'], ['strict' => true])); + + $expected = <<<'EOD' +
+ +
+EOD; + $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', [1.1], ['1' => '1', '1.1' => '1.1', '1.10' => '1.10'])); } public function testRadioListWithArrayExpression() @@ -923,6 +931,14 @@ public function testRadioList() EOD; $this->assertEqualsWithoutLE($expected, Html::radioList('test', ['1.1'], ['1' => '1', '1.1' => '1.1', '1.10' => '1.10'], ['strict' => true])); + $this->assertEqualsWithoutLE($expected, Html::radioList('test', [1.1], ['1' => '1', '1.1' => '1.1', '1.10' => '1.10'], ['strict' => true])); + + $expected = <<<'EOD' +
+ +
+EOD; + $this->assertEqualsWithoutLE($expected, Html::radioList('test', ['1.1'], ['1' => '1', '1.1' => '1.1', '1.10' => '1.10'])); } public function testUl() @@ -1069,6 +1085,15 @@ public function testRenderOptions() $data = ['1' => '1', '1.1' => '1.1', '1.10' => '1.10']; $attributes = ['strict' => true]; $this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(['1.1'], $data, $attributes)); + $attributes = ['strict' => true]; + $this->assertEqualsWithoutLE($expected, Html::renderSelectOptions([1.1], $data, $attributes)); + + $expected = <<<'EOD' + + + +EOD; + $this->assertEqualsWithoutLE($expected, Html::renderSelectOptions([1.1], $data)); $expected = <<<'EOD' @@ -1097,6 +1122,8 @@ public function testRenderOptions() EOD; $attributes = ['prompt' => 'Please select', 'strict' => true]; $this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(false, $data, $attributes)); + $attributes = ['prompt' => 'Please select', 'strict' => true]; + $this->assertEqualsWithoutLE($expected, Html::renderSelectOptions([false], $data, $attributes)); } public function testRenderTagAttributes()