@celestia-island/hikari 0.55.426 → 0.55.429
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/package.json +1 -1
- package/src/animation/registerAnimations.ts +5 -0
- package/src/components/HkBoard.nodeActions.test.tsx +3 -1
- package/src/components/HkContextMenuProvider.tsx +84 -2
- package/src/components/HkNotificationBell.scss +54 -1
- package/src/components/HkNotificationBell.styles.test.ts +45 -3
- package/src/components/HkNotificationBell.test.tsx +184 -0
- package/src/components/HkNotificationBell.tsx +166 -17
- package/src/components/HkSerpentineUnlock.scss +124 -0
- package/src/components/HkSerpentineUnlock.test.ts +312 -0
- package/src/components/HkSerpentineUnlock.tsx +366 -0
- package/src/components/HkSolarLocationEditor.tsx +440 -0
- package/src/components/HkSolarLocationSetting.tsx +35 -392
- package/src/components/HkTabs.scss +119 -0
- package/src/components/HkTabs.test.ts +585 -1
- package/src/components/HkTabs.tsx +284 -38
- package/src/components/HkThemePanelContent.solar.contract.test.ts +148 -0
- package/src/components/HkThemePanelContent.tsx +56 -2
- package/src/components/serpentineGeometry.test.ts +157 -0
- package/src/components/serpentineGeometry.ts +184 -0
- package/src/composables/defaultContextMenu.test.ts +569 -0
- package/src/composables/defaultContextMenu.ts +326 -0
- package/src/i18n/locales/ar/components.json +6 -1
- package/src/i18n/locales/ar/platform.json +1 -0
- package/src/i18n/locales/de/components.json +6 -1
- package/src/i18n/locales/de/platform.json +1 -0
- package/src/i18n/locales/en/components.json +6 -1
- package/src/i18n/locales/en/platform.json +1 -0
- package/src/i18n/locales/es/components.json +6 -1
- package/src/i18n/locales/es/platform.json +1 -0
- package/src/i18n/locales/fr/components.json +6 -1
- package/src/i18n/locales/fr/platform.json +1 -0
- package/src/i18n/locales/ja/components.json +6 -1
- package/src/i18n/locales/ja/platform.json +1 -0
- package/src/i18n/locales/ko/components.json +6 -1
- package/src/i18n/locales/ko/platform.json +1 -0
- package/src/i18n/locales/pt/components.json +6 -1
- package/src/i18n/locales/pt/platform.json +1 -0
- package/src/i18n/locales/ru/components.json +6 -1
- package/src/i18n/locales/ru/platform.json +1 -0
- package/src/i18n/locales/zh-Hans/components.json +6 -1
- package/src/i18n/locales/zh-Hans/platform.json +1 -0
- package/src/i18n/locales/zh-Hant/components.json +6 -1
- package/src/i18n/locales/zh-Hant/platform.json +1 -0
- package/src/index.ts +10 -0
package/package.json
CHANGED
|
@@ -157,3 +157,8 @@ registerCssAnimation("hk-edge-glow-breathe", { infinite: true });
|
|
|
157
157
|
// band and drops the loops (house pattern, see HkSkeleton).
|
|
158
158
|
registerCssAnimation("hk-emergency-breathe", { infinite: true });
|
|
159
159
|
registerCssAnimation("hk-emergency-signal", { infinite: true });
|
|
160
|
+
// components/HkSerpentineUnlock.scss — the deliberate-action gate's fail
|
|
161
|
+
// shake (plays once): horizontal refusal feedback when the pointer drifts
|
|
162
|
+
// off the lane. Reduced motion swaps it for a static error outline (the
|
|
163
|
+
// gate never moves anything under reduced motion).
|
|
164
|
+
registerCssAnimation("hk-serpentine-shake");
|
|
@@ -103,6 +103,8 @@ describe("HkBoard nodeActions dock styles", () => {
|
|
|
103
103
|
expect(block.slice(0, 400)).toMatch(
|
|
104
104
|
/bottom:\s*var\(--hk-board-node-action-inset, 4px\)/,
|
|
105
105
|
);
|
|
106
|
-
|
|
106
|
+
// Anchored: `/z-index:\s*6/` is a PREFIX match, so a stacking
|
|
107
|
+
// retune to 60/600 stayed green (final-residual fix).
|
|
108
|
+
expect(block.slice(0, 400)).toMatch(/z-index:\s*6\s*;/);
|
|
107
109
|
});
|
|
108
110
|
});
|
|
@@ -22,15 +22,17 @@
|
|
|
22
22
|
* `useContextMenuTrigger()` (composables/useContextMenu).
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import { computed, defineComponent, provide, ref, shallowRef } from "vue";
|
|
25
|
+
import { computed, defineComponent, onBeforeUnmount, provide, ref, shallowRef, watch } from "vue";
|
|
26
26
|
|
|
27
27
|
import { popupViewportRect } from "../runtime/popupBounds";
|
|
28
28
|
import HkMenu from "./HkMenu";
|
|
29
29
|
import type { PanelAnchor } from "./HkSelectPanel";
|
|
30
|
+
import { contextMenuDefaultsFor } from "../composables/defaultContextMenu";
|
|
30
31
|
import {
|
|
31
32
|
CONTEXT_MENU_KEY,
|
|
32
33
|
type ContextMenuApi,
|
|
33
34
|
type ContextMenuRequest,
|
|
35
|
+
type ContextTriggerPoint,
|
|
34
36
|
} from "../composables/useContextMenu";
|
|
35
37
|
|
|
36
38
|
/** Pick the HkMenu placement that grows away from the pointer's nearest
|
|
@@ -66,7 +68,21 @@ function pointAnchor(x: number, y: number): PanelAnchor {
|
|
|
66
68
|
|
|
67
69
|
export default defineComponent({
|
|
68
70
|
name: "HkContextMenuProvider",
|
|
69
|
-
|
|
71
|
+
props: {
|
|
72
|
+
/**
|
|
73
|
+
* Install the app-wide DEFAULT context-menu regime while this
|
|
74
|
+
* provider is mounted (composables/defaultContextMenu): a
|
|
75
|
+
* window-level bubble listener that yields to any element-level
|
|
76
|
+
* binding (those preventDefault first), consults the registered
|
|
77
|
+
* default contributors (the built-in clipboard menu claims
|
|
78
|
+
* editable targets), and suppresses the platform menu everywhere
|
|
79
|
+
* else. Hosts extend the regime with
|
|
80
|
+
* `registerContextMenuDefault(...)` — region-specific defaults
|
|
81
|
+
* belong in contributors, not in new window listeners.
|
|
82
|
+
*/
|
|
83
|
+
defaults: { type: Boolean, default: false },
|
|
84
|
+
},
|
|
85
|
+
setup(props, { slots }) {
|
|
70
86
|
const open = ref(false);
|
|
71
87
|
const request = shallowRef<ContextMenuRequest | null>(null);
|
|
72
88
|
/** Remount identity: every open() swaps the HkMenu instance, so a
|
|
@@ -93,6 +109,9 @@ export default defineComponent({
|
|
|
93
109
|
|
|
94
110
|
const api: ContextMenuApi = {
|
|
95
111
|
open(next: ContextMenuRequest) {
|
|
112
|
+
// Replacing an open menu closes the previous one — its owner gets
|
|
113
|
+
// the "closed without a selection" hook it was promised.
|
|
114
|
+
if (open.value) request.value?.onClose?.();
|
|
96
115
|
request.value = next;
|
|
97
116
|
menuEpoch.value += 1;
|
|
98
117
|
open.value = true;
|
|
@@ -103,6 +122,69 @@ export default defineComponent({
|
|
|
103
122
|
};
|
|
104
123
|
provide(CONTEXT_MENU_KEY, api);
|
|
105
124
|
|
|
125
|
+
// ── The default regime (prop `defaults`) ─────────────────────────
|
|
126
|
+
// Window-level BUBBLE phase: target-level bindings run first on the
|
|
127
|
+
// element; only their leftovers reach here (defaultPrevented =
|
|
128
|
+
// yielded). The platform menu never appears: the regime owns every
|
|
129
|
+
// unclaimed right-click, with a menu when a contributor claims the
|
|
130
|
+
// point and silent suppression otherwise.
|
|
131
|
+
//
|
|
132
|
+
// preventDefault comes FIRST: the platform menu must be suppressed
|
|
133
|
+
// even when a contributor misbehaves, and a throwing contributor is
|
|
134
|
+
// isolated (DEV-loud) instead of silently handing the event back to
|
|
135
|
+
// the browser.
|
|
136
|
+
function onWindowContextMenu(event: MouseEvent) {
|
|
137
|
+
if (event.defaultPrevented) return; // a binding opened its menu
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
const point: ContextTriggerPoint = {
|
|
140
|
+
x: event.clientX,
|
|
141
|
+
y: event.clientY,
|
|
142
|
+
kind: "pointer",
|
|
143
|
+
target: event.target,
|
|
144
|
+
defaultPrevented: false,
|
|
145
|
+
};
|
|
146
|
+
let request: ContextMenuRequest | null = null;
|
|
147
|
+
try {
|
|
148
|
+
request = contextMenuDefaultsFor(point);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
if (import.meta.env.DEV) {
|
|
151
|
+
// eslint-disable-next-line no-console -- dev-only drift alarm
|
|
152
|
+
console.error("[HkContextMenuProvider] default contributor threw:", err);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (request) api.open(request);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// The listener follows the prop: a host may flip `defaults` at
|
|
159
|
+
// runtime (a face that gains the regime after boot), and toggling it
|
|
160
|
+
// off must actually stop claiming right-clicks.
|
|
161
|
+
let defaultsListening = false;
|
|
162
|
+
/** SSR-safe: a server render has no window, and `immediate: true` runs
|
|
163
|
+
* this during setup (the provider's documented SSR contract). */
|
|
164
|
+
const canListen = typeof window !== "undefined";
|
|
165
|
+
watch(
|
|
166
|
+
() => props.defaults,
|
|
167
|
+
(on) => {
|
|
168
|
+
if (!canListen) return;
|
|
169
|
+
if (on && !defaultsListening) {
|
|
170
|
+
window.addEventListener("contextmenu", onWindowContextMenu);
|
|
171
|
+
defaultsListening = true;
|
|
172
|
+
} else if (!on && defaultsListening) {
|
|
173
|
+
window.removeEventListener("contextmenu", onWindowContextMenu);
|
|
174
|
+
defaultsListening = false;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{ immediate: true },
|
|
178
|
+
);
|
|
179
|
+
onBeforeUnmount(() => {
|
|
180
|
+
// A menu still open when the provider goes away is a menu that
|
|
181
|
+
// closed without a selection — the documented hook fires.
|
|
182
|
+
request.value?.onClose?.();
|
|
183
|
+
if (!canListen) return;
|
|
184
|
+
window.removeEventListener("contextmenu", onWindowContextMenu);
|
|
185
|
+
defaultsListening = false;
|
|
186
|
+
});
|
|
187
|
+
|
|
106
188
|
/** A server render has no DOM to build the anchor from: pass `null`,
|
|
107
189
|
* the same state as a consumer that gives HkMenu no anchor at all
|
|
108
190
|
* (positioning only ever runs in the browser). */
|
|
@@ -35,6 +35,14 @@
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/* The list wrapper is the overlay scrollbar's track host (useOverlay
|
|
39
|
+
Scrollbar requires a box wrapping EXACTLY the viewport — the panel body
|
|
40
|
+
also holds the foot, so the list gets its own). No styles of its own:
|
|
41
|
+
the engine's positioning guard promotes it in place. */
|
|
42
|
+
.hk-notification-center__list-wrap {
|
|
43
|
+
position: relative;
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
.hk-notification-center__list {
|
|
39
47
|
list-style: none;
|
|
40
48
|
margin: 0;
|
|
@@ -105,14 +113,59 @@
|
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
.hk-notification-row__icon {
|
|
116
|
+
.hk-notification-row__icon-box {
|
|
109
117
|
flex: none;
|
|
118
|
+
display: inline-flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
/* The consolidation badge anchors to this box's corner. */
|
|
121
|
+
position: relative;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.hk-notification-row__icon {
|
|
110
125
|
display: inline-flex;
|
|
111
126
|
align-items: center;
|
|
112
127
|
/* Tone ink follows the row's tone class (rules below). */
|
|
113
128
|
color: rgb(var(--color-text) / 65%);
|
|
114
129
|
}
|
|
115
130
|
|
|
131
|
+
/* Corner tally for consolidated records (2026-11-19): the unread dot's
|
|
132
|
+
primary channel — the same "attention" grammar the bell trigger speaks.
|
|
133
|
+
Sits on the glyph's bottom-end corner like a notification count. */
|
|
134
|
+
/* Screen-reader-only text (no global utility exists in hikari — this is
|
|
135
|
+
the local twin of HkTable's .hk-table-sr-only). The tally's visible
|
|
136
|
+
"99+" cap is sighted shorthand; AT reads this pair instead. */
|
|
137
|
+
.hk-notification-row__sr-only {
|
|
138
|
+
position: absolute;
|
|
139
|
+
width: 1px;
|
|
140
|
+
height: 1px;
|
|
141
|
+
padding: 0;
|
|
142
|
+
margin: -1px;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
clip-path: inset(50%);
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
border: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.hk-notification-row__icon-count {
|
|
150
|
+
position: absolute;
|
|
151
|
+
inset-inline-end: -7px;
|
|
152
|
+
bottom: -6px;
|
|
153
|
+
/* Geometry rides the scale: the badge is a hair under the 2xs step
|
|
154
|
+
(0.5625rem = 9px, the token's own 0.625rem would overflow the 14px
|
|
155
|
+
chip), and the chip box is 2 × the radius. */
|
|
156
|
+
min-width: 0.875rem;
|
|
157
|
+
height: 0.875rem;
|
|
158
|
+
padding: 0 0.1875rem;
|
|
159
|
+
border-radius: 0.4375rem;
|
|
160
|
+
background: var(--hi-color-primary, #7aa2f7);
|
|
161
|
+
color: rgb(255 255 255 / 95%);
|
|
162
|
+
font-size: 0.5625rem;
|
|
163
|
+
line-height: 0.875rem;
|
|
164
|
+
font-weight: 600;
|
|
165
|
+
text-align: center;
|
|
166
|
+
font-variant-numeric: tabular-nums;
|
|
167
|
+
}
|
|
168
|
+
|
|
116
169
|
/* Tone ink on the glyph (the toast family's own --hi-color-<tone>
|
|
117
170
|
channels, theme-following; fallbacks are the tokenInventory-canonical
|
|
118
171
|
literals, NOT the toast family's sheet-local ones). */
|
|
@@ -13,6 +13,41 @@ const scss = readFileSync(join(__dirname, "HkNotificationBell.scss"), "utf-8")
|
|
|
13
13
|
.replace(/^[ \t]*\/\/.*$/gm, "");
|
|
14
14
|
|
|
15
15
|
describe("HkNotificationBell scss contract", () => {
|
|
16
|
+
it("the tally's sr-only twin really hides (the a11y recipe is pinned here)", () => {
|
|
17
|
+
// The badge's accessible name is real text in a visually-hidden span;
|
|
18
|
+
// happy-dom applies no stylesheets, so the CONTRACT lives here — every
|
|
19
|
+
// arm of the sr-only recipe must survive a revert that would make the
|
|
20
|
+
// twin visible (or, worse, leave it in flow and break the row).
|
|
21
|
+
const block = scss.match(/\.hk-notification-row__sr-only \{([^}]*)\}/);
|
|
22
|
+
expect(block, "the sr-only rule exists").toBeTruthy();
|
|
23
|
+
for (const arm of [
|
|
24
|
+
"position: absolute",
|
|
25
|
+
"width: 1px",
|
|
26
|
+
"height: 1px",
|
|
27
|
+
"overflow: hidden",
|
|
28
|
+
"clip-path: inset(50%)",
|
|
29
|
+
"white-space: nowrap",
|
|
30
|
+
]) {
|
|
31
|
+
expect(block![1], `sr-only carries ${arm}`).toContain(arm);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("each load-bearing rule is declared ONCE (a duplicate top-level rule could override it unseen)", () => {
|
|
36
|
+
// The row helpers extract the FIRST matching rule, so an appended
|
|
37
|
+
// duplicate with the same selector wins the cascade while the pinned
|
|
38
|
+
// body stays present (final-residual class). Counting the selector at
|
|
39
|
+
// file scope closes it for the rules these pins defend.
|
|
40
|
+
for (const selector of [
|
|
41
|
+
".hk-notification-center__list {",
|
|
42
|
+
".hk-notification-row {",
|
|
43
|
+
".hk-notification-row__icon-count {",
|
|
44
|
+
".hk-notification-center__foot {",
|
|
45
|
+
]) {
|
|
46
|
+
const hits = scss.split(selector).length - 1;
|
|
47
|
+
expect(hits, `${selector} declared exactly once`).toBe(1);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
16
51
|
it("the panel body is a definite 22rem inside the max-content popover", () => {
|
|
17
52
|
expect(scss).toContain("width: 22rem;");
|
|
18
53
|
// The old `min(22rem, 100%)` clamp is the dead-band root cause.
|
|
@@ -68,8 +103,15 @@ describe("HkNotificationBell scss contract", () => {
|
|
|
68
103
|
expect(scss).toMatch(
|
|
69
104
|
/\.hk-notification-row:hover \.hk-notification-row__actions \.hk-icon-button,\s*\n\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{[^}]*--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/,
|
|
70
105
|
);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)
|
|
106
|
+
// Exactly ONE declaration per ink value: the old third arm asserted
|
|
107
|
+
// only the property NAME on the focus-within selector, which the joint
|
|
108
|
+
// block above already covers (redundant) while an appended second
|
|
109
|
+
// declaration could override it unseen (final-residual fix).
|
|
110
|
+
expect(
|
|
111
|
+
scss.match(/--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 40%\)/g) ?? [],
|
|
112
|
+
).toHaveLength(1);
|
|
113
|
+
expect(
|
|
114
|
+
scss.match(/--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/g) ?? [],
|
|
115
|
+
).toHaveLength(1);
|
|
74
116
|
});
|
|
75
117
|
});
|
|
@@ -341,6 +341,190 @@ describe("panel rows", () => {
|
|
|
341
341
|
expect(rows()[0].textContent).toContain("keep me");
|
|
342
342
|
});
|
|
343
343
|
|
|
344
|
+
it("identical messages render ONE row with a corner tally badge", async () => {
|
|
345
|
+
// User direction 2026-11-19: identical messages consolidate into one
|
|
346
|
+
// row; the tone glyph's corner carries the count. The JOURNAL stays
|
|
347
|
+
// 1:1 with its sources (ids are lifecycle keys) — the grouping is a
|
|
348
|
+
// view concern (the record-time merge design was rejected in review:
|
|
349
|
+
// folding discards the incoming id and breaks every id-keyed op).
|
|
350
|
+
await setLocale("en");
|
|
351
|
+
for (const id of ["t:1", "t:2", "t:3"]) {
|
|
352
|
+
recordNotification({ id, kind: "toast", tone: "error", title: "boom" });
|
|
353
|
+
}
|
|
354
|
+
recordNotification({ id: "s:1", kind: "toast", tone: "warning", title: "other" });
|
|
355
|
+
const { entries } = useNotificationCenter();
|
|
356
|
+
// The journal keeps full fidelity — three separate records.
|
|
357
|
+
expect(entries).toHaveLength(4);
|
|
358
|
+
mountBell();
|
|
359
|
+
await settle();
|
|
360
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
361
|
+
await settle();
|
|
362
|
+
// …but the reader sees ONE row per distinct message.
|
|
363
|
+
expect(rows()).toHaveLength(2);
|
|
364
|
+
const boomRow = rows().find((r) => r.textContent?.includes("boom"))!;
|
|
365
|
+
const badge = boomRow.querySelector<HTMLElement>(".hk-notification-row__icon-count");
|
|
366
|
+
expect(badge, "the tally badge renders").toBeTruthy();
|
|
367
|
+
// The visible glyph is the cap ("99+" above 99); the SR twin carries
|
|
368
|
+
// the pair (see the a11y case below).
|
|
369
|
+
expect(badge!.querySelector('[aria-hidden="true"]')!.textContent).toBe("3");
|
|
370
|
+
expect(badge!.getAttribute("title")).toContain("msgs");
|
|
371
|
+
// A single-occurrence record carries NO badge.
|
|
372
|
+
const otherRow = rows().find((r) => r.textContent?.includes("other"))!;
|
|
373
|
+
expect(otherRow.querySelector(".hk-notification-row__icon-count")).toBeNull();
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it("dismiss on a consolidated row forgets EVERY member of the group", async () => {
|
|
377
|
+
await setLocale("en");
|
|
378
|
+
for (const id of ["t:1", "t:2", "t:3"]) {
|
|
379
|
+
recordNotification({ id, kind: "toast", tone: "error", title: "boom" });
|
|
380
|
+
}
|
|
381
|
+
mountBell();
|
|
382
|
+
await settle();
|
|
383
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
384
|
+
await settle();
|
|
385
|
+
expect(rows()).toHaveLength(1);
|
|
386
|
+
const boomRow = rows()[0]!;
|
|
387
|
+
const dismiss = boomRow.querySelector<HTMLButtonElement>(
|
|
388
|
+
'.hk-notification-row__actions .hk-icon-button[aria-label="Dismiss"]',
|
|
389
|
+
)!;
|
|
390
|
+
dismiss.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
391
|
+
await settle();
|
|
392
|
+
// The whole line goes — not just the newest member.
|
|
393
|
+
expect(useNotificationCenter().entries).toHaveLength(0);
|
|
394
|
+
expect(rows()).toHaveLength(0);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it("the tally's accessible name is real text with its unit (not a bare number)", async () => {
|
|
398
|
+
// Final-residual fix: `aria-label` on a role-less span is not a
|
|
399
|
+
// reliable accessible name (generic role cannot be named from author),
|
|
400
|
+
// so the badge ships a visually-hidden twin with the full pair while
|
|
401
|
+
// the visible glyph stays the sighted shorthand.
|
|
402
|
+
await setLocale("en");
|
|
403
|
+
for (const id of ["t:1", "t:2", "t:3", "t:4"]) {
|
|
404
|
+
recordNotification({ id, kind: "toast", tone: "error", title: "boom" });
|
|
405
|
+
}
|
|
406
|
+
mountBell();
|
|
407
|
+
await settle();
|
|
408
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
409
|
+
await settle();
|
|
410
|
+
const badge = rows()[0]!.querySelector<HTMLElement>(".hk-notification-row__icon-count")!;
|
|
411
|
+
const sr = badge.querySelector<HTMLElement>(".hk-notification-row__sr-only");
|
|
412
|
+
expect(sr, "the visually-hidden twin renders").toBeTruthy();
|
|
413
|
+
expect(sr!.textContent).toBe("4 msgs");
|
|
414
|
+
// The hiding recipe itself is pinned in the scss contract (happy-dom
|
|
415
|
+
// applies no stylesheets, so a computed-style probe here would test
|
|
416
|
+
// the environment, not the code).
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
it("a toast joining a snoozed emergency's group does NOT dissolve the Restore", async () => {
|
|
420
|
+
// Round-3 S2, proven by probe: the group's FACE is its newest member
|
|
421
|
+
// (the toast), so head-only action gating hid the emergency's only
|
|
422
|
+
// restore affordance while the journal still held the callback — the
|
|
423
|
+
// same loss the record-time merge was rejected for, at the view
|
|
424
|
+
// layer. The actions lane scans members instead.
|
|
425
|
+
await setLocale("en");
|
|
426
|
+
raiseEmergencyAlert({ id: "quota", severity: "warning", title: "quota out" });
|
|
427
|
+
snoozeEmergencyAlert("quota");
|
|
428
|
+
recordNotification({
|
|
429
|
+
id: "toast:same",
|
|
430
|
+
kind: "toast",
|
|
431
|
+
tone: "warning",
|
|
432
|
+
title: "quota out",
|
|
433
|
+
state: "active",
|
|
434
|
+
});
|
|
435
|
+
const { entries } = useNotificationCenter();
|
|
436
|
+
expect(entries).toHaveLength(2);
|
|
437
|
+
mountBell();
|
|
438
|
+
await settle();
|
|
439
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
440
|
+
await settle();
|
|
441
|
+
expect(rows()).toHaveLength(1);
|
|
442
|
+
const row = rows()[0]!;
|
|
443
|
+
// Restore is STILL offered (member scan), and the Hidden chip shows.
|
|
444
|
+
const restore = row.querySelector<HTMLButtonElement>(
|
|
445
|
+
'.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]',
|
|
446
|
+
);
|
|
447
|
+
expect(restore, "the emergency's restore survives the grouping").toBeTruthy();
|
|
448
|
+
expect(row.querySelector(".hk-notification-row__title-state")?.textContent).toContain(
|
|
449
|
+
"Hidden",
|
|
450
|
+
);
|
|
451
|
+
// The tally counts both members.
|
|
452
|
+
expect(
|
|
453
|
+
row.querySelector('.hk-notification-row__icon-count [aria-hidden="true"]')?.textContent,
|
|
454
|
+
).toBe("2");
|
|
455
|
+
// And the restore still works through the journal's resummon path.
|
|
456
|
+
restore!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
457
|
+
await settle();
|
|
458
|
+
expect(
|
|
459
|
+
row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]'),
|
|
460
|
+
).toBeFalsy();
|
|
461
|
+
expect(row.classList.contains("is-active")).toBe(true);
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
it("two identical-content snoozed episodes each keep their own Restore", async () => {
|
|
465
|
+
// Final-residual fix: `restorable` used to be a single `find`, so a
|
|
466
|
+
// group holding two episodes surfaced ONE handle and stranded the
|
|
467
|
+
// other's callback (journal intact, band hidden = unreachable).
|
|
468
|
+
await setLocale("en");
|
|
469
|
+
raiseEmergencyAlert({ id: "a", severity: "warning", title: "dup" });
|
|
470
|
+
snoozeEmergencyAlert("a");
|
|
471
|
+
raiseEmergencyAlert({ id: "b", severity: "warning", title: "dup" });
|
|
472
|
+
snoozeEmergencyAlert("b");
|
|
473
|
+
mountBell();
|
|
474
|
+
await settle();
|
|
475
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
476
|
+
await settle();
|
|
477
|
+
expect(rows(), "both episodes share one content group").toHaveLength(1);
|
|
478
|
+
const restores = rows()[0]!.querySelectorAll<HTMLButtonElement>(
|
|
479
|
+
'.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]',
|
|
480
|
+
);
|
|
481
|
+
expect(restores, "one Restore per restorable episode").toHaveLength(2);
|
|
482
|
+
// Each button drives its OWN episode: unsnoozing one leaves the other.
|
|
483
|
+
restores[0]!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
484
|
+
await settle();
|
|
485
|
+
const after = rows()[0]!.querySelectorAll<HTMLButtonElement>(
|
|
486
|
+
'.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]',
|
|
487
|
+
);
|
|
488
|
+
expect(after, "the other episode keeps its handle").toHaveLength(1);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it("the open panel carries the overlay scrollbar tracks; closing detaches them", async () => {
|
|
492
|
+
// The list keeps native overflow MECHANICS with the suppression pair,
|
|
493
|
+
// so the overlay engine is the only chrome it can ever show (user
|
|
494
|
+
// report 2026-11-19: the list scrolled invisibly). HkPopover attaches
|
|
495
|
+
// its engine in sheet mode only — the bell owns the desktop one.
|
|
496
|
+
await setLocale("en");
|
|
497
|
+
for (let i = 0; i < 30; i++) {
|
|
498
|
+
recordNotification({ id: `t:${i}`, kind: "toast", tone: "error", title: `row ${i}` });
|
|
499
|
+
}
|
|
500
|
+
mountBell();
|
|
501
|
+
await settle();
|
|
502
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
503
|
+
await settle();
|
|
504
|
+
const wrap = document.querySelector(".hk-notification-center__list-wrap");
|
|
505
|
+
expect(wrap, "the dedicated track host exists").toBeTruthy();
|
|
506
|
+
expect(wrap!.querySelectorAll(".hk-scrollbar-track").length).toBeGreaterThan(0);
|
|
507
|
+
// Closing the panel must not leak the engine (document listeners /
|
|
508
|
+
// cron timers ride the handle).
|
|
509
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
510
|
+
await settle();
|
|
511
|
+
expect(document.querySelector(".hk-notification-center__list-wrap")).toBeNull();
|
|
512
|
+
|
|
513
|
+
// Round-2 hole: with the panel OPEN on the empty state the list is
|
|
514
|
+
// not mounted — a record landing NOW mounts it fresh. The signature
|
|
515
|
+
// watcher must attach the engine to the NEW viewport (an update() on
|
|
516
|
+
// a stale handle would leave it scrolling invisibly).
|
|
517
|
+
resetNotifications();
|
|
518
|
+
bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
519
|
+
await settle();
|
|
520
|
+
expect(document.querySelector(".hk-notification-center__empty")).toBeTruthy();
|
|
521
|
+
recordNotification({ id: "late", kind: "toast", tone: "error", title: "late arrival" });
|
|
522
|
+
await settle();
|
|
523
|
+
const wrap2 = document.querySelector(".hk-notification-center__list-wrap");
|
|
524
|
+
expect(wrap2, "the list mounts under the open panel").toBeTruthy();
|
|
525
|
+
expect(wrap2!.querySelectorAll(".hk-scrollbar-track").length).toBeGreaterThan(0);
|
|
526
|
+
});
|
|
527
|
+
|
|
344
528
|
it("rows sort newest-first and Clear all empties the journal", async () => {
|
|
345
529
|
await setLocale("en");
|
|
346
530
|
const { entries } = useNotificationCenter();
|