Skip to content

Commit

Permalink
Fixed Tests (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertWesner authored Sep 8, 2024
1 parent 949a06e commit cc11ceb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Windows/Window.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public function toArray()
'fullscreenable' => $this->fullscreenable,
'kiosk' => $this->kiosk,
'autoHideMenuBar' => $this->autoHideMenuBar,
'transparent' => $this->transparent,
];
}

Expand Down
7 changes: 4 additions & 3 deletions tests/Http/Controller/DispatchEventFromAppControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ public function __construct(public string $test = '') {}
Event::assertDispatched(TestEvent::class);
});

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

$this->withoutMiddleware()
->post('_native/api/events', [
'event' => InvalidEvent::class,
'event' => 'some-event-that-is-no-class',
]);

Event::assertNotDispatched(InvalidEvent::class);
Event::assertDispatched('some-event-that-is-no-class');
});

it('passes the payload to the event', function () {
Expand Down
17 changes: 15 additions & 2 deletions tests/Windows/WindowTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?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')
Expand Down Expand Up @@ -38,12 +42,15 @@
expect($windowArray['minimizable'])->toBeTrue();
expect($windowArray['maximizable'])->toBeTrue();
expect($windowArray['closable'])->toBeTrue();
expect($windowArray['fullscreen'])->toBeFalse();
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();

Expand All @@ -59,6 +66,9 @@
});

it('test for trafficLightPosition in window', function () {
Window::shouldReceive('open')
->andReturn(new WindowClass('main'));

$window = Window::open()
->trafficLightPosition(10, 10);

Expand All @@ -78,10 +88,13 @@
});

it('test for invisibleFrameless in window', function () {
Window::shouldReceive('open')
->andReturn(new WindowClass('main'));

$window = Window::open()->invisibleFrameless();
$windowArray = $window->toArray();

expect($windowArray['frame'])->toBeTrue();
expect($windowArray['frame'])->toBeFalse();
expect($windowArray['transparent'])->toBeTrue();
expect($windowArray['focusable'])->toBeFalse();
expect($windowArray['hasShadow'])->toBeFalse();
Expand Down

0 comments on commit cc11ceb

Please sign in to comment.