From 751e5f8194f3177d83f8df8f17221d36066265f5 Mon Sep 17 00:00:00 2001 From: Michael Brevard Date: Sun, 16 Jun 2024 10:02:27 +0300 Subject: [PATCH] tests: add tests for delayed hydration triggers --- test/basic.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/basic.test.ts b/test/basic.test.ts index a82afca16c..234c1a51e7 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -2689,6 +2689,16 @@ describe('lazy import components', () => { ) expect(await page.locator('body').getByText('This shouldn\'t be visible at first with viewport!').all()).toHaveLength(1) }) + + it('respects custom delayed hydration triggers', async () => { + const { page } = await renderPage('/lazy-import-components') + await page.waitForLoadState('networkidle') + await page.locator('#lazyevent').click() + await page.waitForResponse(response => + response.status() === 200 && response.text().then(text => text.includes('This shouldn\'t be visible at first with events!')), + ) + expect(await page.locator('body').getByText('This should be visible at first with events!').all()).toHaveLength(1) + expect(await page.locator('body').getByText('This shouldn\'t be visible at first with events!').all()).toHaveLength(1) }) describe('defineNuxtComponent watch duplicate', () => {