feat: migrate Toast and Table with reviewed state focus and SSR contracts
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createSSRApp, h } from "vue";
|
||||
import { renderToString } from "@vue/server-renderer";
|
||||
import * as lib from "@heroui-vue/components";
|
||||
for (const name of [
|
||||
"Toast",
|
||||
"ToastRoot",
|
||||
"ToastProvider",
|
||||
"ToastContent",
|
||||
"ToastIndicator",
|
||||
"ToastTitle",
|
||||
"ToastDescription",
|
||||
"ToastActionButton",
|
||||
"ToastCloseButton",
|
||||
"ToastQueue",
|
||||
"toast",
|
||||
"toastQueue",
|
||||
"createToastFunction",
|
||||
"Table",
|
||||
"TableRoot",
|
||||
"TableContent",
|
||||
"TableHeader",
|
||||
"TableColumn",
|
||||
"TableBody",
|
||||
"TableRow",
|
||||
"TableCell",
|
||||
"TableScrollContainer",
|
||||
"TableFooter",
|
||||
"TableResizableContainer",
|
||||
"TableColumnResizer",
|
||||
"TableLoadMore",
|
||||
"TableLoadMoreItem",
|
||||
"TableLoadMoreContent",
|
||||
"TableCollection",
|
||||
"TableSortableColumnHeader",
|
||||
])
|
||||
assert(lib[name], name);
|
||||
assert.equal(lib.toast("server secret"), "");
|
||||
assert.equal(lib.toastQueue.visibleToasts.length, 0);
|
||||
const queue = new lib.ToastQueue();
|
||||
queue.add({ title: "Request-local notification" });
|
||||
const html = await renderToString(
|
||||
createSSRApp({
|
||||
render: () =>
|
||||
h("main", [
|
||||
h(lib.ToastProvider, { queue }),
|
||||
h(lib.Table, () =>
|
||||
h(
|
||||
lib.TableContent,
|
||||
{ selectionMode: "single", selectedKeys: [0] },
|
||||
() => [
|
||||
h(lib.TableHeader, () =>
|
||||
h(lib.TableColumn, { isRowHeader: true }, () => "Name"),
|
||||
),
|
||||
h(lib.TableBody, () =>
|
||||
h(lib.TableRow, { rowKey: 0 }, () =>
|
||||
h(lib.TableCell, () => "Zero"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
}),
|
||||
);
|
||||
assert(html.includes("Request-local notification"));
|
||||
assert(html.includes('scope="row"'));
|
||||
assert(html.includes('aria-selected="true"'));
|
||||
queue.destroy();
|
||||
const css = readFileSync(
|
||||
new URL(import.meta.resolve("@heroui-vue/styles/css")),
|
||||
"utf8",
|
||||
);
|
||||
assert(css.includes(".hv-toast-region"));
|
||||
assert(css.includes(".hv-table__column-resizer"));
|
||||
assert(css.includes("data-exiting"));
|
||||
console.log("M35/M36 tarball exports, actual node SSR and CSS passed");
|
||||
Reference in New Issue
Block a user