Keep the good unit test from #3195

This commit is contained in:
Samuel Georges 2018-04-06 11:05:31 +10:00
parent 2164c07616
commit ba4eba183d
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<?php
use Backend\Widgets\Form;
use Illuminate\Database\Eloquent\Model;
class FormTestModel extends Model
{
}
class FormTest extends TestCase
{
public function testCheckboxlistTrigger()
{
$form = new Form(null, [
'model' => new FormTestModel,
'arrayName' => 'array',
'fields' => [
'trigger' => [
'type' => 'checkboxlist',
'options' => [
'1' => 'Value One'
]
],
'triggered' => [
'type' => 'text',
'trigger' => [
'field' => 'trigger[]',
'action' => 'show',
'condition' => 'value[1]'
]
]
]
]);
$form->render();
$attributes = $form->getField('triggered')->getAttributes('container', false);
$this->assertEquals('[name="array[trigger][]"]', array_get($attributes, 'data-trigger'));
}
}