Conditions | 1 |
Paths | 1 |
Total Lines | 24 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function testKnockoutCompositeButtonField() |
||
15 | { |
||
16 | $field = KnockoutToggleCompositeButtonField::create( |
||
17 | "MyField", |
||
18 | "This is a knockout composite button field", |
||
19 | [ |
||
20 | KnockoutTextField::create('Test1', 'Test1')->setObservable('test1'), |
||
21 | KnockoutTextField::create('Test2', 'Test2')->setObservable('test2') |
||
22 | ] |
||
23 | )->setObservable('compositeButtonField'); |
||
24 | |||
25 | $this->assertContains( |
||
26 | '<button data-bind="click: function(){ compositeButtonField(!compositeButtonField()); |
||
27 | }" class="btn btn-primary btn-sm mb-2 ml-2 mr-2" type="button" aria-expanded="false" aria-controls="toggle"> |
||
28 | Yes/No |
||
29 | </button>', |
||
30 | $field->Field()->getValue(), |
||
31 | 'Contains a button to show/hide based upon the observable' |
||
32 | ); |
||
33 | |||
34 | $this->assertContains( |
||
35 | '<div data-bind="visible: compositeButtonField"', |
||
36 | $field->Field()->getValue(), |
||
37 | 'Contains the visible data-bind' |
||
38 | ); |
||
41 |