Skip to content

Commit

Permalink
chore: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed Dec 13, 2024
1 parent 7aef173 commit c443341
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions e2e/tests/content-hooks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)
Expand All @@ -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 }) => {
Expand Down

0 comments on commit c443341

Please sign in to comment.