Skip to content
Open
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
12 changes: 10 additions & 2 deletions demo-app/resources/js/Pages/LoadingProp.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { ModalLink } from '@inertiaui/modal-react';
import { ModalLink, putConfig } from '@inertiaui/modal-react';
import Container from './Container';

export default function LoadingProp() {
const params = new URLSearchParams(window.location.search);

putConfig({
progress: params.get('progress') === 'false'
? false
: { delay: parseInt(params.get('delay') ?? 0) }
})

return (
<Container>
<div className="flex justify-between">
Expand All @@ -18,4 +26,4 @@ export default function LoadingProp() {
</ModalLink>
</Container>
);
}
}
10 changes: 9 additions & 1 deletion demo-app/resources/js/Pages/LoadingProp.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<script setup>
import Container from './Container.vue'
import { ModalLink } from '@inertiaui/modal-vue'
import { ModalLink, putConfig } from '@inertiaui/modal-vue'

const params = new URLSearchParams(window.location.search);

putConfig({
progress: params.get('progress') === 'false'
? false
: { delay: parseInt(params.get('delay') ?? 0) }
})
</script>

<template>
Expand Down
27 changes: 25 additions & 2 deletions demo-app/tests/Browser/ProgressBarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,42 @@
class ProgressBarTest extends DuskTestCase
{
#[Test]
public function it_shows_the_inertia_progress_bar()
public function it_shows_the_inertia_progress_bar_after_delay()
{
if (Support::isInertiaV1()) {
return $this->markTestSkipped('Proress Bar API not supported in Inertia v1');
}

$this->browse(function (Browser $browser) {
$browser->visit('/loading-prop')
$browser->visit('/loading-prop?delay=250')
->waitForText('Loading Prop')
->clickLink('Open Slideover')
->assertNotPresent('#nprogress')
->waitForModal();

$browser->visit('/loading-prop?delay=250')
->waitForText('Loading Prop')
->clickLink('Open Slideover')
->pause(250)
->assertPresent('#nprogress')
->waitForModal()
->waitUntilMissing('#nprogress');
});
}

#[Test]
public function it_does_not_show_the_inertia_progress_bar_if_disabled()
{
if (Support::isInertiaV1()) {
return $this->markTestSkipped('Proress Bar API not supported in Inertia v1');
}

$this->browse(function (Browser $browser) {
$browser->visit('/loading-prop?progress=false')
->waitForText('Loading Prop')
->clickLink('Open Slideover')
->assertNotPresent('#nprogress')
->waitForModal();
});
}
}
Loading