@celestia-island/hikari 0.45.6 → 0.45.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.45.6",
3
+ "version": "0.45.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari Vue 3 component library — production-grade UI components based on shittim-chest design system",
@@ -242,6 +242,14 @@
242
242
  gap: var(--space-8, 0.5rem);
243
243
  }
244
244
 
245
+ // One chip group (licenses / links). Must span the chips block — inside an
246
+ // `align-items: center` column a plain block would shrink to fit-content and
247
+ // a long chip list would then wrap against that collapsed width instead of
248
+ // the modal's.
249
+ .s-about-modal-links {
250
+ width: 100%;
251
+ }
252
+
245
253
  .s-about-modal-links-list {
246
254
  display: flex;
247
255
  flex-wrap: wrap;
@@ -0,0 +1,58 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ import { compile } from "sass";
6
+ import { describe, expect, it } from "vitest";
7
+
8
+ /**
9
+ * Compiled-stylesheet guard for HkAboutModal.
10
+ *
11
+ * Vitest stubs CSS (`test.css` is off), so the runtime suite can never catch
12
+ * a class the component emits that lost its rule — the #493 redesign dropped
13
+ * the `.s-about-modal-links` rule while keeping the element and every test
14
+ * stayed green. This test compiles the component sheet directly and asserts
15
+ * both directions of the class contract:
16
+ *
17
+ * 1. every `s-about-modal-*` class the TSX renders has a rule, and
18
+ * 2. every `s-about-modal-*` rule in the sheet is rendered by the TSX
19
+ * (no dead selectors).
20
+ */
21
+
22
+ const componentDir = resolve(dirname(fileURLToPath(import.meta.url)));
23
+
24
+ function classesFrom(source: string): Set<string> {
25
+ // The component only uses static class strings; collect them from the
26
+ // `class="…"` attributes plus any bare `s-about-modal-*` token.
27
+ const found = new Set<string>();
28
+ for (const match of source.matchAll(/s-about-modal[\w-]*/g)) found.add(match[0]);
29
+ return found;
30
+ }
31
+
32
+ describe("HkAboutModal stylesheet contract", () => {
33
+ const tsx = readFileSync(resolve(componentDir, "HkAboutModal.tsx"), "utf8");
34
+ const scss = readFileSync(resolve(componentDir, "HkAboutModal.scss"), "utf8");
35
+ const css = compile(resolve(componentDir, "HkAboutModal.scss"), {
36
+ style: "expanded",
37
+ }).css;
38
+
39
+ it("compiles without warnings", () => {
40
+ expect(css).toContain(".s-about-modal");
41
+ });
42
+
43
+ it("gives every emitted class a rule", () => {
44
+ // Selector-side scan of the compiled sheet (not the SCSS source): a rule
45
+ // that failed to compile would otherwise still count as "present".
46
+ const declared = new Set([...css.matchAll(/\.(s-about-modal[\w-]*)/g)].map((m) => m[1]!));
47
+ const missing = [...classesFrom(tsx)].filter((name) => !declared.has(name)).sort();
48
+ expect(missing, "classes rendered without a stylesheet rule").toEqual([]);
49
+ });
50
+
51
+ it("declares no rule the component never renders", () => {
52
+ const rendered = classesFrom(tsx);
53
+ const dead = [...new Set([...scss.matchAll(/\.(s-about-modal[\w-]*)/g)].map((m) => m[1]!))]
54
+ .filter((name) => !rendered.has(name))
55
+ .sort();
56
+ expect(dead, "stylesheet selectors with no matching element").toEqual([]);
57
+ });
58
+ });
@@ -151,6 +151,18 @@ describe("HkAboutModal branding", () => {
151
151
  );
152
152
  });
153
153
 
154
+ it("carries the caution tone through to the pill", async () => {
155
+ mountAbout({
156
+ componentVersions: [
157
+ { label: "云模型调度引擎版本", value: "0.1.26", meta: "预发", metaTone: "caution" },
158
+ ],
159
+ });
160
+ await flushModal();
161
+ expect(query<HTMLElement>(".s-about-modal-row-meta").getAttribute("data-tone")).toBe(
162
+ "caution",
163
+ );
164
+ });
165
+
154
166
  it("renders centered license chips", async () => {
155
167
  mountAbout({
156
168
  licenses: [