Skip to content

Commit

Permalink
Merge branch 'main' into feat-osx-rsc-transform
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jun 24, 2024
2 parents b73e45e + b5937b4 commit 4de4a50
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
14 changes: 14 additions & 0 deletions vue-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

https://vue-server-demo.hiro18181.workers.dev/

```sh
# local dev
pnpm i
pnpm dev

# local preview
pnpm build
pnpm preview

# deploy cloudflare
pnpm cf-build
pnpm cf-release
```

## references

- https://github.com/hi-ogawa/js-utils/pull/227
Expand Down
10 changes: 8 additions & 2 deletions vue-server/e2e/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ testNoJs("basic @nojs", async ({ page }) => {
await page.getByText("Count: 0").click();
});

test("ssr", async ({ request }) => {
const res = await request.get("/");
const resText = await res.text();
expect(resText).toMatch(
/^<!DOCTYPE html>\s*<html>\s*<head>.*<\/head>\s*<body>.*<\/body>\s*<\/html>\s*$/s,
);
});

test("navigation @js", async ({ page }) => {
await page.goto("/");
await waitForHydration(page);
Expand Down Expand Up @@ -84,7 +92,6 @@ async function testFormNavigation(page: Page, options: { js: boolean }) {
test("hmr server @dev", async ({ page }) => {
await page.goto("/");
await waitForHydration(page);
await page.pause();

// check client state is preserved
await page.getByRole("button", { name: "client sfc: 0" }).click();
Expand All @@ -111,7 +118,6 @@ test("hmr server @dev", async ({ page }) => {
test("hmr sfc @dev", async ({ page }) => {
await page.goto("/sfc");
await waitForHydration(page);
await page.pause();

await page.getByRole("button", { name: "client counter 0" }).first().click();
await page.getByRole("button", { name: "client counter 1" }).click();
Expand Down
2 changes: 1 addition & 1 deletion vue-server/src/demo/entry-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function handler(request: Request) {
const app = createSSRApp(Root);
const ssrHtml = await renderToString(app);
let html = (await import("virtual:index-html" as string)).default as string;
html = html.replace("<body>", () => `<div id="root">${ssrHtml}</div>`);
html = html.replace("<body>", () => `<body><div id="root">${ssrHtml}</div>`);
html = html.replace(
"<head>",
() =>
Expand Down

0 comments on commit 4de4a50

Please sign in to comment.