From 32688de621cddaccc342f8fedf2405362c255431 Mon Sep 17 00:00:00 2001 From: Oleksandr Lynnyk Date: Thu, 4 Jul 2024 13:19:56 +0300 Subject: [PATCH] Update active field options test. --- tests/framework/widgets/ActiveFieldTest.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/framework/widgets/ActiveFieldTest.php b/tests/framework/widgets/ActiveFieldTest.php index 782358a72ec..b38cfa29c8d 100644 --- a/tests/framework/widgets/ActiveFieldTest.php +++ b/tests/framework/widgets/ActiveFieldTest.php @@ -10,7 +10,6 @@ use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; use Yii; use yii\base\DynamicModel; -use yii\base\InvalidConfigException; use yii\web\AssetManager; use yii\web\View; use yii\widgets\ActiveField; @@ -678,6 +677,13 @@ public function testInputOptionsTransferToWidget() ]); $this->assertStringContainsString('placeholder="pholder_direct"', (string) $widget); + // use regex clientOptions instead mask + $widget = $this->activeField->widget(TestMaskedInput::className(), [ + 'options' => ['placeholder' => 'pholder_direct'], + 'clientOptions' => ['regex' => '^.*$'], + ]); + $this->assertStringContainsString('placeholder="pholder_direct"', (string) $widget); + // transfer options from ActiveField to widget $this->activeField->inputOptions = ['placeholder' => 'pholder_input']; $widget = $this->activeField->widget(TestMaskedInput::className(), [ @@ -692,16 +698,6 @@ public function testInputOptionsTransferToWidget() 'options' => ['placeholder' => 'pholder_both_direct'] ]); $this->assertStringContainsString('placeholder="pholder_both_direct"', (string) $widget); - - try { - $widget = $this->activeField->widget(TestMaskedInput::className(), [ - 'clientOptions' => [ - 'regex' => '^.*$', - ], - ]); - } catch (InvalidConfigException $exception) { - $this->fail($exception->getMessage()); - } } /**