feat: add Surface, Link and Spinner components
This commit is contained in:
+19
-1
@@ -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"');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user