From c443341aa2c9b008b4cfe9213ec152a88f3470a1 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 11:21:21 +0800 Subject: [PATCH] chore: tweak --- e2e/tests/content-hooks.spec.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index 3227d051e7..fdecd3928c 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -27,15 +27,18 @@ test('should call content mounted hook', async ({ page }) => { await expect(mountedLocator).toHaveText( 'mounted: /content-hooks/content.html 1', ) + + // update content but mounted hook should not be called twice + await updateMarkdownContent() + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) }) /** * onContentChange hook should only called in development */ test('should call content change hook', async ({ page }) => { - const mountedLocator = page.locator( - '.markdown-content-hooks .markdown-content-mounted', - ) const changeLocator = page.locator( '.markdown-content-hooks .markdown-content-change', ) @@ -46,11 +49,6 @@ test('should call content change hook', async ({ page }) => { await updateMarkdownContent() await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 2 : 0}`) // 2 - - // update content but mounted hook should not be called twice - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) }) test('should call content before unmount hook', async ({ page }) => {