|
| 1 | +<?php |
| 2 | + |
| 3 | +use Native\Laravel\Facades\Window; |
| 4 | + |
| 5 | +it('test window', function () { |
| 6 | + $window = Window::open() |
| 7 | + ->id('main') |
| 8 | + ->title('milwad') |
| 9 | + ->titleBarStyle('milwad') |
| 10 | + ->rememberState() |
| 11 | + ->frameless() |
| 12 | + ->focusable() |
| 13 | + ->hasShadow() |
| 14 | + ->alwaysOnTop() |
| 15 | + ->showDevTools() |
| 16 | + ->resizable() |
| 17 | + ->movable() |
| 18 | + ->minimizable() |
| 19 | + ->maximizable() |
| 20 | + ->closable() |
| 21 | + ->fullscreen() |
| 22 | + ->kiosk() |
| 23 | + ->hideMenu(); |
| 24 | + |
| 25 | + $windowArray = $window->toArray(); |
| 26 | + |
| 27 | + expect($windowArray['id'])->toBe('main'); |
| 28 | + expect($windowArray['title'])->toBe('milwad'); |
| 29 | + expect($windowArray['titleBarStyle'])->toBe('milwad'); |
| 30 | + expect($windowArray['rememberState'])->toBeTrue(); |
| 31 | + expect($windowArray['frame'])->toBeFalse(); |
| 32 | + expect($windowArray['focusable'])->toBeTrue(); |
| 33 | + expect($windowArray['hasShadow'])->toBeTrue(); |
| 34 | + expect($windowArray['alwaysOnTop'])->toBeTrue(); |
| 35 | + expect($windowArray['showDevTools'])->toBeTrue(); |
| 36 | + expect($windowArray['resizable'])->toBeTrue(); |
| 37 | + expect($windowArray['movable'])->toBeTrue(); |
| 38 | + expect($windowArray['minimizable'])->toBeTrue(); |
| 39 | + expect($windowArray['maximizable'])->toBeTrue(); |
| 40 | + expect($windowArray['closable'])->toBeTrue(); |
| 41 | + expect($windowArray['fullscreen'])->toBeFalse(); |
| 42 | + expect($windowArray['kiosk'])->toBeFalse(); |
| 43 | + expect($windowArray['autoHideMenuBar'])->toBeTrue(); |
| 44 | +}); |
| 45 | + |
| 46 | +it('test title bar for window', function () { |
| 47 | + $window = Window::open() |
| 48 | + ->titleBarHidden(); |
| 49 | + |
| 50 | + expect($window->toArray()['titleBarStyle'])->toBe('hidden'); |
| 51 | + |
| 52 | + $window->titleBarHiddenInset(); |
| 53 | + |
| 54 | + expect($window->toArray()['titleBarStyle'])->toBe('hiddenInset'); |
| 55 | + |
| 56 | + $window->titleBarButtonsOnHover(); |
| 57 | + |
| 58 | + expect($window->toArray()['titleBarStyle'])->toBe('customButtonsOnHover'); |
| 59 | +}); |
| 60 | + |
| 61 | +it('test for invisibleFrameless in window', function () { |
| 62 | + $window = Window::open()->invisibleFrameless(); |
| 63 | + $windowArray = $window->toArray(); |
| 64 | + |
| 65 | + expect($windowArray['frame'])->toBeTrue(); |
| 66 | + expect($windowArray['transparent'])->toBeTrue(); |
| 67 | + expect($windowArray['focusable'])->toBeFalse(); |
| 68 | + expect($windowArray['hasShadow'])->toBeFalse(); |
| 69 | +}); |
0 commit comments