Files
heroui-vue/tests/package/consume-m30-m32.mjs
T

50 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.");