Skip to content

Fixed Tests #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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