Skip to content

Commit

Permalink
Dispatch turbo:load after loading 404 response (#960)
Browse files Browse the repository at this point in the history
* Dispatch turbo:load after loading 404 response

* Test turbo:load dispatched on error pages
  • Loading branch information
domchristie authored Aug 25, 2023
1 parent 43cf629 commit 0826b81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/drive/visit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class Visit implements FetchRequestDelegate {
if (this.state == VisitState.started) {
this.state = VisitState.failed
this.adapter.visitFailed(this)
this.delegate.visitCompleted(this)
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/tests/functional/rendering_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ test("test includes isPreview in render event details", async ({ page }) => {
assert.equal(await isPreview, false)
})

test("test triggers before-render and render events for error pages", async ({ page }) => {
test("test triggers before-render, render, and load events for error pages", async ({ page }) => {
await page.click("#nonexistent-link")
const { newBody } = await nextEventNamed(page, "turbo:before-render")

assert.equal(await textContent(page, newBody), "\nCannot GET /nonexistent\n\n\n")

await nextEventNamed(page, "turbo:render")
assert.equal(await newBody, await page.evaluate(() => document.body.outerHTML))

await nextEventNamed(page, "turbo:load")
})

test("test reloads when tracked elements change", async ({ page }) => {
Expand Down

0 comments on commit 0826b81

Please sign in to comment.