diff options
author | 2024-07-30 15:48:30 -0400 | |
---|---|---|
committer | 2024-07-30 15:48:30 -0400 | |
commit | 60b2766edb37b8da3c94c17da0790132e09f44b2 (patch) | |
tree | ca906dd4a8900aca85cf51e8ba01a70a43d23ac7 | |
parent | 49db00444e357361203f5e72816a2091efea50e7 (diff) | |
download | astro-60b2766edb37b8da3c94c17da0790132e09f44b2.tar.gz astro-60b2766edb37b8da3c94c17da0790132e09f44b2.tar.zst astro-60b2766edb37b8da3c94c17da0790132e09f44b2.zip |
Verify you can use server:defer on self-imported module (#11577)
3 files changed, 17 insertions, 0 deletions
diff --git a/packages/astro/e2e/fixtures/server-islands/src/components/Self.astro b/packages/astro/e2e/fixtures/server-islands/src/components/Self.astro new file mode 100644 index 000000000..0b60a3aee --- /dev/null +++ b/packages/astro/e2e/fixtures/server-islands/src/components/Self.astro @@ -0,0 +1,8 @@ +--- +import Self from './Self.astro'; + +const now = Date(); +--- + +<p class="now">{now}</p> +{!Astro.props.stop && <Self stop server:defer />} diff --git a/packages/astro/e2e/fixtures/server-islands/src/pages/index.astro b/packages/astro/e2e/fixtures/server-islands/src/pages/index.astro index 71b7d0e26..998d6c074 100644 --- a/packages/astro/e2e/fixtures/server-islands/src/pages/index.astro +++ b/packages/astro/e2e/fixtures/server-islands/src/pages/index.astro @@ -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> diff --git a/packages/astro/e2e/server-islands.test.js b/packages/astro/e2e/server-islands.test.js index 5f29acf60..b036eaafa 100644 --- a/packages/astro/e2e/server-islands.test.js +++ b/packages/astro/e2e/server-islands.test.js @@ -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', () => { |