test: since we check the media-type, data-astro-reload has fewer use cases (#8605)

This commit is contained in:
Martin Trapp 2023-09-20 11:50:56 +02:00 committed by GitHub
parent 70f2a80039
commit 2d7f5429a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -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>

View file

@ -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,