feat: migrate Toolbar with teleport-safe focus ownership

This commit is contained in:
maoyingjie
2026-10-23 10:50:42 +08:00
parent 9c93647ad2
commit b2525bb04d
33 changed files with 2168 additions and 30 deletions
+37
View File
@@ -530,3 +530,40 @@ it("keeps standalone ToggleButton DOM ids stable on the server", async () => {
);
expect(html).toContain('id="like-toggle"');
});
it("renders Toolbar with nested groups without browser globals", async () => {
const {
Toolbar,
Button,
ButtonGroup,
Separator,
ToggleButton,
ToggleButtonGroup,
} = await import("../packages/vue/src");
const html = await renderToString(
createSSRApp({
render: () =>
h(
Toolbar,
{
"aria-label": "文本格式",
orientation: "vertical",
isAttached: true,
},
() => [
h(ToggleButtonGroup, { selectionMode: "multiple" }, () => [
h(ToggleButton, { id: "bold" }, () => "Bold"),
]),
h(Separator),
h(ButtonGroup, () => h(Button, () => "Copy")),
],
),
}),
);
expect(html).toContain('role="toolbar"');
expect(html).toContain('aria-orientation="vertical"');
expect(html).toContain("hv-toolbar--attached");
expect(html).toContain('data-slot="toggle-button-group"');
expect(html).toContain("hv-separator--horizontal");
expect(html).toContain('data-slot="button-group"');
});