From 60a031aa2b847a61412014a73f4b09341d36db7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20Hevery?= Date: Sun, 12 Nov 2023 17:07:27 -0800 Subject: [PATCH] WIP --- .vscode/launch.json | 6 +- .../qwik/src/core/container/render.unit.tsx | 73 ++++++++++ .../qwik/src/core/render/dom/notify-render.ts | 2 +- .../qwik/src/core/render/dom/operations.ts | 1 + .../qwik/src/core/render/dom/render-dom.ts | 3 +- packages/qwik/src/core/render/dom/signals.ts | 53 +++++-- packages/qwik/src/core/render/dom/visitor.ts | 130 +++++++++++------- .../qwik/src/core/render/ssr/render-ssr.ts | 10 +- packages/qwik/src/core/state/common.ts | 2 +- packages/qwik/src/core/util/element.ts | 2 +- 10 files changed, 209 insertions(+), 73 deletions(-) create mode 100644 packages/qwik/src/core/container/render.unit.tsx diff --git a/.vscode/launch.json b/.vscode/launch.json index 66594547d82..9edbc545c8f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -33,13 +33,13 @@ }, { "type": "node", - "name": "vscode-jest-tests", + "name": "vitest", "request": "launch", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "program": "${workspaceFolder}/./node_modules/vitest/vitest.mjs", "cwd": "${workspaceFolder}", - "args": ["--runInBand", "--watchAll=false"] + "args": ["--threads=false", "packages/qwik/src/core/container/render.unit.tsx"] } ] } diff --git a/packages/qwik/src/core/container/render.unit.tsx b/packages/qwik/src/core/container/render.unit.tsx new file mode 100644 index 00000000000..85267be744d --- /dev/null +++ b/packages/qwik/src/core/container/render.unit.tsx @@ -0,0 +1,73 @@ +import { assert, suite, test } from 'vitest'; +import type { JSXNode } from '../../jsx-runtime'; +import { renderToString } from '../../server/render'; +import { createDocument } from '../../testing/document'; +import { createDOM } from '../../testing/library'; +import { component$ } from '../component/component.public'; +import { _fnSignal } from '../internal'; +import { useSignal } from '../use/use-signal'; + +suite('jsx signals', () => { + const RenderJSX = component$(() => { + const jsx = useSignal(SSR); + return ( + <> +