@celestia-island/hikari 0.55.463 → 0.55.464
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/dist/types/components/HkMasterDetail.d.ts +59 -76
- package/dist/types/components/HkModal.d.ts +17 -0
- package/package.json +1 -1
- package/src/animation/registerAnimations.ts +0 -8
- package/src/components/HkMasterDetail.scss +77 -168
- package/src/components/HkMasterDetail.ssr.test.tsx +36 -12
- package/src/components/HkMasterDetail.test.tsx +338 -221
- package/src/components/HkMasterDetail.tsx +159 -122
- package/src/components/HkModal.test.tsx +33 -0
- package/src/components/HkModal.tsx +8 -1
- package/src/styles/admin-tokens.scss +22 -0
|
@@ -14,11 +14,12 @@ import { HkMasterDetail } from "./HkMasterDetail";
|
|
|
14
14
|
*
|
|
15
15
|
* The split has no measurement on a server, so the component renders the WIDE
|
|
16
16
|
* layout (the same desktop assumption `useBreakpoint`'s own server fallback
|
|
17
|
-
* declares) instead of guessing at the
|
|
18
|
-
* different tree. What this file pins is that the whole surface —
|
|
19
|
-
*
|
|
20
|
-
* DOM: a `window`/`document` read in setup or in the
|
|
21
|
-
* throw here (the HkWallpaperBackdrop.ssr.test.ts
|
|
17
|
+
* declares) instead of guessing at the narrow form and hydrating into a
|
|
18
|
+
* different tree. What this file pins is that the whole surface — the flex
|
|
19
|
+
* row, the detail region, the empty state and the overlay-scrollbar setup —
|
|
20
|
+
* is reachable without a DOM: a `window`/`document` read in setup or in the
|
|
21
|
+
* render function would throw here (the HkWallpaperBackdrop.ssr.test.ts
|
|
22
|
+
* precedent).
|
|
22
23
|
*/
|
|
23
24
|
describe("HkMasterDetail on a server", () => {
|
|
24
25
|
it("renders the wide layout with the boxed empty state and no DOM globals", async () => {
|
|
@@ -40,13 +41,13 @@ describe("HkMasterDetail on a server", () => {
|
|
|
40
41
|
);
|
|
41
42
|
|
|
42
43
|
expect(html).toContain('class="hk-master-detail"');
|
|
43
|
-
// No viewport to measure ⇒ the wide layout, never the
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
44
|
+
// No viewport to measure ⇒ the wide layout, never the narrow modal
|
|
45
|
+
// form. The default split (768) sits below the server fallback
|
|
46
|
+
// (1024), so the guard is pinned through an explicit LARGER splitAt
|
|
47
|
+
// further down — dropping `hasViewport` would render the HkModal
|
|
48
|
+
// branch here and red that one.
|
|
47
49
|
expect(html).toContain('data-split="two"');
|
|
48
|
-
expect(html).not.toContain("hk-
|
|
49
|
-
expect(html).not.toContain("hk-master-detail-scrim");
|
|
50
|
+
expect(html).not.toContain("hk-modal-root");
|
|
50
51
|
// Closed: the empty state stands in for the detail slot.
|
|
51
52
|
expect(html).toContain("hk-empty-state--boxed");
|
|
52
53
|
expect(html).toContain("Nothing selected");
|
|
@@ -57,6 +58,29 @@ describe("HkMasterDetail on a server", () => {
|
|
|
57
58
|
expect(html).toContain('aria-label="Message"');
|
|
58
59
|
});
|
|
59
60
|
|
|
61
|
+
it("keeps a splitAt above the server fallback on the wide layout", async () => {
|
|
62
|
+
// The server fallback width is 1024: a host splitting at 1200 would
|
|
63
|
+
// take the narrow form if the component trusted it. `hasViewport`
|
|
64
|
+
// keeps the server on the wide layout — dropping the guard renders
|
|
65
|
+
// HkModal into this string and reds the assertion
|
|
66
|
+
// [MUT:hasviewport-guard-dropped].
|
|
67
|
+
const html = await renderToString(
|
|
68
|
+
createSSRApp({
|
|
69
|
+
render: () =>
|
|
70
|
+
h(
|
|
71
|
+
HkMasterDetail,
|
|
72
|
+
{ detailOpen: true, detailTitle: "Message", splitAt: 1200 },
|
|
73
|
+
{
|
|
74
|
+
list: () => h("div", { class: "roster" }, "ROSTER"),
|
|
75
|
+
detail: () => h("div", { class: "detail-payload" }, "DETAIL"),
|
|
76
|
+
},
|
|
77
|
+
),
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
80
|
+
expect(html).toContain('data-split="two"');
|
|
81
|
+
expect(html).not.toContain("hk-modal-root");
|
|
82
|
+
});
|
|
83
|
+
|
|
60
84
|
it("renders a selected detail without the empty state", async () => {
|
|
61
85
|
const html = await renderToString(
|
|
62
86
|
createSSRApp({
|
|
@@ -79,4 +103,4 @@ describe("HkMasterDetail on a server", () => {
|
|
|
79
103
|
expect(html).toContain("hk-master-detail-close");
|
|
80
104
|
expect(html).toContain('aria-label="Close"');
|
|
81
105
|
});
|
|
82
|
-
});
|
|
106
|
+
});
|