Skip to content

Commit ffe2784

Browse files
committed
test: hiddenOn event tests
1 parent 5325c79 commit ffe2784

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/EditorTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,25 @@ public function it_can_have_events()
5959
$this->assertEquals($event, $editor->events[0]);
6060
}
6161

62+
/** @test */
63+
public function it_can_show_hide_fields()
64+
{
65+
$editor = $this->getEditor();
66+
67+
$editor->hiddenOnCreate(['name']);
68+
$editor->hiddenOnEdit(['email']);
69+
70+
$this->assertCount(2, $editor->events);
71+
72+
$this->assertEquals('preOpen', $editor->events[0]['event']);
73+
$this->assertStringContainsString("action === 'create'", $editor->events[0]['script']);
74+
$this->assertStringContainsString("this.hide('name')", $editor->events[0]['script']);
75+
76+
$this->assertEquals('preOpen', $editor->events[1]['event']);
77+
$this->assertStringContainsString("action === 'edit'", $editor->events[1]['script']);
78+
$this->assertStringContainsString("this.hide('email')", $editor->events[1]['script']);
79+
}
80+
6281
/** @test */
6382
public function it_has_authorizations()
6483
{

0 commit comments

Comments
 (0)