Skip to content

Commit

Permalink
test: since we check the media-type, data-astro-reload has fewer use …
Browse files Browse the repository at this point in the history
…cases (#8605)
  • Loading branch information
martrapp authored Sep 20, 2023
1 parent 70f2a80 commit 2d7f542
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ import Layout from '../components/Layout.astro';
</a>
<a id="click-two" href="/two" data-astro-reload>load page / no navigation</a>
<a id="click-logo" href="/logo.svg" download>load page / no navigation</a>
<a id="click-svg" href="/logo.svg">load page / no navigation</a>
</Layout>
16 changes: 16 additions & 0 deletions packages/astro/e2e/view-transitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,22 @@ test.describe('View Transitions', () => {
await downloadPromise;
});

test('data-astro-reload not required for non-html content', async ({ page, astro }) => {
const loads = [];
page.addListener('load', (p) => {
loads.push(p.title());
});
// Go to page 4
await page.goto(astro.resolveUrl('/four'));
let p = page.locator('#four');
await expect(p, 'should have content').toHaveText('Page 4');

await page.click('#click-svg');
p = page.locator('svg');
await expect(p).toBeVisible();
expect(loads.length, 'There should be 2 page load').toEqual(2);
});

test('Scroll position is restored on back navigation from page w/o ViewTransitions', async ({
page,
astro,
Expand Down

0 comments on commit 2d7f542

Please sign in to comment.