@echothink-ui/domain-widgets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/index.cjs +3069 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +3956 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +281 -0
- package/dist/index.js +3029 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
- package/src/index.test.tsx +123 -0
- package/src/index.tsx +3925 -0
- package/src/styles.css +4660 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { fireEvent, render, screen, within } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ReportBuilder, RiskMatrix, SupportTicketQueue } from "./index";
|
|
4
|
+
|
|
5
|
+
describe("@echothink-ui/domain-widgets ReportBuilder", () => {
|
|
6
|
+
it("renders a report composition workspace with preview and export controls", () => {
|
|
7
|
+
const { container } = render(
|
|
8
|
+
<ReportBuilder
|
|
9
|
+
title="Quarterly close report"
|
|
10
|
+
description="Compose sections and export to PDF/CSV."
|
|
11
|
+
items={[
|
|
12
|
+
{ id: "pipeline", label: "Pipeline summary", status: "active" },
|
|
13
|
+
{ id: "approvals", label: "Approvals", status: "active" },
|
|
14
|
+
{ id: "audit", label: "Audit log", status: "in-progress" }
|
|
15
|
+
]}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const surface = container.querySelector('[data-eth-component="ReportBuilder"]');
|
|
20
|
+
|
|
21
|
+
expect(surface?.className).toContain("eth-domain-report-builder");
|
|
22
|
+
expect(screen.getByRole("list", { name: "Report sections" })).toBeTruthy();
|
|
23
|
+
expect(screen.getByRole("region", { name: "Report preview" })).toBeTruthy();
|
|
24
|
+
expect(screen.getByRole("button", { name: "Export PDF" })).toBeTruthy();
|
|
25
|
+
expect(screen.getByRole("button", { name: "Export CSV" })).toBeTruthy();
|
|
26
|
+
expect(screen.getByText("3 sections")).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("@echothink-ui/domain-widgets SupportTicketQueue", () => {
|
|
31
|
+
it("renders a semantic SLA queue with summary, owner, status, and row actions", () => {
|
|
32
|
+
render(
|
|
33
|
+
<SupportTicketQueue
|
|
34
|
+
title="Support queue"
|
|
35
|
+
items={[
|
|
36
|
+
{
|
|
37
|
+
id: "p1-login",
|
|
38
|
+
label: "[P1] Login failure",
|
|
39
|
+
description: "Breach in 12 min",
|
|
40
|
+
meta: "On-call: Mara",
|
|
41
|
+
status: "blocked",
|
|
42
|
+
actions: [{ id: "open-p1-login", label: "Open", intent: "ghost" }]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "p2-dashboard",
|
|
46
|
+
label: "[P2] Slow dashboard",
|
|
47
|
+
description: "Due in 2h",
|
|
48
|
+
meta: "Assigned: Platform",
|
|
49
|
+
status: "running"
|
|
50
|
+
}
|
|
51
|
+
]}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect(screen.getByRole("heading", { name: "Support queue" })).toBeTruthy();
|
|
56
|
+
expect(screen.getByText("Open tickets")).toBeTruthy();
|
|
57
|
+
expect(screen.getByText("Blocked")).toBeTruthy();
|
|
58
|
+
expect(screen.getByText("Next SLA")).toBeTruthy();
|
|
59
|
+
|
|
60
|
+
const queue = screen.getByRole("list", { name: "Support tickets" });
|
|
61
|
+
expect(within(queue).getByText("P1")).toBeTruthy();
|
|
62
|
+
expect(within(queue).getByText("Login failure")).toBeTruthy();
|
|
63
|
+
expect(within(queue).getByText("Breach in 12 min")).toBeTruthy();
|
|
64
|
+
expect(within(queue).getByText("On-call: Mara")).toBeTruthy();
|
|
65
|
+
expect(within(queue).getByRole("button", { name: "Open" })).toBeTruthy();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe("@echothink-ui/domain-widgets RiskMatrix", () => {
|
|
70
|
+
it("renders a semantic impact probability matrix with controls and risk detail", () => {
|
|
71
|
+
render(
|
|
72
|
+
<RiskMatrix
|
|
73
|
+
title="Risk register"
|
|
74
|
+
reviewCadence="Weekly review"
|
|
75
|
+
items={[
|
|
76
|
+
{
|
|
77
|
+
id: "outage",
|
|
78
|
+
label: "Outage",
|
|
79
|
+
description: "Primary region service interruption.",
|
|
80
|
+
impact: "high",
|
|
81
|
+
probability: "medium",
|
|
82
|
+
owner: "SRE",
|
|
83
|
+
mitigation: "Expand failover coverage",
|
|
84
|
+
dueDate: "May 30",
|
|
85
|
+
status: "warning"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "data-leakage",
|
|
89
|
+
label: "Data leakage",
|
|
90
|
+
description: "Sensitive export leaves approved boundary.",
|
|
91
|
+
impact: "critical",
|
|
92
|
+
probability: "low",
|
|
93
|
+
owner: "Security",
|
|
94
|
+
mitigation: "Rotate encryption keys",
|
|
95
|
+
dueDate: "Today",
|
|
96
|
+
severity: "critical",
|
|
97
|
+
status: "blocked"
|
|
98
|
+
}
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
expect(screen.getByRole("heading", { name: "Risk register" })).toBeTruthy();
|
|
104
|
+
expect(screen.getByRole("grid", { name: "Impact probability risk matrix" })).toBeTruthy();
|
|
105
|
+
expect(screen.getByRole("button", { name: "Matrix view" })).toBeTruthy();
|
|
106
|
+
expect(screen.getByRole("button", { name: "Register view" })).toBeTruthy();
|
|
107
|
+
|
|
108
|
+
const criticalCell = screen.getByRole("gridcell", {
|
|
109
|
+
name: "Critical impact, Low probability: 1 risk"
|
|
110
|
+
});
|
|
111
|
+
expect(within(criticalCell).getByText("Data leakage")).toBeTruthy();
|
|
112
|
+
|
|
113
|
+
const detail = screen.getByRole("complementary", { name: "Highest priority risk" });
|
|
114
|
+
expect(within(detail).getByText("Rotate encryption keys")).toBeTruthy();
|
|
115
|
+
expect(within(detail).getByText("Weekly review")).toBeTruthy();
|
|
116
|
+
|
|
117
|
+
fireEvent.click(screen.getByRole("button", { name: "Register view" }));
|
|
118
|
+
expect(screen.getByRole("button", { name: "Register view" }).getAttribute("aria-pressed")).toBe(
|
|
119
|
+
"true"
|
|
120
|
+
);
|
|
121
|
+
expect(screen.queryByRole("grid", { name: "Impact probability risk matrix" })).toBeNull();
|
|
122
|
+
});
|
|
123
|
+
});
|