Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed May 5, 2023
1 parent 728bf14 commit 6c10b4b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/e2e/app-dir/app-css/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,35 @@ createNextDescribe(
await next.patchFile(filePath, origContent)
}
})

it('should not create duplicate link tags during HMR', async () => {
const filePath = 'app/hmr/global.css'
const origContent = await next.readFile(filePath)

const browser = await next.browser('/hmr')
try {
await next.patchFile(
filePath,
origContent.replace('background: gray;', 'background: red;')
)
await check(
() =>
browser.eval(
`window.getComputedStyle(document.querySelector('body')).backgroundColor`
),
'rgb(255, 0, 0)'
)
await check(
() =>
browser.eval(
`document.querySelectorAll('link[rel="stylesheet"][href*="/page.css"]').length`
),
'1'
)
} finally {
await next.patchFile(filePath, origContent)
}
})
}
})

Expand Down

0 comments on commit 6c10b4b

Please sign in to comment.