@happyvertical/smrt-ui 0.47.2 → 0.49.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.
@@ -0,0 +1,9 @@
1
+ # Issue #2769 test design
2
+
3
+ | Invariant | Evidence |
4
+ | --- | --- |
5
+ | Browser tests use the original Vitest JSDOM `Storage`, not Node's undefined host accessor | The persistent identity assertion and provider/script persistence, malformed-storage, and throwing-storage cases pass: 20 tests in `/tmp/smrt-2769-theme-tests-final.log`. The base behavior fails all 19 theme cases at `localStorage.clear` (`/tmp/smrt2768-ui-storage-repro.log`). |
6
+ | UI browser suite remains compatible | `pnpm --filter @happyvertical/smrt-ui test` passes 847 tests (`/tmp/smrt-2769-ui-test-final.log`). |
7
+
8
+ Actor: Vitest browser-test worker. Executor: supported Node runtime plus the
9
+ JSDOM realm. Transactions, SQL dialects, and external contracts: N/A.
@@ -10,6 +10,15 @@
10
10
  import '@testing-library/jest-dom/vitest';
11
11
  import { cleanup } from '@testing-library/svelte';
12
12
  import { afterEach } from 'vitest';
13
+ // Vitest leaves Node 26's host `localStorage` accessor on the test global.
14
+ // It is configurable but returns undefined without Node's storage-file flag.
15
+ // Vitest retains the original JSDOM instance at `globalThis.jsdom`.
16
+ const jsdomStorage = globalThis.jsdom.window.localStorage;
17
+ Object.defineProperty(globalThis, 'localStorage', {
18
+ configurable: true,
19
+ value: jsdomStorage,
20
+ writable: true,
21
+ });
13
22
  afterEach(() => {
14
23
  cleanup();
15
24
  });
@@ -24,6 +24,10 @@ describe('themeScript', () => {
24
24
  document.documentElement.removeAttribute('data-color-scheme');
25
25
  document.documentElement.classList.remove('dark');
26
26
  });
27
+ it("uses Vitest's original jsdom Storage rather than Node host storage", () => {
28
+ expect(localStorage).toBe(globalThis.jsdom
29
+ .window.localStorage);
30
+ });
27
31
  it('resolves system preference when nothing is stored', () => {
28
32
  mockSystemDark(true);
29
33
  run(themeScript({ preset: 'material' }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-ui",
3
- "version": "0.47.2",
3
+ "version": "0.49.0",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Domain-agnostic Svelte 5 UI runtime for SMRT: primitives, i18n client, theme system, and module UI registry",
6
6
  "type": "module",
@@ -129,7 +129,7 @@
129
129
  "access": "public"
130
130
  },
131
131
  "dependencies": {
132
- "@happyvertical/smrt-types": "0.47.2",
132
+ "@happyvertical/smrt-types": "0.49.0",
133
133
  "esm-env": "^1.2.2"
134
134
  },
135
135
  "peerDependencies": {