50 lines
1.5 KiB
JavaScript
50 lines
1.5 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 {
|
||
InputOTP,
|
||
InputOTPGroup,
|
||
InputOTPSlot,
|
||
Label,
|
||
Header,
|
||
Pagination,
|
||
PaginationContent,
|
||
PaginationItem,
|
||
PaginationLink,
|
||
} from "@heroui-vue/components";
|
||
const html = await renderToString(
|
||
createSSRApp({
|
||
render: () =>
|
||
h("div", [
|
||
h(Header, {}, () => "Heading"),
|
||
h(Pagination, {}, () =>
|
||
h(PaginationContent, {}, () =>
|
||
h(PaginationItem, {}, () =>
|
||
h(PaginationLink, { "aria-current": "step" }, () => "1"),
|
||
),
|
||
),
|
||
),
|
||
h(InputOTP, { maxLength: 2, defaultValue: "12", name: "code" }, () => [
|
||
h(Label, { id: "consumer-label" }, () => "Security code"),
|
||
h(InputOTPGroup, {}, () => [
|
||
h(InputOTPSlot, { index: 0 }),
|
||
h(InputOTPSlot, { index: 1 }),
|
||
]),
|
||
]),
|
||
]),
|
||
}),
|
||
);
|
||
assert(html.includes('data-slot="header"'));
|
||
assert(html.includes('aria-current="step"'));
|
||
assert.equal(html.match(/aria-labelledby="consumer-label"/g)?.length, 2);
|
||
assert(html.includes('value="12"'));
|
||
assert(html.includes('name="code"'));
|
||
const css = readFileSync(
|
||
new URL(import.meta.resolve("@heroui-vue/styles/css")),
|
||
"utf8",
|
||
);
|
||
for (const name of ["hv-header", "hv-pagination", "hv-input-otp"])
|
||
assert(css.includes(name));
|
||
console.log("M30–M32 independent tarball ESM/SSR/ARIA/CSS passed.");
|