Skip to content

Commit

Permalink
Resolve promoted Turbo Frame caching timing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpdoyle committed Sep 28, 2022
1 parent 732db00 commit 3b03864
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tests/functional/frame_navigation_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,27 @@ test("test promoted frame navigations are cached", async ({ page }) => {
await nextEventNamed(page, "turbo:frame-render")

assert.equal(await page.textContent("#tab-content"), "Two")
assert.equal(pathname((await page.getAttribute("#tab-frame", "src")) || ""), "/src/tests/fixtures/tabs/two.html")
assert.equal(await page.getAttribute("#tab-frame", "complete"), "", "sets [complete]")

await page.click("#tab-3")
await nextEventNamed(page, "turbo:frame-render")

assert.equal(await page.textContent("#tab-content"), "Three")
assert.equal(pathname((await page.getAttribute("#tab-frame", "src")) || ""), "/src/tests/fixtures/tabs/three.html")
assert.equal(await page.getAttribute("#tab-frame", "complete"), "", "sets [complete]")

await page.goBack()
await nextBeat()

assert.equal(await page.textContent("#tab-content"), "Two")
assert.equal(pathname((await page.getAttribute("#tab-frame", "src")) || ""), "/src/tests/fixtures/tabs/two.html")
assert.equal(await page.getAttribute("#tab-frame", "complete"), "", "caches two.html with [complete]")

await page.goBack()
await nextBeat()

assert.equal(await page.textContent("#tab-content"), "One")
assert.equal(await page.getAttribute("#tab-frame", "src"), null, "caches one.html without #tab-frame[src]")
assert.equal(await page.getAttribute("#tab-frame", "complete"), null, "caches one.html without [complete]")
})

0 comments on commit 3b03864

Please sign in to comment.