@shopify/shop-minis-react 0.17.1 → 0.17.2
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/mocks.ts +6 -0
- package/src/test-setup.ts +10 -0
package/package.json
CHANGED
package/src/mocks.ts
CHANGED
|
@@ -617,5 +617,11 @@ export const injectMocks = ({force}: {force?: boolean} = {}) => {
|
|
|
617
617
|
initialUrl: '/',
|
|
618
618
|
platform: 'web',
|
|
619
619
|
}
|
|
620
|
+
// Mock minisEvents so NavigationManager and event hooks work in dev
|
|
621
|
+
let listenerId = 0
|
|
622
|
+
window.minisEvents = {
|
|
623
|
+
on: () => ++listenerId,
|
|
624
|
+
off: () => {},
|
|
625
|
+
}
|
|
620
626
|
}
|
|
621
627
|
}
|
package/src/test-setup.ts
CHANGED
|
@@ -43,6 +43,16 @@ global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
|
43
43
|
disconnect: vi.fn(),
|
|
44
44
|
}))
|
|
45
45
|
|
|
46
|
+
// Mock window.minisEvents (used by NavigationManager)
|
|
47
|
+
let _testListenerId = 0
|
|
48
|
+
Object.defineProperty(window, 'minisEvents', {
|
|
49
|
+
writable: true,
|
|
50
|
+
value: {
|
|
51
|
+
on: () => ++_testListenerId,
|
|
52
|
+
off: () => {},
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
|
|
46
56
|
// Set default window size for virtuoso calculations
|
|
47
57
|
Object.defineProperty(window, 'innerHeight', {
|
|
48
58
|
writable: true,
|