feat: migrate ScrollShadow and Tabs with docs and keyboard support

This commit is contained in:
maoyingjie
2026-10-23 00:25:45 +08:00
parent 2b4ac04df1
commit 99df0f1c91
55 changed files with 3290 additions and 5 deletions
+27
View File
@@ -432,3 +432,30 @@ it("renders public Modal Popover and Tooltip roots without browser globals", asy
expect(html).not.toContain('role="dialog"');
expect(html).not.toContain('role="tooltip"');
});
it("renders ScrollShadow and Tabs without browser globals and resolves initial panel IDs", async () => {
const { ScrollShadow, Tabs, TabsList, TabsTab, TabsPanel, TabsIndicator } =
await import("../packages/vue/src");
const html = await renderToString(
createSSRApp({
render: () =>
h(Tabs, {}, () => [
h(TabsList, { "aria-label": "SSR tabs" }, () => [
h(TabsTab, { value: "a" }, () => ["A", h(TabsIndicator)]),
h(TabsTab, { value: "b" }, () => ["B", h(TabsIndicator)]),
]),
h(TabsPanel, { value: "a" }, () =>
h(ScrollShadow, { visibility: "bottom" }, () => "SSR content"),
),
h(TabsPanel, { value: "b" }, () => "not selected"),
]),
}),
);
expect(html).toContain('aria-selected="true"');
expect(html).toContain('data-bottom-scroll="true"');
expect(html).toContain("SSR content");
expect(html).not.toContain("not selected");
const controls = html.match(/aria-controls="([^"]+)"/)?.[1];
expect(controls).toBeTruthy();
expect(html).toContain(`id="${controls}"`);
});