Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
React + Svelte
  • Loading branch information
pascalbaljet committed Sep 23, 2025
commit e48cb9c4828aefd9a74b2f8c03c5fb89f447de91
109 changes: 109 additions & 0 deletions packages/react/test-app/Pages/ProgressComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { progress } from '@inertiajs/react'
import { useState } from 'react'

declare global {
interface Window {
progressTests: any[]
}
}

window.progressTests = []

export default () => {
const [logs, setLogs] = useState<string[]>([])

const log = (...args: any[]) => {
const message = args.join(' ')
window.progressTests.push(...args)
setLogs((prevLogs) => [...prevLogs, message])
}

const testStart = () => {
progress.start()
log('started')
}

const testSet25 = () => {
progress.set(0.25)
log('set 25%')
}

const testSet50 = () => {
progress.set(0.5)
log('set 50%')
}

const testSet75 = () => {
progress.set(0.75)
log('set 75%')
}

const testFinish = () => {
progress.finish()
log('finished')
}

const testReset = () => {
progress.reset()
log('reset')
}

const testRemove = () => {
progress.remove()
log('removed')
}

const testHide = () => {
progress.hide()
log('hidden')
}

const testReveal = () => {
progress.reveal()
log('revealed')
}

const testIsStarted = () => {
log('isStarted:', progress.isStarted())
}

const testGetStatus = () => {
log('getStatus:', progress.getStatus())
}

const clearLogs = () => {
window.progressTests = []
setLogs([])
}

return (
<div>
<h1>Progress API Test</h1>

<div>
<button onClick={testStart}>Start</button>
<button onClick={testSet25}>Set 25%</button>
<button onClick={testSet50}>Set 50%</button>
<button onClick={testSet75}>Set 75%</button>
<button onClick={testFinish}>Finish</button>
</div>

<div>
<button onClick={testReset}>Reset</button>
<button onClick={testRemove}>Remove</button>
<button onClick={testHide}>Hide</button>
<button onClick={testReveal}>Reveal</button>
</div>

<div>
<button onClick={testIsStarted}>Is Started</button>
<button onClick={testGetStatus}>Get Status</button>
<button onClick={clearLogs}>Clear</button>
</div>

<div>
Logs: <span id="logs">{logs.join(', ')}</span>
</div>
</div>
)
}
108 changes: 108 additions & 0 deletions packages/svelte/test-app/Pages/ProgressComponent.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<script context="module" lang="ts">
declare global {
interface Window {
progressTests: any[]
}
}
</script>

<script lang="ts">
import { progress } from '@inertiajs/svelte'

window.progressTests = []

let logs: string[] = []

const log = (...args: any[]) => {
const message = args.join(' ')
window.progressTests.push(...args)
logs = [...logs, message]
}

const testStart = () => {
progress.start()
log('started')
}

const testSet25 = () => {
progress.set(0.25)
log('set 25%')
}

const testSet50 = () => {
progress.set(0.5)
log('set 50%')
}

const testSet75 = () => {
progress.set(0.75)
log('set 75%')
}

const testFinish = () => {
progress.finish()
log('finished')
}

const testReset = () => {
progress.reset()
log('reset')
}

const testRemove = () => {
progress.remove()
log('removed')
}

const testHide = () => {
progress.hide()
log('hidden')
}

const testReveal = () => {
progress.reveal()
log('revealed')
}

const testIsStarted = () => {
log('isStarted:', progress.isStarted())
}

const testGetStatus = () => {
log('getStatus:', progress.getStatus())
}

const clearLogs = () => {
window.progressTests = []
logs = []
}
</script>

<div>
<h1>Progress API Test</h1>

<div>
<button on:click={testStart}>Start</button>
<button on:click={testSet25}>Set 25%</button>
<button on:click={testSet50}>Set 50%</button>
<button on:click={testSet75}>Set 75%</button>
<button on:click={testFinish}>Finish</button>
</div>

<div>
<button on:click={testReset}>Reset</button>
<button on:click={testRemove}>Remove</button>
<button on:click={testHide}>Hide</button>
<button on:click={testReveal}>Reveal</button>
</div>

<div>
<button on:click={testIsStarted}>Is Started</button>
<button on:click={testGetStatus}>Get Status</button>
<button on:click={clearLogs}>Clear</button>
</div>

<div>
Logs: <span id="logs">{logs.join(', ')}</span>
</div>
</div>
Loading