Update ActiveFieldTest.php
This commit is contained in:
parent
1314747ceb
commit
8385853b23
@ -28,7 +28,6 @@ class ActiveFieldTest extends TestCase
|
||||
|
||||
public function testFileInput()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$html = $this->activeField->fileInput()->render();
|
||||
|
||||
$expectedHtml = <<<HTML
|
||||
@ -36,6 +35,38 @@ class ActiveFieldTest extends TestCase
|
||||
<label class="form-label" for="dynamicmodel-attributename">Attribute Name</label>
|
||||
<input type="hidden" name="DynamicModel[attributeName]" value=""><input type="file" id="dynamicmodel-attributename" class="form-control" name="DynamicModel[attributeName]">
|
||||
|
||||
<div class="invalid-feedback"></div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
$this->assertEqualsWithoutLE($expectedHtml, $html);
|
||||
}
|
||||
|
||||
public function testRangeInput()
|
||||
{
|
||||
$html = $this->activeField->rangeInput()->render();
|
||||
|
||||
$expectedHtml = <<<HTML
|
||||
<div class="mb-3 field-dynamicmodel-attributename">
|
||||
<label class="form-label" for="dynamicmodel-attributename">Attribute Name</label>
|
||||
<input type="hidden" name="DynamicModel[attributeName]" value=""><input type="range" id="dynamicmodel-attributename" class="form-range" name="DynamicModel[attributeName]">
|
||||
|
||||
<div class="invalid-feedback"></div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
$this->assertEqualsWithoutLE($expectedHtml, $html);
|
||||
}
|
||||
|
||||
public function testColorInput()
|
||||
{
|
||||
$html = $this->activeField->colorInput()->render();
|
||||
|
||||
$expectedHtml = <<<HTML
|
||||
<div class="mb-3 field-dynamicmodel-attributename">
|
||||
<label class="form-label" for="dynamicmodel-attributename">Attribute Name</label>
|
||||
<input type="hidden" name="DynamicModel[attributeName]" value=""><input type="color" id="dynamicmodel-attributename" class="form-control form-control-color" name="DynamicModel[attributeName]">
|
||||
|
||||
<div class="invalid-feedback"></div>
|
||||
</div>
|
||||
HTML;
|
||||
@ -45,7 +76,6 @@ HTML;
|
||||
|
||||
public function testRadioList()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$html = $this->activeField->radioList([1 => 'name1', 2 => 'name2'])->render();
|
||||
|
||||
$expectedHtml = <<<HTML
|
||||
@ -72,7 +102,6 @@ HTML;
|
||||
|
||||
public function testRadioError()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$this->helperModel->addError($this->attributeName, 'Test print error message');
|
||||
$html = $this->activeField->radio()->render();
|
||||
|
||||
@ -91,7 +120,6 @@ HTML;
|
||||
|
||||
public function testRadioListError()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$this->helperModel->addError($this->attributeName, 'Test print error message');
|
||||
$html = $this->activeField->radioList([1 => 'name1', 2 => 'name2'])->render();
|
||||
|
||||
@ -117,7 +145,6 @@ HTML;
|
||||
|
||||
public function testCheckboxList()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$html = $this->activeField->checkboxList([1 => 'name1', 2 => 'name2'])->render();
|
||||
|
||||
$expectedHtml = <<<HTML
|
||||
@ -142,7 +169,6 @@ HTML;
|
||||
|
||||
public function testCheckboxError()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$this->helperModel->addError($this->attributeName, 'Test print error message');
|
||||
$html = $this->activeField->checkbox()->render();
|
||||
|
||||
@ -161,7 +187,6 @@ HTML;
|
||||
|
||||
public function testCheckboxListError()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$this->helperModel->addError($this->attributeName, 'Test print error message');
|
||||
$html = $this->activeField->checkboxList([1 => 'name1', 2 => 'name2'])->render();
|
||||
|
||||
@ -187,7 +212,6 @@ HTML;
|
||||
|
||||
public function testRadioListInline()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$this->activeField->inline = true;
|
||||
$html = $this->activeField->radioList([1 => 'name1', 2 => 'name2'])->render();
|
||||
|
||||
@ -213,7 +237,6 @@ HTML;
|
||||
|
||||
public function testCheckboxListInline()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$this->activeField->inline = true;
|
||||
$html = $this->activeField->checkboxList([1 => 'name1', 2 => 'name2'])->render();
|
||||
|
||||
@ -238,12 +261,10 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see https://github.com/yiisoft/yii2-bootstrap/issues/81
|
||||
*/
|
||||
public function testRadioListItemOptions()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$content = $this->activeField->radioList([1 => 'name1', 2 => 'name2'], [
|
||||
'itemOptions' => [
|
||||
'data-attribute' => 'test'
|
||||
@ -259,7 +280,6 @@ HTML;
|
||||
*/
|
||||
public function testCheckboxListItemOptions()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$content = $this->activeField->checkboxList([1 => 'name1', 2 => 'name2'], [
|
||||
'itemOptions' => [
|
||||
'data-attribute' => 'test'
|
||||
@ -274,9 +294,10 @@ HTML;
|
||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||
$_SERVER['SCRIPT_FILENAME'] = "index.php";
|
||||
$_SERVER['SCRIPT_NAME'] = "index.php";
|
||||
|
||||
parent::setUp();
|
||||
|
||||
Html::$counter = 0;
|
||||
|
||||
$this->helperModel = new DynamicModel(['attributeName']);
|
||||
ob_start();
|
||||
$this->helperForm = ActiveForm::begin(['action' => '/something']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user