feat: add Surface, Link and Spinner components

This commit is contained in:
maoyingjie
2026-10-21 13:04:06 +08:00
parent 9d40dc0ecb
commit 630963c652
52 changed files with 2683 additions and 162 deletions
+19 -1
View File
@@ -2,7 +2,17 @@
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";
import {
Button,
Card,
Input,
Switch,
Surface,
Link,
LinkIcon,
Spinner,
TextArea,
} from "../packages/vue/src";
it("renders the initial components without browser globals", async () => {
const html = await renderToString(
createSSRApp({
@@ -11,10 +21,18 @@ it("renders the initial components without browser globals", async () => {
h(Button, () => "保存"),
h(Input, { modelValue: "名称" }),
h(Switch, { checked: true, "aria-label": "通知" }),
h(Surface, { variant: "secondary" }, () => h("span", "表面")),
h(Link, { href: "#" }, () => ["链接", h(LinkIcon)]),
h(Spinner),
h(TextArea, { modelValue: "备注" }),
]),
}),
);
expect(html).toContain("保存");
expect(html).toContain('value="名称"');
expect(html).toContain('role="switch"');
expect(html).toContain("hv-surface--secondary");
expect(html).toContain('data-slot="link"');
expect(html).toContain('role="status"');
expect(html).toContain('data-slot="textarea"');
});