diff --git a/tests/framework/helpers/HtmlTest.php b/tests/framework/helpers/HtmlTest.php index 24c8186181b..5913cd55f03 100644 --- a/tests/framework/helpers/HtmlTest.php +++ b/tests/framework/helpers/HtmlTest.php @@ -83,6 +83,21 @@ public function testStyle() $this->assertEquals("", Html::style($content, ['type' => 'text/less'])); } + public function testStyleCustomAttribute() + { + $nonce = Yii::$app->security->generateRandomString(); + $this->mockApplication([ + 'components' => [ + 'view' => [ + 'class' => 'yii\web\View', + 'styleOptions' => ['nonce' => $nonce], + ], + ], + ]); + $content = 'a <>'; + $this->assertEquals("", Html::style($content)); + } + public function testScript() { $content = 'a <>';