@celestia-island/hikari 0.55.494 → 0.55.496
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/HkCornerText.d.ts +26 -0
- package/package.json +1 -1
- package/src/components/HkAuthCard.test.tsx +22 -4
- package/src/components/HkCornerText.test.tsx +33 -0
- package/src/components/HkCornerText.tsx +45 -2
- package/src/components/HkLoginFlow.test.tsx +32 -8
- package/src/components/HkSolarLocationEditor.tsx +30 -13
- package/src/components/HkSolarLocationSetting.scss +36 -0
- package/src/components/HkSolarLocationSetting.styles.test.ts +27 -0
- package/src/components/HkSolarLocationSetting.test.tsx +50 -0
- package/src/styles/admin-tokens.scss +14 -10
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
2
|
import "./HkCornerText.scss";
|
|
3
|
+
/**
|
|
4
|
+
* Does a slot's returned tree paint NOTHING at all? The lane's dead-space
|
|
5
|
+
* rule must read the RENDERED nodes, not the slot's existence: Vue hands
|
|
6
|
+
* back a truthy value for every slot shape a host can write, so the
|
|
7
|
+
* original `!slotContent` test kept an invisible `.hk-corner-text` box
|
|
8
|
+
* (with the corner's flex margins) for a slot that renders `[]`, `[null]`,
|
|
9
|
+
* `false`, `""` or a whitespace-only string.
|
|
10
|
+
*
|
|
11
|
+
* The walk mirrors what Vue's own normalizer accepts:
|
|
12
|
+
* - `null` / `undefined` / booleans paint nothing (they normalize to a
|
|
13
|
+
* comment placeholder);
|
|
14
|
+
* - strings only paint when they carry a non-whitespace character — a
|
|
15
|
+
* blank string still mounts a text node, which occupies a flex row in
|
|
16
|
+
* the lane;
|
|
17
|
+
* - numbers always paint (`0` is real content);
|
|
18
|
+
* - a `Text` vnode paints when its children carry such a string;
|
|
19
|
+
* - `Fragment` vnodes (what a slot returning an array is wrapped in) and
|
|
20
|
+
* plain arrays recurse — they paint only what their children paint;
|
|
21
|
+
* - `Comment` vnodes never paint;
|
|
22
|
+
* - every other vnode (element, component, Teleport, Suspense) paints by
|
|
23
|
+
* definition.
|
|
24
|
+
*
|
|
25
|
+
* A function is NOT invoked here: Vue resolves slot functions, and calling
|
|
26
|
+
* a host's by hand could run it twice per render.
|
|
27
|
+
*/
|
|
28
|
+
export declare function slotPaintsNothing(value: unknown): boolean;
|
|
3
29
|
/** One entry of a corner text lane: plain text, or a link when `href`
|
|
4
30
|
* is set (registry links open in a new tab with `noopener`, the same
|
|
5
31
|
* contract as the beian filings). */
|
package/package.json
CHANGED
|
@@ -287,12 +287,30 @@ describe("HkAuthCard SCSS spacing contract", () => {
|
|
|
287
287
|
expect(scss).not.toMatch(/\.s-auth-form:has\(\+ \.s-auth-methods\)/);
|
|
288
288
|
});
|
|
289
289
|
|
|
290
|
-
it("keeps the form's collapsed bottom padding feeding the footer band", () => {
|
|
290
|
+
it("keeps the form's collapsed bottom padding feeding the footer band (sibling pin)", () => {
|
|
291
291
|
// The form→footer distance is composed (8px form padding-bottom via
|
|
292
292
|
// :has + the footer's own margin); losing the collapse would swap in
|
|
293
|
-
// the form's default
|
|
294
|
-
const rule = scss.match(/\.s-auth-form:has\(\.s-auth-footer\)\s*{[^}]*}/)?.[0] ?? "";
|
|
295
|
-
expect(rule, ":has collapse rule must exist").toBeTruthy();
|
|
293
|
+
// the form's default 32px bottom padding instead.
|
|
294
|
+
const rule = scss.match(/\.s-auth-form:has\(\+ \.s-auth-footer\)\s*{[^}]*}/)?.[0] ?? "";
|
|
295
|
+
expect(rule, ":has(+ …) sibling collapse rule must exist").toBeTruthy();
|
|
296
296
|
expect(rule).toContain("padding-bottom: var(--space-8, 0.5rem)");
|
|
297
|
+
|
|
298
|
+
// The DOM half — the card's footer IS a direct sibling of the form, so
|
|
299
|
+
// this is the arm that fires for every card-shaped surface (HkLoginFlow's
|
|
300
|
+
// swapped body needs the DESCENDANT arm; see HkLoginFlow.test.tsx).
|
|
301
|
+
// MUT:authcard-footer-shape-drift (nesting the footer inside the form,
|
|
302
|
+
// or emitting it before it, flips both assertions below).
|
|
303
|
+
const c = mount(
|
|
304
|
+
h(HkAuthCard, { title: "T" }, {
|
|
305
|
+
default: () => h("input", { class: "probe-field" }),
|
|
306
|
+
footer: () => h("div", { class: "probe-footer" }, "row"),
|
|
307
|
+
}),
|
|
308
|
+
);
|
|
309
|
+
const form = c.querySelector(".s-auth-form");
|
|
310
|
+
const footer = c.querySelector(".s-auth-footer");
|
|
311
|
+
expect(form).not.toBeNull();
|
|
312
|
+
expect(footer).not.toBeNull();
|
|
313
|
+
expect(footer!.previousElementSibling).toBe(form);
|
|
314
|
+
expect(form!.contains(footer)).toBe(false);
|
|
297
315
|
});
|
|
298
316
|
});
|
|
@@ -93,6 +93,39 @@ describe("HkCornerText", () => {
|
|
|
93
93
|
expect(c.querySelector(".hk-corner-text")).toBeNull();
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
it("treats a slot that PAINTS nothing as empty (the dead-space rule reads children, not the slot)", () => {
|
|
97
|
+
// A declared slot is always truthy, so `!slotContent` kept an
|
|
98
|
+
// invisible `.hk-corner-text` box (and the corner's flex margins with
|
|
99
|
+
// it) for every one of these shapes. The rule now walks the rendered
|
|
100
|
+
// nodes; each arm below is a shape a host writes by accident.
|
|
101
|
+
// MUT:corner-dead-space-slot-truthiness (restoring `!slotContent`
|
|
102
|
+
// renders the box for all of these and this goes red).
|
|
103
|
+
const emptyShapes: Array<[string, () => unknown]> = [
|
|
104
|
+
["empty array", () => []],
|
|
105
|
+
["nulls only", () => [null, null]],
|
|
106
|
+
["false", () => false],
|
|
107
|
+
["empty string", () => ""],
|
|
108
|
+
["whitespace only", () => " "],
|
|
109
|
+
["nested null array", () => [null]],
|
|
110
|
+
];
|
|
111
|
+
for (const [label, slot] of emptyShapes) {
|
|
112
|
+
const c = mount(h(HkCornerText, { items: [] }, { default: slot as never }));
|
|
113
|
+
expect(c.querySelector(".hk-corner-text"), `slot shape "${label}" must not paint a lane`).toBeNull();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("keeps the lane for slot children that DO paint (zero and text are content)", () => {
|
|
118
|
+
// The counterpart arm: the new check must not swallow real content.
|
|
119
|
+
// MUT:corner-dead-space-overreach (treating numbers as empty or
|
|
120
|
+
// dropping text nodes hides these lanes).
|
|
121
|
+
const zero = mount(h(HkCornerText, { items: [] }, { default: () => 0 }));
|
|
122
|
+
expect(zero.querySelector(".hk-corner-text")?.textContent).toBe("0");
|
|
123
|
+
const text = mount(h(HkCornerText, { items: [] }, { default: () => "苏ICP备" }));
|
|
124
|
+
expect(text.querySelector(".hk-corner-text")?.textContent).toBe("苏ICP备");
|
|
125
|
+
const nested = mount(h(HkCornerText, { items: [] }, { default: () => [[h("i", { class: "deep" }, "x")]] }));
|
|
126
|
+
expect(nested.querySelector(".hk-corner-text .deep")).not.toBeNull();
|
|
127
|
+
});
|
|
128
|
+
|
|
96
129
|
it("as=nav marks a link lane as a labeled landmark; div stays unlabeled", () => {
|
|
97
130
|
const c = mount(h(HkCornerText, { items, as: "nav", ariaLabel: "备案" }));
|
|
98
131
|
const nav = c.querySelector("nav.hk-corner-text")!;
|
|
@@ -1,7 +1,50 @@
|
|
|
1
|
-
import { defineComponent, type PropType } from "vue";
|
|
1
|
+
import { Comment, Fragment, Text, defineComponent, type PropType } from "vue";
|
|
2
2
|
|
|
3
3
|
import "./HkCornerText.scss";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Does a slot's returned tree paint NOTHING at all? The lane's dead-space
|
|
7
|
+
* rule must read the RENDERED nodes, not the slot's existence: Vue hands
|
|
8
|
+
* back a truthy value for every slot shape a host can write, so the
|
|
9
|
+
* original `!slotContent` test kept an invisible `.hk-corner-text` box
|
|
10
|
+
* (with the corner's flex margins) for a slot that renders `[]`, `[null]`,
|
|
11
|
+
* `false`, `""` or a whitespace-only string.
|
|
12
|
+
*
|
|
13
|
+
* The walk mirrors what Vue's own normalizer accepts:
|
|
14
|
+
* - `null` / `undefined` / booleans paint nothing (they normalize to a
|
|
15
|
+
* comment placeholder);
|
|
16
|
+
* - strings only paint when they carry a non-whitespace character — a
|
|
17
|
+
* blank string still mounts a text node, which occupies a flex row in
|
|
18
|
+
* the lane;
|
|
19
|
+
* - numbers always paint (`0` is real content);
|
|
20
|
+
* - a `Text` vnode paints when its children carry such a string;
|
|
21
|
+
* - `Fragment` vnodes (what a slot returning an array is wrapped in) and
|
|
22
|
+
* plain arrays recurse — they paint only what their children paint;
|
|
23
|
+
* - `Comment` vnodes never paint;
|
|
24
|
+
* - every other vnode (element, component, Teleport, Suspense) paints by
|
|
25
|
+
* definition.
|
|
26
|
+
*
|
|
27
|
+
* A function is NOT invoked here: Vue resolves slot functions, and calling
|
|
28
|
+
* a host's by hand could run it twice per render.
|
|
29
|
+
*/
|
|
30
|
+
export function slotPaintsNothing(value: unknown): boolean {
|
|
31
|
+
if (value === null || value === undefined || typeof value === "boolean") return true;
|
|
32
|
+
if (typeof value === "string") return value.trim().length === 0;
|
|
33
|
+
if (typeof value === "number") return false;
|
|
34
|
+
if (Array.isArray(value)) return value.every(slotPaintsNothing);
|
|
35
|
+
if (typeof value === "object") {
|
|
36
|
+
const vnode = value as { type?: unknown; children?: unknown };
|
|
37
|
+
if (vnode.type === Comment) return true;
|
|
38
|
+
if (vnode.type === Text) return slotPaintsNothing(vnode.children);
|
|
39
|
+
if (vnode.type === Fragment || Array.isArray(vnode.children)) {
|
|
40
|
+
return slotPaintsNothing(vnode.children);
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
// Symbol / bigint / function — nothing renders as a structural node.
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
5
48
|
/** One entry of a corner text lane: plain text, or a link when `href`
|
|
6
49
|
* is set (registry links open in a new tab with `noopener`, the same
|
|
7
50
|
* contract as the beian filings). */
|
|
@@ -102,7 +145,7 @@ export const HkCornerText = defineComponent({
|
|
|
102
145
|
),
|
|
103
146
|
);
|
|
104
147
|
const slotContent = slots.default?.();
|
|
105
|
-
const empty = entries.length === 0 &&
|
|
148
|
+
const empty = entries.length === 0 && slotPaintsNothing(slotContent);
|
|
106
149
|
if (empty) return null;
|
|
107
150
|
const Tag = props.as;
|
|
108
151
|
return (
|
|
@@ -611,14 +611,15 @@ describe("HkLoginFlow — stable shell channel swap (2026-11-24 user direction)"
|
|
|
611
611
|
expect(document.activeElement).toBe(trigger);
|
|
612
612
|
});
|
|
613
613
|
|
|
614
|
-
it("
|
|
615
|
-
// The
|
|
616
|
-
//
|
|
617
|
-
//
|
|
618
|
-
//
|
|
619
|
-
//
|
|
620
|
-
//
|
|
621
|
-
//
|
|
614
|
+
it("keeps the descendant :has arm that the flow's footer shape needs (structure pin)", () => {
|
|
615
|
+
// The shell's bare credential fragment renders the footer block inside
|
|
616
|
+
// the SWAPPED BODY, several levels below the shell's `.s-auth-form`
|
|
617
|
+
// (`.s-auth-form > .hk-login-flow-body > .hk-crossfade >
|
|
618
|
+
// .hk-crossfade-item > .s-auth-footer`). The sibling `:has(+ …)` rule
|
|
619
|
+
// above it therefore does NOT match this shape — this descendant arm
|
|
620
|
+
// is the only rule that does, so it is load-bearing, not a fallback.
|
|
621
|
+
// MUT:r1487-rhythm-descendant (reverting to sibling-only rules makes
|
|
622
|
+
// this match empty; the pin below then has nothing to assert).
|
|
622
623
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
623
624
|
const scss = readFileSync(join(here, "../styles/admin-tokens.scss"), "utf-8");
|
|
624
625
|
const collapse = scss.match(/\.s-auth-form:has\(\.s-auth-footer\)\s*{[^}]*}/g)?.join("\n") ?? "";
|
|
@@ -626,6 +627,29 @@ describe("HkLoginFlow — stable shell channel swap (2026-11-24 user direction)"
|
|
|
626
627
|
expect(collapse).toContain("padding-bottom: var(--space-8, 0.5rem)");
|
|
627
628
|
// The retired methods block's rules stay gone (2026-11-26 grammar).
|
|
628
629
|
expect(scss).not.toContain(".s-auth-methods");
|
|
630
|
+
|
|
631
|
+
// The DOM half — the reason the rule above exists, asserted against the
|
|
632
|
+
// REAL tree instead of a prose claim. jsdom has no CSS engine, so the
|
|
633
|
+
// pin is structural: it proves the footer is a descendant (and NOT a
|
|
634
|
+
// sibling) of the form, which is exactly what makes the sibling arm
|
|
635
|
+
// miss and the descendant arm the only working one. Behavioral
|
|
636
|
+
// confirmation in a real engine: Chrome 155 computed
|
|
637
|
+
// `padding-bottom: 8px` on this form via the descendant arm, and
|
|
638
|
+
// deleting that single rule from the sheet flipped it to 32px.
|
|
639
|
+
// MUT:r1487-footer-shape-drift (moving the footer out to sit beside
|
|
640
|
+
// the form — or wrapping the fragment so no `.s-auth-form` covers it —
|
|
641
|
+
// makes `matches` below flip and this goes red).
|
|
642
|
+
const c = mount(h(HkLoginFlow, {
|
|
643
|
+
modelValue: "cloud",
|
|
644
|
+
channels: [cloudChannel],
|
|
645
|
+
}, { footer: () => h("div", { class: "probe-footer" }, "row") }));
|
|
646
|
+
const form = c.querySelector(".s-auth-form");
|
|
647
|
+
const footer = c.querySelector(".s-auth-footer");
|
|
648
|
+
expect(form, "the flow's credentials body must carry the shell's form block").not.toBeNull();
|
|
649
|
+
expect(footer, "a passed footer must render its block").not.toBeNull();
|
|
650
|
+
expect(form!.contains(footer), "the footer must be a DESCENDANT of the form").toBe(true);
|
|
651
|
+
expect(footer!.previousElementSibling, "the footer must NOT be the form's sibling").not.toBe(form);
|
|
652
|
+
expect(form!.querySelector(".s-auth-footer")).toBe(footer);
|
|
629
653
|
});
|
|
630
654
|
|
|
631
655
|
it("renders no footer band when the host passed no footer slot (flow-level dead-space guard)", () => {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
import HkButton from "./HkButton";
|
|
28
28
|
import HkCopyBadge from "./HkCopyBadge";
|
|
29
29
|
import HkModal, { type ModalAction } from "./HkModal";
|
|
30
|
+
import HkSpinner from "./HkSpinner";
|
|
30
31
|
import HTabs, { type TabItem } from "./HkTabs";
|
|
31
32
|
import "./HkSolarLocationSetting.scss";
|
|
32
33
|
|
|
@@ -337,21 +338,37 @@ export const HkSolarLocationEditor = defineComponent({
|
|
|
337
338
|
</div>
|
|
338
339
|
</div>
|
|
339
340
|
))}
|
|
340
|
-
{probeStatus.value && (
|
|
341
|
-
|
|
341
|
+
{probeStatus.value && (probeStatus.value.kind === "probing" ? (
|
|
342
|
+
// In-flight probe (2026-11-26 user direction): the progress
|
|
343
|
+
// line was a text sentence, and a fast probe made it read as a
|
|
344
|
+
// flicker — a circle reads as "working" without the flicker.
|
|
345
|
+
// The COMPACT circle rides the status row: the centered
|
|
346
|
+
// placement contract (HkSpinner center) carries 1.5rem/1rem of
|
|
347
|
+
// padding and an 8rem-tall floor, which inside this one-line
|
|
348
|
+
// strip would inflate the dialog by several times the height
|
|
349
|
+
// of the text it replaces. The row centers it
|
|
350
|
+
// (.hk-solar-detected-status[data-state="probing"]), and the
|
|
351
|
+
// i18n probing line stays as the region's hidden announcement
|
|
352
|
+
// so screen readers still say what is happening. The failure
|
|
353
|
+
// state below keeps its visible copy: informative, not
|
|
354
|
+
// transient.
|
|
355
|
+
<div class="hk-solar-detected-status" data-state="probing" role="status" aria-live="polite">
|
|
356
|
+
<HkSpinner size="sm" />
|
|
357
|
+
<span class="hk-solar-detected-sr">{probeStatus.value.text}</span>
|
|
358
|
+
</div>
|
|
359
|
+
) : (
|
|
360
|
+
<div class="hk-solar-detected-status" data-state="failed">
|
|
342
361
|
<span>{probeStatus.value.text}</span>
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
</HkButton>
|
|
352
|
-
)}
|
|
362
|
+
<HkButton
|
|
363
|
+
size="sm"
|
|
364
|
+
variant="ghost"
|
|
365
|
+
class="hk-solar-detected-retry"
|
|
366
|
+
onClick={retryProbe}
|
|
367
|
+
>
|
|
368
|
+
{t("hikari::theme.solar.detectedRetry")}
|
|
369
|
+
</HkButton>
|
|
353
370
|
</div>
|
|
354
|
-
)}
|
|
371
|
+
))}
|
|
355
372
|
</div>
|
|
356
373
|
);
|
|
357
374
|
}
|
|
@@ -123,6 +123,12 @@
|
|
|
123
123
|
gap: var(--space-8, 0.5rem);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/* One readout line = label LEFT, value RIGHT (2026-11-26 user direction:
|
|
127
|
+
* a label followed by its value packed tight in the left half reads as
|
|
128
|
+
* ragged prose; the two-column readout wants the two ends). The label
|
|
129
|
+
* column is content-sized and the value column absorbs the rest, so every
|
|
130
|
+
* row ends at the same right edge. Long values stay inside their own
|
|
131
|
+
* column and soft-wrap there — they never push the left edge around. */
|
|
126
132
|
.hk-solar-detected-row {
|
|
127
133
|
display: grid;
|
|
128
134
|
grid-template-columns: max-content minmax(0, 1fr);
|
|
@@ -141,6 +147,7 @@
|
|
|
141
147
|
.hk-solar-detected-value {
|
|
142
148
|
display: flex;
|
|
143
149
|
flex-wrap: wrap;
|
|
150
|
+
justify-content: flex-end;
|
|
144
151
|
gap: var(--space-6, 0.375rem);
|
|
145
152
|
min-width: 0;
|
|
146
153
|
}
|
|
@@ -153,6 +160,10 @@
|
|
|
153
160
|
text-align: left;
|
|
154
161
|
}
|
|
155
162
|
|
|
163
|
+
/* A chip that has to wrap keeps its own text left-aligned (above) while
|
|
164
|
+
* the chip itself stays flush to the row's right edge — the readout's
|
|
165
|
+
* two-column contract holds even when one value needs two lines. */
|
|
166
|
+
|
|
156
167
|
/* Probe status line (IP pane): muted progress / failure note, with the
|
|
157
168
|
* retry affordance inline after the text. */
|
|
158
169
|
.hk-solar-detected-status {
|
|
@@ -168,6 +179,31 @@
|
|
|
168
179
|
flex-shrink: 0;
|
|
169
180
|
}
|
|
170
181
|
|
|
182
|
+
/* The probing row is ONE line: the compact circle sits centered in it
|
|
183
|
+
* (the label-less status strip carries no text of its own — the sentence
|
|
184
|
+
* rides the hidden announcement), and the circle takes the row's own
|
|
185
|
+
* height instead of the centered contract's padded box. */
|
|
186
|
+
.hk-solar-detected-status[data-state="probing"] {
|
|
187
|
+
justify-content: center;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* The probing state's status text, visually hidden but announced: the
|
|
191
|
+
visible grammar is the centered spinner (HkSpinner's center contract);
|
|
192
|
+
the region keeps its text content so screen readers have something to
|
|
193
|
+
say when it appears (same pattern as HkEmptyState's sr utility). */
|
|
194
|
+
.hk-solar-detected-sr {
|
|
195
|
+
position: absolute;
|
|
196
|
+
width: 1px;
|
|
197
|
+
height: 1px;
|
|
198
|
+
padding: 0;
|
|
199
|
+
margin: -1px;
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
clip: rect(0, 0, 0, 0);
|
|
202
|
+
clip-path: inset(50%);
|
|
203
|
+
white-space: nowrap;
|
|
204
|
+
border: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
171
207
|
.hk-solar-manual {
|
|
172
208
|
display: flex;
|
|
173
209
|
flex-direction: column;
|
|
@@ -33,6 +33,33 @@ function bodyOf(selector: string): string | null {
|
|
|
33
33
|
return m ? m[1] : null;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
describe("solar readout + probe-row layout contract", () => {
|
|
37
|
+
it("puts the readout label LEFT and its value flush RIGHT", () => {
|
|
38
|
+
// 2026-11-26 user direction: a label with its value packed tight after
|
|
39
|
+
// it reads as ragged prose — the two-column readout wants the two ends.
|
|
40
|
+
// MUT:solar-readout-ends: dropping the flex-end alignment (or the
|
|
41
|
+
// content-sized label column) brings the packed-left look back and
|
|
42
|
+
// goes red.
|
|
43
|
+
const value = bodyOf(".hk-solar-detected-value");
|
|
44
|
+
expect(value, "the value ruleset exists").not.toBeNull();
|
|
45
|
+
expect(value).toContain("justify-content: flex-end");
|
|
46
|
+
|
|
47
|
+
const row = bodyOf(".hk-solar-detected-row");
|
|
48
|
+
expect(row).toContain("grid-template-columns: max-content minmax(0, 1fr)");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("keeps the probing row a centered one-liner with a compact circle", () => {
|
|
52
|
+
// The centered placement contract carries padding + an 8rem floor;
|
|
53
|
+
// inside this one-line strip it would inflate the dialog, so the
|
|
54
|
+
// component renders the compact circle and the row centers it.
|
|
55
|
+
// MUT:solar-probe-spinner is pinned in the behaviour spec; this guards
|
|
56
|
+
// the sheet half (no padded box sneaks back in).
|
|
57
|
+
const probing = bodyOf('.hk-solar-detected-status[data-state="probing"]');
|
|
58
|
+
expect(probing, "the probing-row ruleset exists").not.toBeNull();
|
|
59
|
+
expect(probing).toContain("justify-content: center");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
36
63
|
describe("HkSolarLocationSetting row geometry", () => {
|
|
37
64
|
it("pins the row's cross size to the 28px action square", () => {
|
|
38
65
|
const row = bodyOf(".hk-solar-row");
|
|
@@ -548,6 +548,56 @@ describe("HkSolarLocationSetting editor", () => {
|
|
|
548
548
|
expect(detectedSection().querySelector(".hk-solar-detected-retry")).toBeTruthy();
|
|
549
549
|
});
|
|
550
550
|
|
|
551
|
+
it("an in-flight probe reads as a centered spinner, not a flashing sentence", async () => {
|
|
552
|
+
// 2026-11-26 user direction: the probing state was a text sentence, and
|
|
553
|
+
// a fast probe made it read as a flicker — the in-flight state renders
|
|
554
|
+
// the family's centered loading circle instead; the i18n probing line
|
|
555
|
+
// stays only as the status region's hidden announcement.
|
|
556
|
+
const container = mountSetting();
|
|
557
|
+
await openEditor(container);
|
|
558
|
+
resetSolarIpInsight();
|
|
559
|
+
// The probe's fetch holds behind a gate the test controls: the
|
|
560
|
+
// in-flight state stays up for the assertions, then releases into
|
|
561
|
+
// the failure path for the retry pin.
|
|
562
|
+
let releaseProbe!: () => void;
|
|
563
|
+
const gate = new Promise<void>((resolve) => { releaseProbe = resolve; });
|
|
564
|
+
vi.stubGlobal("fetch", vi.fn(async () => {
|
|
565
|
+
await gate;
|
|
566
|
+
return { ok: false };
|
|
567
|
+
}));
|
|
568
|
+
clickStrategy("ip");
|
|
569
|
+
await settle();
|
|
570
|
+
await vi.waitFor(() => {
|
|
571
|
+
expect(detectedSection().querySelector('[data-state="probing"]')).toBeTruthy();
|
|
572
|
+
});
|
|
573
|
+
const probing = detectedSection().querySelector('[data-state="probing"]')!;
|
|
574
|
+
// MUT:solar-probe-spinner: the region's children are EXACTLY the
|
|
575
|
+
// centered circle and the hidden announcement — re-introducing visible
|
|
576
|
+
// probing text adds a child and goes red, as does dropping the
|
|
577
|
+
// spinner. (The gate promise is wall-clock bounded by the engine's
|
|
578
|
+
// 4s fetch abort; the assertions run well inside it. The module-level
|
|
579
|
+
// ipProbeInflight resolves in this test's releaseProbe, so the
|
|
580
|
+
// next test's fresh mount cannot inherit an in-flight probe.)
|
|
581
|
+
// The compact circle (NOT the padded centered contract, which would
|
|
582
|
+
// inflate this one-line strip by several times the height of the text
|
|
583
|
+
// it replaces — R4 measured the padding trap).
|
|
584
|
+
expect(probing.querySelector(".hk-spinner")).toBeTruthy();
|
|
585
|
+
expect(probing.querySelector(".hk-spinner-sm")).toBeTruthy();
|
|
586
|
+
expect(probing.querySelector(".hk-spinner-centered")).toBeNull();
|
|
587
|
+
expect([...probing.children].map((child) => child.className)).toEqual([
|
|
588
|
+
expect.stringContaining("hk-spinner-wrapper"),
|
|
589
|
+
"hk-solar-detected-sr",
|
|
590
|
+
]);
|
|
591
|
+
// The status region keeps its announcement for screen readers.
|
|
592
|
+
expect(probing.querySelector(".hk-solar-detected-sr")?.textContent).toContain("Detecting");
|
|
593
|
+
expect(probing.getAttribute("role")).toBe("status");
|
|
594
|
+
releaseProbe();
|
|
595
|
+
await vi.waitFor(() => {
|
|
596
|
+
expect(detectedSection().querySelector('[data-state="failed"]')).toBeTruthy();
|
|
597
|
+
});
|
|
598
|
+
expect(detectedSection().querySelector(".hk-solar-detected-retry")).toBeTruthy();
|
|
599
|
+
});
|
|
600
|
+
|
|
551
601
|
it("switching strategies swaps the hint and reveals the manual pane", async () => {
|
|
552
602
|
const container = mountSetting();
|
|
553
603
|
await openEditor(container);
|
|
@@ -1371,16 +1371,20 @@
|
|
|
1371
1371
|
padding-bottom: var(--space-8, 0.5rem);
|
|
1372
1372
|
}
|
|
1373
1373
|
|
|
1374
|
-
/* The stable-shell shape (HkLoginFlow's bare sign-in fragment
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1374
|
+
/* The stable-shell shape (HkLoginFlow's bare sign-in fragment): the footer
|
|
1375
|
+
block rides INSIDE the swapped channel body, several levels below the
|
|
1376
|
+
shell's form block — `.s-auth-form > .hk-login-flow-body >
|
|
1377
|
+
.hk-crossfade > .hk-crossfade-item > .s-auth-footer` (measured in Chrome
|
|
1378
|
+
155 on the shipped components, 2026-11-26) — so the sibling rule above
|
|
1379
|
+
cannot see that shape and this descendant arm collapses the same
|
|
1380
|
+
padding. Both arms are load-bearing and neither is redundant: on the
|
|
1381
|
+
flow's credentials body the sibling arm does NOT match (the footer is
|
|
1382
|
+
not a sibling of the form) and this arm is the only one that does;
|
|
1383
|
+
deleting it puts the form's 32px bottom padding back under the footer.
|
|
1384
|
+
A card whose block IS a direct child already fires the sibling arm with
|
|
1385
|
+
the same value, so this arm changes nothing for it. Non-:has engines
|
|
1386
|
+
keep the full bottom padding in BOTH shapes — the sibling rule degrades
|
|
1387
|
+
the same way (spacing-only). */
|
|
1384
1388
|
.s-auth-form:has(.s-auth-footer) {
|
|
1385
1389
|
padding-bottom: var(--space-8, 0.5rem);
|
|
1386
1390
|
}
|