64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { createSSRApp, h } from "vue";
|
|
import { renderToString } from "@vue/server-renderer";
|
|
import * as library from "@heroui-vue/components";
|
|
for (const name of [
|
|
"AlertDialog",
|
|
"AlertDialogRoot",
|
|
"AlertDialogTrigger",
|
|
"AlertDialogBackdrop",
|
|
"AlertDialogContainer",
|
|
"AlertDialogDialog",
|
|
"AlertDialogHeader",
|
|
"AlertDialogHeading",
|
|
"AlertDialogBody",
|
|
"AlertDialogFooter",
|
|
"AlertDialogIcon",
|
|
"AlertDialogCloseTrigger",
|
|
"AlertDialogClose",
|
|
"Drawer",
|
|
"DrawerRoot",
|
|
"DrawerTrigger",
|
|
"DrawerBackdrop",
|
|
"DrawerContent",
|
|
"DrawerDialog",
|
|
"DrawerHeader",
|
|
"DrawerHeading",
|
|
"DrawerBody",
|
|
"DrawerFooter",
|
|
"DrawerHandle",
|
|
"DrawerCloseTrigger",
|
|
"DrawerClose",
|
|
])
|
|
assert(library[name], name);
|
|
for (const family of ["AlertDialog", "Drawer"]) {
|
|
const html = await renderToString(
|
|
createSSRApp({
|
|
render: () =>
|
|
h(library[family], {}, () => [
|
|
h(
|
|
library[`${family}Trigger`],
|
|
{ as: "button" },
|
|
() => `Open ${family}`,
|
|
),
|
|
h(library[`${family}Backdrop`], {}, () =>
|
|
family === "Drawer"
|
|
? h(library.DrawerContent)
|
|
: h(library.AlertDialogContainer),
|
|
),
|
|
]),
|
|
}),
|
|
);
|
|
assert(html.includes(`Open ${family}`));
|
|
assert(html.includes('aria-expanded="false"'));
|
|
}
|
|
const css = readFileSync(
|
|
new URL(import.meta.resolve("@heroui-vue/styles/css")),
|
|
"utf8",
|
|
);
|
|
assert(css.includes(".hv-alert-dialog__dialog"));
|
|
assert(css.includes("hv-drawer-in-from-right"));
|
|
assert(css.includes("hv-drawer-out-to-bottom"));
|
|
console.log("M33-M34 tarball ESM exports, node SSR and CSS passed");
|