-
-
Notifications
You must be signed in to change notification settings - Fork 193
/
Copy pathWindowTest.php
101 lines (81 loc) · 3.04 KB
/
WindowTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
use Native\Laravel\Facades\Window;
use Native\Laravel\Windows\Window as WindowClass;
it('test window', function () {
Window::shouldReceive('open')
->andReturn(new WindowClass('main'));
$window = Window::open()
->id('main')
->title('milwad')
->titleBarStyle('milwad')
->rememberState()
->frameless()
->focusable()
->hasShadow()
->alwaysOnTop()
->showDevTools()
->resizable()
->movable()
->minimizable()
->maximizable()
->closable()
->fullscreen()
->kiosk()
->hideMenu();
$windowArray = $window->toArray();
expect($windowArray['id'])->toBe('main');
expect($windowArray['title'])->toBe('milwad');
expect($windowArray['titleBarStyle'])->toBe('milwad');
expect($windowArray['rememberState'])->toBeTrue();
expect($windowArray['frame'])->toBeFalse();
expect($windowArray['focusable'])->toBeTrue();
expect($windowArray['hasShadow'])->toBeTrue();
expect($windowArray['alwaysOnTop'])->toBeTrue();
expect($windowArray['showDevTools'])->toBeTrue();
expect($windowArray['resizable'])->toBeTrue();
expect($windowArray['movable'])->toBeTrue();
expect($windowArray['minimizable'])->toBeTrue();
expect($windowArray['maximizable'])->toBeTrue();
expect($windowArray['closable'])->toBeTrue();
expect($windowArray['fullscreen'])->toBeTrue();
expect($windowArray['kiosk'])->toBeFalse();
expect($windowArray['autoHideMenuBar'])->toBeTrue();
});
it('test title bar for window', function () {
Window::shouldReceive('open')
->andReturn(new WindowClass('main'));
$window = Window::open()
->titleBarHidden();
expect($window->toArray()['titleBarStyle'])->toBe('hidden');
$window->titleBarHiddenInset();
expect($window->toArray()['titleBarStyle'])->toBe('hiddenInset');
$window->titleBarButtonsOnHover();
expect($window->toArray()['titleBarStyle'])->toBe('customButtonsOnHover');
});
it('test for trafficLightPosition in window', function () {
Window::shouldReceive('open')
->andReturn(new WindowClass('main'));
$window = Window::open()
->trafficLightPosition(10, 10);
expect($window->toArray()['trafficLightPosition'])
->toBeArray()
->toHaveKeys(['x', 'y'])
->toHaveLength(2)
->toMatchArray(['x' => 10, 'y' => 10]);
$window->trafficLightPosition(5, 15);
expect($window->toArray()['trafficLightPosition'])
->toBeArray()
->toHaveKeys(['x', 'y'])
->toHaveLength(2)
->toMatchArray(['x' => 5, 'y' => 15]);
});
it('test for invisibleFrameless in window', function () {
Window::shouldReceive('open')
->andReturn(new WindowClass('main'));
$window = Window::open()->invisibleFrameless();
$windowArray = $window->toArray();
expect($windowArray['frame'])->toBeFalse();
expect($windowArray['transparent'])->toBeTrue();
expect($windowArray['focusable'])->toBeFalse();
expect($windowArray['hasShadow'])->toBeFalse();
});