Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions packages/plugin-rsc/e2e/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,40 @@ function defineTest(f: Fixture) {
await expectNoDuplicateServerCss(page)
})

// TODO: need a way to add/remove links on server hmr. for now, it requires a manually reload.
test.skip('adding/removing css server @js', async ({ page }) => {
// TODO: need a way to remove css links on server hmr. for now, it requires a manually reload.
test('adding/removing css server @js', async ({ page }) => {
await page.goto(f.url())
await waitForHydration(page)
await expect(page.locator('.test-style-server')).toHaveCSS(
'color',
'rgb(255, 165, 0)',
)

// remove css import
const editor = f.createEditor('src/routes/style-server/server.tsx')
editor.edit((s) =>
s.replaceAll(`import './server.css'`, `/* import './server.css' */`),
)
await page.waitForTimeout(100)
await expect(async () => {
// TODO: shouldn't require reload
await page.reload()
await expect(page.locator('.test-style-server')).toHaveCSS(
'color',
'rgb(0, 0, 0)',
{ timeout: 10 },
)
}).toPass()

// adding css works without reload
await waitForHydration(page)
await using _ = await expectNoReload(page)
await testAddRemoveCssServer(page, { js: true })

editor.reset()
await expect(page.locator('.test-style-server')).toHaveCSS(
'color',
'rgb(255, 165, 0)',
)
})

testNoJs('adding/removing css server @nojs', async ({ page }) => {
Expand Down
Loading