@gsa-tts/graymatter-ui 2.0.2 → 2.0.3
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 +7 -7
- package/src/utils/setupMocks.ts +33 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gsa-tts/graymatter-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
],
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
45
|
-
"@testing-library/jest-dom": "^
|
|
45
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
46
46
|
"@testing-library/svelte": "^5.4.2",
|
|
47
47
|
"@testing-library/user-event": "^14.6.7",
|
|
48
48
|
"@types/node": "^22.20.1",
|
|
49
49
|
"@uswds/compile": "1.3.2",
|
|
50
|
-
"@vitest/coverage-istanbul": "^
|
|
50
|
+
"@vitest/coverage-istanbul": "^5.0.0",
|
|
51
51
|
"eslint": "^9.39.5",
|
|
52
52
|
"gulp": "^5.0.0",
|
|
53
53
|
"svelte": "^5.57.0",
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
55
|
"vite": "^7.3.6",
|
|
56
|
-
"vitest": "^
|
|
56
|
+
"vitest": "^5.0.0",
|
|
57
57
|
"@gsa-tts/graymatter-eslint": "0.0.4",
|
|
58
|
-
"@gsa-tts/graymatter-typescript-config": "0.0.
|
|
59
|
-
"@gsa-tts/graymatter-vitest-config": "0.0.
|
|
58
|
+
"@gsa-tts/graymatter-typescript-config": "0.0.5",
|
|
59
|
+
"@gsa-tts/graymatter-vitest-config": "0.0.4"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@uswds/uswds": "3.14.0",
|
|
63
63
|
"uuid": "^14.0.1",
|
|
64
|
-
"@gsa-tts/graymatter-style-tokens": "0.
|
|
64
|
+
"@gsa-tts/graymatter-style-tokens": "2.0.3"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "gulp update",
|
package/src/utils/setupMocks.ts
CHANGED
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { vi } from 'vitest';
|
|
2
2
|
import { writable, derived } from 'svelte/store';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
// navigationStore.js mock. Vitest 5 requires vi.mock at the top level of a
|
|
5
|
+
// module, so it can no longer live inside setupCommonMocks().
|
|
6
|
+
//
|
|
7
|
+
// Note this mock does not currently take effect: vi.mock is hoisted only within
|
|
8
|
+
// *this* module, so it registers when this module is imported, which is after
|
|
9
|
+
// the importing test file has already resolved its own import of
|
|
10
|
+
// navigationStore.js. The four test files using this helper exercise the real
|
|
11
|
+
// store. Pre-existing behavior, kept as-is here; fixing it is tracked
|
|
12
|
+
// separately since it changes what those tests assert.
|
|
13
|
+
vi.mock('../stores/navigationStore.js', () => {
|
|
14
|
+
const isExpanded = writable(true);
|
|
15
|
+
const selectedItem = writable('console');
|
|
16
|
+
const selectedSubNavItemId = writable('');
|
|
17
|
+
const selectedSubNavItemTitle = writable('');
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
const isMenuButtonDisabled = derived(
|
|
20
|
+
selectedItem,
|
|
21
|
+
$selectedItem => $selectedItem === 'discover'
|
|
22
|
+
);
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
24
|
+
return {
|
|
25
|
+
isExpanded,
|
|
26
|
+
selectedItem,
|
|
27
|
+
isMenuButtonDisabled,
|
|
28
|
+
selectedSubNavItemId,
|
|
29
|
+
selectedSubNavItemTitle,
|
|
30
|
+
navigationStore: {
|
|
31
|
+
setSelectedItem: vi.fn(),
|
|
32
|
+
setExpanded: (val: boolean) => isExpanded.set(val),
|
|
33
|
+
toggleExpanded: () => isExpanded.update((expanded: boolean) => !expanded),
|
|
34
|
+
handleLayoutTransition: vi.fn(),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
});
|
|
32
38
|
|
|
39
|
+
export function setupCommonMocks() {
|
|
33
40
|
vi.stubGlobal(
|
|
34
41
|
'window',
|
|
35
42
|
Object.create(window, {
|