21 lines
700 B
TypeScript
21 lines
700 B
TypeScript
// @vitest-environment node
|
|
import { it, expect } from "vitest";
|
|
import { createSSRApp, h } from "vue";
|
|
import { renderToString } from "@vue/server-renderer";
|
|
import { Button, Card, Input, Switch } from "../packages/vue/src";
|
|
it("renders the initial components without browser globals", async () => {
|
|
const html = await renderToString(
|
|
createSSRApp({
|
|
render: () =>
|
|
h(Card, () => [
|
|
h(Button, () => "保存"),
|
|
h(Input, { modelValue: "名称" }),
|
|
h(Switch, { checked: true, "aria-label": "通知" }),
|
|
]),
|
|
}),
|
|
);
|
|
expect(html).toContain("保存");
|
|
expect(html).toContain('value="名称"');
|
|
expect(html).toContain('role="switch"');
|
|
});
|