0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Verify you can use server:defer on self-imported module (#11577)

This commit is contained in:
Matthew Phillips 2024-07-30 15:48:30 -04:00 committed by GitHub
parent 49db00444e
commit 60b2766edb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,8 @@
---
import Self from './Self.astro';
const now = Date();
---
<p class="now">{now}</p>
{!Astro.props.stop && <Self stop server:defer />}

View file

@ -1,5 +1,6 @@
---
import Island from '../components/Island.astro';
import Self from '../components/Self.astro';
---
<html>
@ -10,5 +11,6 @@ import Island from '../components/Island.astro';
<Island server:defer>
<h3 id="children">children</h3>
</Island>
<Self server:defer />
</body>
</html>

View file

@ -37,6 +37,13 @@ test.describe('Server islands', () => {
await expect(el, 'element rendered').toBeVisible();
});
test('Self imported module can server defer', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/base/'));
let el = page.locator('.now');
await expect(el).toHaveCount(2);
});
});
test.describe('Production', () => {