Skip to content

Commit cc11ceb

Browse files
authored
Fixed Tests (#362)
1 parent 949a06e commit cc11ceb

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/Windows/Window.php

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ public function toArray()
272272
'fullscreenable' => $this->fullscreenable,
273273
'kiosk' => $this->kiosk,
274274
'autoHideMenuBar' => $this->autoHideMenuBar,
275+
'transparent' => $this->transparent,
275276
];
276277
}
277278

tests/Http/Controller/DispatchEventFromAppControllerTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ public function __construct(public string $test = '') {}
1919
Event::assertDispatched(TestEvent::class);
2020
});
2121

22-
it('dispatches no event in case it does not exist', function () {
22+
// Since 45b7ccfcb86ebf35be35c1eb7fbb9f05a224448f nonexistent classes are handled as string events
23+
it('dispatches a string event', function () {
2324
Event::fake();
2425

2526
$this->withoutMiddleware()
2627
->post('_native/api/events', [
27-
'event' => InvalidEvent::class,
28+
'event' => 'some-event-that-is-no-class',
2829
]);
2930

30-
Event::assertNotDispatched(InvalidEvent::class);
31+
Event::assertDispatched('some-event-that-is-no-class');
3132
});
3233

3334
it('passes the payload to the event', function () {

tests/Windows/WindowTest.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<?php
22

33
use Native\Laravel\Facades\Window;
4+
use Native\Laravel\Windows\Window as WindowClass;
45

56
it('test window', function () {
7+
Window::shouldReceive('open')
8+
->andReturn(new WindowClass('main'));
9+
610
$window = Window::open()
711
->id('main')
812
->title('milwad')
@@ -38,12 +42,15 @@
3842
expect($windowArray['minimizable'])->toBeTrue();
3943
expect($windowArray['maximizable'])->toBeTrue();
4044
expect($windowArray['closable'])->toBeTrue();
41-
expect($windowArray['fullscreen'])->toBeFalse();
45+
expect($windowArray['fullscreen'])->toBeTrue();
4246
expect($windowArray['kiosk'])->toBeFalse();
4347
expect($windowArray['autoHideMenuBar'])->toBeTrue();
4448
});
4549

4650
it('test title bar for window', function () {
51+
Window::shouldReceive('open')
52+
->andReturn(new WindowClass('main'));
53+
4754
$window = Window::open()
4855
->titleBarHidden();
4956

@@ -59,6 +66,9 @@
5966
});
6067

6168
it('test for trafficLightPosition in window', function () {
69+
Window::shouldReceive('open')
70+
->andReturn(new WindowClass('main'));
71+
6272
$window = Window::open()
6373
->trafficLightPosition(10, 10);
6474

@@ -78,10 +88,13 @@
7888
});
7989

8090
it('test for invisibleFrameless in window', function () {
91+
Window::shouldReceive('open')
92+
->andReturn(new WindowClass('main'));
93+
8194
$window = Window::open()->invisibleFrameless();
8295
$windowArray = $window->toArray();
8396

84-
expect($windowArray['frame'])->toBeTrue();
97+
expect($windowArray['frame'])->toBeFalse();
8598
expect($windowArray['transparent'])->toBeTrue();
8699
expect($windowArray['focusable'])->toBeFalse();
87100
expect($windowArray['hasShadow'])->toBeFalse();

0 commit comments

Comments
 (0)