Skip to content

Commit 21d86a5

Browse files
committed
test: update
1 parent 5f9aec4 commit 21d86a5

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

packages/plugin-rsc/e2e/basic.test.ts

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -855,31 +855,42 @@ function defineTest(f: Fixture) {
855855
'rgb(255, 165, 0)',
856856
)
857857

858-
// remove css import
859858
const editor = f.createEditor('src/routes/style-server/server.tsx')
860-
editor.edit((s) =>
861-
s.replaceAll(`import './server.css'`, `/* import './server.css' */`),
862-
)
859+
860+
// removing and adding new css works via hmr
861+
{
862+
await using _ = await expectNoReload(page)
863+
864+
// remove css import
865+
editor.edit((s) =>
866+
s.replaceAll(`import './server.css'`, `/* import './server.css' */`),
867+
)
868+
await expect(page.locator('.test-style-server')).toHaveCSS(
869+
'color',
870+
'rgb(0, 0, 0)',
871+
)
872+
873+
// add new css
874+
editor.edit((s) =>
875+
s.replaceAll(`/* import './server.css' */`, `import './server2.css'`),
876+
)
877+
await expect(page.locator('.test-style-server')).toHaveCSS(
878+
'color',
879+
'rgb(0, 255, 165)',
880+
)
881+
}
882+
883+
// TODO: React doesn't re-inert same css link. so manual reload is required.
884+
editor.reset()
863885
await page.waitForTimeout(100)
864886
await expect(async () => {
865-
// TODO: shouldn't require reload
866887
await page.reload()
867888
await expect(page.locator('.test-style-server')).toHaveCSS(
868889
'color',
869-
'rgb(0, 0, 0)',
890+
'rgb(255, 165, 0)',
870891
{ timeout: 10 },
871892
)
872893
}).toPass()
873-
874-
// adding css works without reload
875-
await waitForHydration(page)
876-
await using _ = await expectNoReload(page)
877-
878-
editor.reset()
879-
await expect(page.locator('.test-style-server')).toHaveCSS(
880-
'color',
881-
'rgb(255, 165, 0)',
882-
)
883894
})
884895

885896
testNoJs('adding/removing css server @nojs', async ({ page }) => {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.test-style-server {
2+
color: rgb(0, 255, 165);
3+
}

0 commit comments

Comments
 (0)