Skip to content

Commit 1ef0a15

Browse files
committed
test: add e2e
1 parent a8e3a08 commit 1ef0a15

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,21 @@ function defineTest(f: Fixture) {
473473
'color',
474474
'rgb(255, 165, 0)',
475475
)
476+
await expectNoServerLinkStylesheet(page)
477+
})
478+
479+
function expectNoServerLinkStylesheet(page: Page) {
480+
// check only manually inserted stylesheet link exists
481+
return expect(page.locator('link[rel="stylesheet"]')).toHaveAttribute(
482+
'href',
483+
'/test-style-server-manual.css',
484+
)
485+
}
486+
487+
test('no duplicate css', async ({ page }) => {
488+
await page.goto(f.url())
489+
await waitForHydration(page)
490+
await expectNoServerLinkStylesheet(page)
476491
})
477492

478493
test('adding/removing css client @js', async ({ page }) => {
@@ -557,6 +572,7 @@ function defineTest(f: Fixture) {
557572
'color',
558573
'rgb(255, 165, 0)',
559574
)
575+
await expectNoServerLinkStylesheet(page)
560576
})
561577

562578
// TODO: need a way to add/remove links on server hmr. for now, it requires a manually reload.

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import { waitForHydration } from './helper'
66
test.describe('dev-default', () => {
77
const f = useFixture({ root: 'examples/starter', mode: 'dev' })
88
defineStarterTest(f)
9-
10-
test('no duplicate css', async ({ page }) => {
11-
await page.goto(f.url())
12-
await waitForHydration(page)
13-
// TODO
14-
})
159
})
1610

1711
test.describe('build-default', () => {

packages/plugin-rsc/examples/basic/src/routes/style-server/server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function TestStyleServer() {
1010
</div>
1111
<link
1212
rel="stylesheet"
13-
href="/test.css"
13+
href="/test-style-server-manual.css"
1414
precedence="test-style-server-manual"
1515
/>
1616
<div className="test-style-server-manual">test-style-server-manual</div>

0 commit comments

Comments
 (0)