Skip to content

Commit

Permalink
Update active field options test.
Browse files Browse the repository at this point in the history
  • Loading branch information
alxlnk committed Jul 4, 2024
1 parent c9b425e commit 32688de
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions tests/framework/widgets/ActiveFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(), [
Expand All @@ -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());
}
}

/**
Expand Down

0 comments on commit 32688de

Please sign in to comment.