Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import type { DataTableModel } from "@toolctrl/view-models";
|
||||
|
||||
import { renderDataTableMock } from "./index.js";
|
||||
|
||||
const model: DataTableModel = {
|
||||
captionKey: "ui.data-table.caption",
|
||||
columns: [
|
||||
{ key: "name", labelKey: "ui.data-table.column.name", align: "left" },
|
||||
{ key: "amount", labelKey: "ui.data-table.column.amount", align: "right" },
|
||||
],
|
||||
rows: [
|
||||
{ id: "row-1", cells: { name: "Alpha", amount: "10" } },
|
||||
{ id: "row-2", cells: { name: "Beta", amount: "20" } },
|
||||
],
|
||||
emptyLabelKey: "ui.data-table.empty",
|
||||
rowCount: 2,
|
||||
};
|
||||
|
||||
describe("renderDataTableMock (mock impl)", () => {
|
||||
test("carries the mock implementation marker and the row data", () => {
|
||||
const html = renderDataTableMock(model);
|
||||
expect(html).toContain('data-ui-impl="mock"');
|
||||
expect(html).toContain('data-ui-id="ui.data-table"');
|
||||
expect(html).toContain('data-row-id="row-1"');
|
||||
expect(html).toContain('data-row-id="row-2"');
|
||||
expect(html).toContain("Alpha");
|
||||
expect(html).toContain("20");
|
||||
});
|
||||
|
||||
test("renders an empty marker when there are no rows", () => {
|
||||
const html = renderDataTableMock({ ...model, rows: [], rowCount: 0 });
|
||||
expect(html).toContain('data-empty="true"');
|
||||
expect(html).toContain('data-i18n-key="ui.data-table.empty"');
|
||||
expect(html).not.toContain("data-row-id=");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user