@defra/interactive-map 0.0.30-alpha → 0.0.31-alpha

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.
Files changed (192) hide show
  1. package/dist/css/index.css +1 -1
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/esm/im-shell.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/context.md +4 -4
  7. package/docs/api.md +111 -37
  8. package/docs/assets/css/docusaurus.scss +20 -4
  9. package/docs/assets/images/basic-map.jpg +0 -0
  10. package/docs/assets/images/button-first.jpg +0 -0
  11. package/docs/assets/images/deuteranopia-ozs-map-thumb.jpg +0 -0
  12. package/docs/assets/images/draw.jpg +0 -0
  13. package/docs/assets/images/marker-panel.jpg +0 -0
  14. package/docs/assets/images/night-ozs-map-thumb.jpg +0 -0
  15. package/docs/assets/images/outdoor-ozs-map-thumb.jpg +0 -0
  16. package/docs/assets/images/search.jpg +0 -0
  17. package/docs/assets/images/select-feature.jpg +0 -0
  18. package/docs/assets/images/style-switcher.jpg +0 -0
  19. package/docs/assets/images/toggle-marker-label.jpg +0 -0
  20. package/docs/assets/images/tritanopia-ozs-map-thumb.jpg +0 -0
  21. package/docs/examples/add-marker-with-panel.mdx +2 -2
  22. package/docs/examples/basic-map.mdx +2 -2
  23. package/docs/examples/draw.mdx +271 -0
  24. package/docs/examples/index.mdx +58 -10
  25. package/docs/examples/search-control.mdx +71 -0
  26. package/docs/examples/select-feature.mdx +146 -0
  27. package/docs/examples/style-switcher.mdx +135 -0
  28. package/docs/examples/toggle-marker-label.mdx +3 -3
  29. package/docs/plugins/datasets.md +15 -28
  30. package/docusaurus.config.cjs +5 -1
  31. package/package.json +1 -1
  32. package/plugins/beta/datasets/dist/css/index.css +4 -0
  33. package/plugins/beta/datasets/dist/esm/im-datasets-ml-adapter.js +1 -0
  34. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
  35. package/plugins/beta/datasets/dist/esm/index.js +1 -1
  36. package/plugins/beta/datasets/dist/umd/im-datasets-ml-adapter.js +2 -0
  37. package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
  38. package/plugins/beta/datasets/dist/umd/index.js +2 -0
  39. package/plugins/beta/datasets/src/adapters/loadLayerAdapter.js +33 -0
  40. package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +44 -120
  41. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +145 -245
  42. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +516 -0
  43. package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +191 -0
  44. package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +441 -0
  45. package/plugins/beta/datasets/src/api/addDataset.js +2 -5
  46. package/plugins/beta/datasets/src/api/addDataset.test.js +16 -0
  47. package/plugins/beta/datasets/src/api/getOpacity.js +14 -14
  48. package/plugins/beta/datasets/src/api/getOpacity.test.js +72 -0
  49. package/plugins/beta/datasets/src/api/getStyle.js +8 -9
  50. package/plugins/beta/datasets/src/api/getStyle.test.js +42 -0
  51. package/plugins/beta/datasets/src/api/removeDataset.js +7 -7
  52. package/plugins/beta/datasets/src/api/removeDataset.test.js +45 -0
  53. package/plugins/beta/datasets/src/api/setData.js +9 -3
  54. package/plugins/beta/datasets/src/api/setData.test.js +62 -0
  55. package/plugins/beta/datasets/src/api/setDatasetVisibility.js +5 -30
  56. package/plugins/beta/datasets/src/api/setDatasetVisibility.test.js +31 -0
  57. package/plugins/beta/datasets/src/api/setFeatureVisibility.js +3 -21
  58. package/plugins/beta/datasets/src/api/setFeatureVisibility.test.js +32 -0
  59. package/plugins/beta/datasets/src/api/setGlobals.js +20 -0
  60. package/plugins/beta/datasets/src/api/setGlobals.test.js +63 -0
  61. package/plugins/beta/datasets/src/api/setOpacity.js +8 -27
  62. package/plugins/beta/datasets/src/api/setOpacity.test.js +31 -0
  63. package/plugins/beta/datasets/src/api/setStyle.js +5 -21
  64. package/plugins/beta/datasets/src/api/setStyle.test.js +53 -0
  65. package/plugins/beta/datasets/src/components/Key/Key.jsx +51 -0
  66. package/plugins/beta/datasets/src/components/Key/KeyGroupItem.jsx +18 -0
  67. package/plugins/beta/datasets/src/components/Key/KeyItem.jsx +20 -0
  68. package/plugins/beta/datasets/src/components/Key/KeySvg.jsx +22 -0
  69. package/plugins/beta/datasets/src/components/Key/KeySvg.test.jsx +87 -0
  70. package/plugins/beta/datasets/src/components/Key/KeySvgLine.jsx +19 -0
  71. package/plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx +71 -0
  72. package/plugins/beta/datasets/src/components/{KeySvgPattern.jsx → Key/KeySvgPattern.jsx} +3 -4
  73. package/plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx +55 -0
  74. package/plugins/beta/datasets/src/components/Key/KeySvgRect.jsx +22 -0
  75. package/plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx +85 -0
  76. package/plugins/beta/datasets/src/components/{KeySvgSymbol.jsx → Key/KeySvgSymbol.jsx} +5 -5
  77. package/plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx +80 -0
  78. package/plugins/beta/datasets/src/components/Key/svgProperties.test.js +61 -0
  79. package/plugins/beta/datasets/src/{panels → components/LayersMenu}/Layers.module.scss +4 -0
  80. package/plugins/beta/datasets/src/components/LayersMenu/LayersMenu.jsx +33 -0
  81. package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +31 -0
  82. package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx +19 -0
  83. package/plugins/beta/datasets/src/datasets.scss +2 -2
  84. package/plugins/beta/datasets/src/fetch/createDynamicSource.js +8 -8
  85. package/plugins/beta/datasets/src/{DatasetsInit.jsx → initialise/DatasetsInit.jsx} +19 -21
  86. package/plugins/beta/datasets/src/{defaults.js → initialise/defaults.js} +17 -2
  87. package/plugins/beta/datasets/src/initialise/defaults.test.js +127 -0
  88. package/plugins/beta/datasets/src/{datasets.js → initialise/initialiseDatasets.js} +30 -26
  89. package/plugins/beta/datasets/src/initialise/initialiseDatasets.test.js +273 -0
  90. package/plugins/beta/datasets/src/manifest.js +8 -6
  91. package/plugins/beta/datasets/src/reducers/__data__/demoDatasets.js +253 -0
  92. package/plugins/beta/datasets/src/reducers/datasetsToMenu.js +78 -0
  93. package/plugins/beta/datasets/src/reducers/datasetsToMenu.test.js +35 -0
  94. package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.js +34 -0
  95. package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.test.js +117 -0
  96. package/plugins/beta/datasets/src/reducers/pluginState.js +206 -0
  97. package/plugins/beta/datasets/src/reducers/pluginState.test.js +386 -0
  98. package/plugins/beta/datasets/src/registry/__mocks__/datasetRegistry.js +29 -0
  99. package/plugins/beta/datasets/src/registry/createDataset.js +5 -0
  100. package/plugins/beta/datasets/src/registry/dataset.js +172 -0
  101. package/plugins/beta/datasets/src/registry/dataset.test.js +483 -0
  102. package/plugins/beta/datasets/src/registry/datasetDefinitionCache.js +35 -0
  103. package/plugins/beta/datasets/src/registry/datasetRegistry.js +116 -0
  104. package/plugins/beta/datasets/src/registry/datasetRegistry.test.js +335 -0
  105. package/plugins/beta/datasets/src/registry/dynamicGeoJson.js +17 -0
  106. package/plugins/beta/datasets/src/registry/globalDataset.js +36 -0
  107. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
  108. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
  109. package/plugins/beta/draw-ml/src/events.js +13 -1
  110. package/plugins/beta/draw-ml/src/index.js +1 -1
  111. package/plugins/beta/draw-ml/src/manifest.js +3 -0
  112. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  113. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  114. package/plugins/interact/src/InteractInit.jsx +2 -2
  115. package/plugins/interact/src/InteractInit.test.js +1 -1
  116. package/plugins/interact/src/events.js +2 -29
  117. package/plugins/interact/src/events.test.js +4 -102
  118. package/plugins/interact/src/hooks/useAttachEvents.js +3 -4
  119. package/plugins/interact/src/hooks/useAttachEvents.test.js +1 -3
  120. package/plugins/interact/src/hooks/useInteractionHandlers.js +10 -1
  121. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +23 -4
  122. package/plugins/interact/src/manifest.js +0 -35
  123. package/plugins/interact/src/manifest.test.js +3 -43
  124. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  125. package/providers/beta/esri/src/esriProvider.js +4 -0
  126. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  127. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  128. package/providers/beta/openlayers/src/openlayersProvider.js +4 -0
  129. package/providers/beta/openlayers/src/openlayersProvider.test.js +5 -0
  130. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  131. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  132. package/providers/maplibre/src/maplibreProvider.js +6 -4
  133. package/providers/maplibre/src/maplibreProvider.test.js +5 -0
  134. package/providers/maplibre/src/utils/highlightFeatures.js +74 -25
  135. package/providers/maplibre/src/utils/highlightFeatures.test.js +132 -0
  136. package/providers/maplibre/src/utils/patternImages.js +2 -4
  137. package/providers/maplibre/src/utils/symbolImages.js +1 -4
  138. package/rollup.esm.mjs +2 -8
  139. package/src/App/components/MapButton/MapButton.jsx +16 -1
  140. package/src/App/components/MapButton/MapButton.module.scss +12 -1
  141. package/src/App/components/MapButton/MapButton.test.jsx +40 -1
  142. package/src/App/hooks/useContinueEnabledEvaluator.js +31 -0
  143. package/src/App/hooks/useContinueEnabledEvaluator.test.js +118 -0
  144. package/src/App/hooks/useEvaluateProp.js +15 -15
  145. package/src/App/hooks/useEvaluateProp.test.js +80 -76
  146. package/src/App/hooks/useLayoutMeasurements.js +1 -3
  147. package/src/App/hooks/useResizeObserver.js +12 -1
  148. package/src/App/hooks/useResizeObserver.test.js +1 -0
  149. package/src/App/renderer/PluginInits.jsx +2 -0
  150. package/src/App/renderer/mapButtons.js +21 -1
  151. package/src/App/renderer/mapButtons.test.js +46 -1
  152. package/src/App/store/appReducer.js +1 -1
  153. package/src/App/store/appReducer.test.js +37 -0
  154. package/src/InteractiveMap/InteractiveMap.js +10 -0
  155. package/src/InteractiveMap/InteractiveMap.test.js +8 -0
  156. package/src/config/appConfig.js +25 -0
  157. package/src/config/appConfig.test.js +50 -0
  158. package/src/config/defaults.js +1 -0
  159. package/src/scss/settings/_dimensions.scss +1 -0
  160. package/src/services/patternRegistry.js +8 -4
  161. package/src/types.js +7 -0
  162. package/src/utils/patternUtils.js +1 -2
  163. package/src/utils/patternUtils.test.js +9 -0
  164. package/webpack.dev.mjs +10 -0
  165. package/webpack.umd.mjs +1 -1
  166. package/plugins/beta/datasets/dist/adapters/maplibre/esm/im-datasets-ml-adapter.js +0 -1
  167. package/plugins/beta/datasets/dist/adapters/maplibre/esm/index.js +0 -1
  168. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-maplibre-adapter.js +0 -2
  169. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-plugin.js +0 -2
  170. package/plugins/beta/datasets/dist/umd/maplibre/index.js +0 -2
  171. package/plugins/beta/datasets/src/adapters/maplibre/index.js +0 -18
  172. package/plugins/beta/datasets/src/adapters/maplibre/layerIds.js +0 -75
  173. package/plugins/beta/datasets/src/adapters/maplibre/patternImages.js +0 -27
  174. package/plugins/beta/datasets/src/adapters/maplibre/symbolImages.js +0 -31
  175. package/plugins/beta/datasets/src/components/KeySvg.jsx +0 -24
  176. package/plugins/beta/datasets/src/components/KeySvgLine.jsx +0 -19
  177. package/plugins/beta/datasets/src/components/KeySvgRect.jsx +0 -22
  178. package/plugins/beta/datasets/src/index.maplibre.umd.js +0 -23
  179. package/plugins/beta/datasets/src/panels/Key.jsx +0 -62
  180. package/plugins/beta/datasets/src/panels/Layers.jsx +0 -141
  181. package/plugins/beta/datasets/src/reducer.js +0 -219
  182. package/plugins/beta/datasets/src/reducers/keyReducer.js +0 -34
  183. package/plugins/beta/datasets/src/utils/filters.js +0 -34
  184. package/plugins/beta/datasets/src/utils/mergeSublayer.js +0 -86
  185. package/plugins/beta/draw-ml/dist/css/index.css +0 -21
  186. /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-maplibre-adapter.js.LICENSE.txt → im-datasets-ml-adapter.js.LICENSE.txt} +0 -0
  187. /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-plugin.js.LICENSE.txt → im-datasets-plugin.js.LICENSE.txt} +0 -0
  188. /package/plugins/beta/datasets/dist/umd/{maplibre/index.js.LICENSE.txt → index.js.LICENSE.txt} +0 -0
  189. /package/plugins/beta/datasets/src/components/{EmptyKey.jsx → Key/EmptyKey.jsx} +0 -0
  190. /package/plugins/beta/datasets/src/components/{EmptyKey.test.jsx → Key/EmptyKey.test.jsx} +0 -0
  191. /package/plugins/beta/datasets/src/{panels → components/Key}/Key.module.scss +0 -0
  192. /package/plugins/beta/datasets/src/components/{svgProperties.js → Key/svgProperties.js} +0 -0
@@ -8,57 +8,50 @@ import * as serviceStore from '../store/serviceContext.js'
8
8
  import { PluginContext } from '../store/PluginProvider.jsx'
9
9
  import * as iconRegistryModule from '../registry/iconRegistry.js'
10
10
 
11
- // --- Mock the dependencies ---
12
11
  jest.mock('../store/configContext.js', () => ({ useConfig: jest.fn() }))
13
12
  jest.mock('../store/appContext.js', () => ({ useApp: jest.fn() }))
14
13
  jest.mock('../store/mapContext.js', () => ({ useMap: jest.fn() }))
15
14
  jest.mock('../store/serviceContext.js', () => ({ useService: jest.fn() }))
16
15
  jest.mock('../registry/iconRegistry.js', () => ({ getIconRegistry: jest.fn() }))
17
16
 
18
- describe('useEvaluateProp hook', () => {
19
- const pluginDispatch = jest.fn()
20
- const mockPluginRegistry = {
21
- registeredPlugins: [],
22
- registerPlugin: jest.fn(),
23
- clear: jest.fn()
24
- }
25
-
26
- const pluginContextValue = {
27
- state: { myPlugin: { foo: 'bar' } },
28
- dispatch: pluginDispatch
29
- }
30
-
31
- beforeEach(() => {
32
- jest.clearAllMocks()
33
- mockPluginRegistry.registeredPlugins = []
34
- configStore.useConfig.mockReturnValue({
35
- mapProvider: { name: 'leaflet' },
36
- pluginRegistry: mockPluginRegistry
37
- })
38
- appStore.useApp.mockReturnValue({ user: 'alice' })
39
- mapStore.useMap.mockReturnValue({ zoom: 5 })
40
- serviceStore.useService.mockReturnValue({ reverseGeocode: jest.fn() })
41
- iconRegistryModule.getIconRegistry.mockReturnValue({ close: '<svg/>' })
42
- })
17
+ const RAW_VALUE = 'raw-test-value'
18
+ const pluginDispatch = jest.fn()
19
+ const pluginContextValue = {
20
+ state: { myPlugin: { foo: 'bar' } },
21
+ dispatch: pluginDispatch
22
+ }
23
+ const mockPluginRegistry = {
24
+ registeredPlugins: [],
25
+ registerPlugin: jest.fn(),
26
+ clear: jest.fn()
27
+ }
28
+
29
+ const withPluginContext = ({ children }) => (
30
+ <PluginContext.Provider value={pluginContextValue}>
31
+ {children}
32
+ </PluginContext.Provider>
33
+ )
34
+
35
+ beforeEach(() => {
36
+ jest.clearAllMocks()
37
+ mockPluginRegistry.registeredPlugins = []
38
+ configStore.useConfig.mockReturnValue({ mapProvider: { name: 'leaflet' }, pluginRegistry: mockPluginRegistry })
39
+ appStore.useApp.mockReturnValue({ user: 'alice' })
40
+ mapStore.useMap.mockReturnValue({ zoom: 5 })
41
+ serviceStore.useService.mockReturnValue({ reverseGeocode: jest.fn() })
42
+ iconRegistryModule.getIconRegistry.mockReturnValue({ close: '<svg/>' })
43
+ })
43
44
 
45
+ describe('useEvaluateProp — basic evaluation', () => {
44
46
  it('returns the raw prop if it is not a function', () => {
45
47
  const { result } = renderHook(() => useEvaluateProp())
46
- const evaluate = result.current
47
- const value = evaluate(42)
48
- expect(value).toBe(42)
48
+ expect(result.current(RAW_VALUE)).toBe(RAW_VALUE)
49
49
  })
50
50
 
51
51
  it('calls prop function with full context when no pluginId provided', () => {
52
52
  const { result } = renderHook(() => useEvaluateProp())
53
- const evaluate = result.current
54
-
55
53
  const fn = jest.fn(ctx => ctx.appState.user)
56
-
57
- const value = evaluate(fn)
58
-
59
- expect(fn).toHaveBeenCalled()
60
- expect(value).toBe('alice')
61
-
54
+ expect(result.current(fn)).toBe('alice')
62
55
  expect(fn.mock.calls[0][0]).toMatchObject({
63
56
  appConfig: { mapProvider: { name: 'leaflet' } },
64
57
  appState: { user: 'alice' },
@@ -69,56 +62,67 @@ describe('useEvaluateProp hook', () => {
69
62
  })
70
63
  })
71
64
 
72
- it('includes pluginConfig and pluginState when pluginId provided', () => {
73
- mockPluginRegistry.registeredPlugins.push({ id: 'myPlugin', config: { includeModes: ['edit'], excludeModes: ['view'] } })
65
+ it('exposes ctx property on the returned evaluateProp function', () => {
66
+ const { result } = renderHook(() => useEvaluateProp())
67
+ expect(result.current.ctx).toMatchObject({
68
+ appConfig: { mapProvider: { name: 'leaflet' } },
69
+ appState: { user: 'alice' },
70
+ mapState: { zoom: 5 },
71
+ services: { reverseGeocode: expect.any(Function) },
72
+ mapProvider: { name: 'leaflet' },
73
+ iconRegistry: { close: '<svg/>' }
74
+ })
75
+ })
76
+ })
74
77
 
75
- const wrapper = ({ children }) => (
76
- <PluginContext.Provider value={pluginContextValue}>
77
- {children}
78
- </PluginContext.Provider>
79
- )
78
+ describe('useEvaluateProp pluginStates (core/framework buttons)', () => {
79
+ it('includes pluginStates in context when no pluginId provided', () => {
80
+ const { result } = renderHook(() => useEvaluateProp(), { wrapper: withPluginContext })
81
+ expect(result.current(ctx => ctx.pluginStates)).toEqual({ myPlugin: { foo: 'bar' } })
82
+ })
80
83
 
81
- const { result } = renderHook(() => useEvaluateProp(), { wrapper })
82
- const evaluate = result.current
84
+ it('includes pluginStates for appConfig plugin (no reducer, not in state)', () => {
85
+ mockPluginRegistry.registeredPlugins.push({ id: 'appConfig', config: {} })
86
+ const { result } = renderHook(() => useEvaluateProp(), { wrapper: withPluginContext })
87
+ expect(result.current(ctx => ctx.pluginStates, 'appConfig')).toEqual({ myPlugin: { foo: 'bar' } })
88
+ })
83
89
 
84
- const fn = jest.fn(ctx => ctx.pluginState.foo)
85
- const value = evaluate(fn, 'myPlugin')
90
+ it('falls back to empty pluginStates when PluginContext is not provided', () => {
91
+ mockPluginRegistry.registeredPlugins.push({ id: 'appConfig', config: {} })
92
+ const { result } = renderHook(() => useEvaluateProp())
93
+ expect(result.current(ctx => ctx.pluginStates, 'appConfig')).toEqual({})
94
+ })
95
+ })
86
96
 
87
- expect(fn).toHaveBeenCalled()
88
- expect(value).toBe('bar')
89
- const ctxPassed = fn.mock.calls[0][0]
90
- expect(ctxPassed.pluginConfig).toEqual({
91
- pluginId: 'myPlugin',
92
- includeModes: ['edit'],
93
- excludeModes: ['view']
94
- })
95
- expect(ctxPassed.pluginState).toMatchObject({ foo: 'bar', dispatch: pluginDispatch })
97
+ describe('useEvaluateProp — plugin state isolation', () => {
98
+ it('includes pluginConfig and pluginState for real plugin buttons', () => {
99
+ mockPluginRegistry.registeredPlugins.push({ id: 'myPlugin', config: { includeModes: ['edit'], excludeModes: ['view'] } })
100
+ const { result } = renderHook(() => useEvaluateProp(), { wrapper: withPluginContext })
101
+ const ctx = result.current(c => c, 'myPlugin')
102
+ expect(ctx.pluginConfig).toEqual({ pluginId: 'myPlugin', includeModes: ['edit'], excludeModes: ['view'] })
103
+ expect(ctx.pluginState).toMatchObject({ foo: 'bar', dispatch: pluginDispatch })
104
+ })
105
+
106
+ it('does not include pluginStates for real plugin buttons', () => {
107
+ mockPluginRegistry.registeredPlugins.push({ id: 'myPlugin', config: {} })
108
+ const { result } = renderHook(() => useEvaluateProp(), { wrapper: withPluginContext })
109
+ expect(result.current(ctx => ctx.pluginStates, 'myPlugin')).toBeUndefined()
96
110
  })
97
111
 
98
112
  it('returns empty pluginConfig if plugin not registered', () => {
113
+ const { result } = renderHook(() => useEvaluateProp(), { wrapper: withPluginContext })
114
+ expect(result.current(ctx => ctx.pluginConfig, 'unknownPlugin')).toEqual({})
115
+ })
116
+
117
+ it('falls back to empty object when plugin state entry is null', () => {
118
+ mockPluginRegistry.registeredPlugins.push({ id: 'myPlugin', config: {} })
99
119
  const wrapper = ({ children }) => (
100
- <PluginContext.Provider value={pluginContextValue}>
120
+ <PluginContext.Provider value={{ state: { myPlugin: null }, dispatch: pluginDispatch }}>
101
121
  {children}
102
122
  </PluginContext.Provider>
103
123
  )
104
124
  const { result } = renderHook(() => useEvaluateProp(), { wrapper })
105
- const evaluate = result.current
106
-
107
- const fn = jest.fn(ctx => ctx.pluginConfig)
108
- const value = evaluate(fn, 'unknownPlugin')
109
- expect(value).toEqual({})
110
- })
111
-
112
- it('exposes ctx property on the returned evaluateProp function', () => {
113
- const { result } = renderHook(() => useEvaluateProp())
114
- const evaluate = result.current
115
- expect(evaluate.ctx).toMatchObject({
116
- appConfig: { mapProvider: { name: 'leaflet' } },
117
- appState: { user: 'alice' },
118
- mapState: { zoom: 5 },
119
- services: { reverseGeocode: expect.any(Function) },
120
- mapProvider: { name: 'leaflet' },
121
- iconRegistry: { close: '<svg/>' }
122
- })
125
+ const ctx = result.current(c => c, 'myPlugin')
126
+ expect(ctx.pluginState).toMatchObject({ dispatch: pluginDispatch })
123
127
  })
124
128
  })
@@ -154,8 +154,6 @@ export function useLayoutMeasurements () {
154
154
  // that is Effect 2's responsibility.
155
155
  // --------------------------------
156
156
  useResizeObserver([bannerRef, mainRef, topRef, topLeftColRef, topRightColRef, actionsRef, bottomRef, bottomRightRef, leftTopRef, leftBottomRef, rightTopRef, rightBottomRef, drawerRef], () => {
157
- requestAnimationFrame(() => {
158
- calculateLayout(layoutRefs)
159
- })
157
+ calculateLayout(layoutRefs)
160
158
  })
161
159
  }
@@ -13,6 +13,8 @@ export function useResizeObserver (targetRefs, callback) {
13
13
  }
14
14
 
15
15
  const observer = new window.ResizeObserver(entries => {
16
+ const changedEntries = []
17
+
16
18
  for (const entry of entries) {
17
19
  const { width, height } = entry.contentRect
18
20
  const prev = prevSizes.current.get(entry.target) || {}
@@ -22,8 +24,17 @@ export function useResizeObserver (targetRefs, callback) {
22
24
  }
23
25
 
24
26
  prevSizes.current.set(entry.target, { width, height })
27
+ changedEntries.push(entry)
28
+ }
25
29
 
26
- callback(entry)
30
+ if (changedEntries.length) {
31
+ // Batch all entries into a single RAF — prevents multiple simultaneous
32
+ // resize events (e.g. panel open) from queueing separate callbacks and
33
+ // causing a ResizeObserver loop under synchronous renderers like preact.
34
+ cancelAnimationFrame(frameRef.current)
35
+ frameRef.current = requestAnimationFrame(() => {
36
+ for (const entry of changedEntries) { callback(entry) }
37
+ })
27
38
  }
28
39
  })
29
40
 
@@ -26,6 +26,7 @@ describe('useResizeObserver', () => {
26
26
  this.trigger = (entries) => cb(entries) // helper to simulate resize
27
27
  })
28
28
 
29
+ jest.spyOn(global, 'requestAnimationFrame').mockImplementation(cb => { cb(); return 0 })
29
30
  jest.spyOn(global, 'cancelAnimationFrame').mockImplementation(() => {})
30
31
  })
31
32
 
@@ -7,6 +7,7 @@ import { useApp } from '../store/appContext.js'
7
7
  import { useConfig } from '../store/configContext.js'
8
8
  import { useEvaluateProp } from '../hooks/useEvaluateProp.js'
9
9
  import { useButtonStateEvaluator } from '../hooks/useButtonStateEvaluator.js'
10
+ import { useContinueEnabledEvaluator } from '../hooks/useContinueEnabledEvaluator.js'
10
11
 
11
12
  // Create a component for each plugin to handle its hooks properly
12
13
  const PluginInit = ({ plugin, mode }) => {
@@ -55,6 +56,7 @@ export const PluginInits = () => {
55
56
  // Evaluate reactive button states globally
56
57
  const evaluateProp = useEvaluateProp()
57
58
  useButtonStateEvaluator(evaluateProp)
59
+ useContinueEnabledEvaluator()
58
60
 
59
61
  return (
60
62
  <>
@@ -116,6 +116,24 @@ function resolveGroupOrder (group) {
116
116
  return group.order ?? 0
117
117
  }
118
118
 
119
+ function applySlotExclusivity (matching, appState) {
120
+ let exclusivePluginId = null
121
+
122
+ for (const [id, config] of matching) {
123
+ if (config.exclusiveSlot && !appState.hiddenButtons.has(id) && config.pluginId) {
124
+ if (exclusivePluginId !== null && exclusivePluginId !== config.pluginId) {
125
+ logger.warn(`Slot exclusivity conflict: plugins [${exclusivePluginId}, ${config.pluginId}] are both claiming exclusive slot ownership. Showing all buttons.`)
126
+ return matching
127
+ }
128
+ exclusivePluginId = config.pluginId
129
+ }
130
+ }
131
+
132
+ if (exclusivePluginId === null) { return matching }
133
+
134
+ return matching.filter(([_, config]) => config.pluginId === exclusivePluginId)
135
+ }
136
+
119
137
  function renderButton ({ btn, appState, appConfig, evaluateProp }) {
120
138
  const [buttonId, config] = btn
121
139
  const bpConfig = config[appState.breakpoint] ?? {}
@@ -148,7 +166,8 @@ function renderButton ({ btn, appState, appConfig, evaluateProp }) {
148
166
  function mapButtons ({ slot, appState, appConfig, evaluateProp }) {
149
167
  const { buttonConfig, breakpoint } = appState
150
168
 
151
- const matching = getMatchingButtons({ appState, appConfig, buttonConfig, slot, evaluateProp })
169
+ const raw = getMatchingButtons({ appState, appConfig, buttonConfig, slot, evaluateProp })
170
+ const matching = applySlotExclusivity(raw, appState)
152
171
 
153
172
  if (!matching.length) {
154
173
  return []
@@ -243,6 +262,7 @@ function mapButtons ({ slot, appState, appConfig, evaluateProp }) {
243
262
  export {
244
263
  mapButtons,
245
264
  getMatchingButtons,
265
+ applySlotExclusivity,
246
266
  renderButton,
247
267
  resolveGroupName,
248
268
  resolveGroupLabel,
@@ -1,7 +1,9 @@
1
1
  import React from 'react'
2
- import { mapButtons, getMatchingButtons, renderButton, resolveGroupName, resolveGroupLabel, resolveGroupOrder } from './mapButtons.js'
2
+ import { mapButtons, getMatchingButtons, applySlotExclusivity, renderButton, resolveGroupName, resolveGroupLabel, resolveGroupOrder } from './mapButtons.js'
3
+ import { logger } from '../../services/logger.js'
3
4
  import { getPanelConfig } from '../registry/panelRegistry.js'
4
5
 
6
+ jest.mock('../../services/logger.js', () => ({ logger: { warn: jest.fn() } }))
5
7
  jest.mock('../registry/buttonRegistry.js')
6
8
  jest.mock('../registry/panelRegistry.js')
7
9
  jest.mock('../components/MapButton/MapButton.jsx', () => ({
@@ -350,6 +352,49 @@ describe('mapButtons module', () => {
350
352
  expect(map()[0].order).toBe(0)
351
353
  })
352
354
 
355
+ it('filters to exclusive plugin when one plugin has a visible exclusiveSlot button', () => {
356
+ appState.buttonConfig = {
357
+ drawCancel: { ...baseBtn, pluginId: 'draw', exclusiveSlot: true },
358
+ journeyBack: { ...baseBtn }
359
+ }
360
+ const matching = [['drawCancel', appState.buttonConfig.drawCancel], ['journeyBack', appState.buttonConfig.journeyBack]]
361
+ const result = applySlotExclusivity(matching, appState)
362
+ expect(result).toHaveLength(1)
363
+ expect(result[0][0]).toBe('drawCancel')
364
+ })
365
+
366
+ it('returns all buttons when no exclusiveSlot buttons are visible', () => {
367
+ appState.buttonConfig = {
368
+ drawCancel: { ...baseBtn, pluginId: 'draw', exclusiveSlot: true },
369
+ journeyBack: { ...baseBtn }
370
+ }
371
+ appState.hiddenButtons = new Set(['drawCancel'])
372
+ const matching = [['drawCancel', appState.buttonConfig.drawCancel], ['journeyBack', appState.buttonConfig.journeyBack]]
373
+ const result = applySlotExclusivity(matching, appState)
374
+ expect(result).toHaveLength(2)
375
+ })
376
+
377
+ it('returns all buttons when no buttons have exclusiveSlot', () => {
378
+ const matching = [['b1', { ...baseBtn }], ['b2', { ...baseBtn }]]
379
+ expect(applySlotExclusivity(matching, appState)).toHaveLength(2)
380
+ })
381
+
382
+ it('ignores exclusiveSlot on buttons without a pluginId', () => {
383
+ const matching = [['hostBtn', { ...baseBtn, exclusiveSlot: true }]]
384
+ expect(applySlotExclusivity(matching, appState)).toHaveLength(1)
385
+ })
386
+
387
+ it('warns and returns all when multiple plugins claim exclusivity', () => {
388
+ const matching = [
389
+ ['drawCancel', { ...baseBtn, pluginId: 'draw', exclusiveSlot: true }],
390
+ ['otherBtn', { ...baseBtn, pluginId: 'other', exclusiveSlot: true }]
391
+ ]
392
+ const result = applySlotExclusivity(matching, appState)
393
+ expect(result).toHaveLength(2)
394
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('draw'))
395
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('other'))
396
+ })
397
+
353
398
  it('excludes menu items from slot rendering even when they have a matching slot', () => {
354
399
  appState.buttonConfig = ({
355
400
  parent: baseBtn,
@@ -40,7 +40,7 @@ export const initialState = (config) => {
40
40
  mode: mode || null,
41
41
  previousMode: null,
42
42
  safeZoneInset: null,
43
- disabledButtons: new Set(),
43
+ disabledButtons: config.backAndContinue?.continueLabel ? new Set(['journeyContinue']) : new Set(),
44
44
  hiddenButtons: new Set(),
45
45
  pressedButtons: new Set(),
46
46
  expandedButtons: new Set(),
@@ -70,6 +70,43 @@ describe('initialState', () => {
70
70
  expect(result.prefersReducedMotion).toBe(false)
71
71
  })
72
72
 
73
+ test('pre-disables journeyContinue when backAndContinue has a continueLabel', () => {
74
+ mockMedia()
75
+ mockPanels({})
76
+ mockFullscreen(false)
77
+
78
+ const config = {
79
+ behaviour: 'buttonFirst',
80
+ initialBreakpoint: 'md',
81
+ initialInterfaceType: 'desktop',
82
+ appColorScheme: 'light',
83
+ autoColorScheme: false,
84
+ backAndContinue: { continueLabel: 'Continue' },
85
+ ...createMockRegistries()
86
+ }
87
+
88
+ const result = initialState(config)
89
+ expect(result.disabledButtons.has('journeyContinue')).toBe(true)
90
+ })
91
+
92
+ test('does not pre-disable journeyContinue when backAndContinue is null', () => {
93
+ mockMedia()
94
+ mockPanels({})
95
+ mockFullscreen(false)
96
+
97
+ const config = {
98
+ behaviour: 'buttonFirst',
99
+ initialBreakpoint: 'md',
100
+ initialInterfaceType: 'desktop',
101
+ appColorScheme: 'light',
102
+ autoColorScheme: false,
103
+ ...createMockRegistries()
104
+ }
105
+
106
+ const result = initialState(config)
107
+ expect(result.disabledButtons.has('journeyContinue')).toBe(false)
108
+ })
109
+
73
110
  test('defaults mode to null when missing', () => {
74
111
  mockMedia({ prefersReducedMotion: false })
75
112
  mockPanels({})
@@ -415,6 +415,16 @@ export default class InteractiveMap {
415
415
  this.eventBus.emit(events.APP_TOGGLE_BUTTON_STATE, { id, prop, value })
416
416
  }
417
417
 
418
+ /**
419
+ * Enable or disable the journey continue button.
420
+ * Only has effect when backAndContinue is configured.
421
+ *
422
+ * @param {boolean} enabled
423
+ */
424
+ setContinueEnabled (enabled) {
425
+ this.toggleButtonState('journeyContinue', 'disabled', !enabled)
426
+ }
427
+
418
428
  /**
419
429
  * Add a panel to the UI.
420
430
  *
@@ -563,6 +563,14 @@ describe('InteractiveMap — Public API Methods', () => {
563
563
  expect(map.eventBus.emit).toHaveBeenCalledWith('app:togglebuttonstate', { id: 'btn-1', prop: 'disabled', value: true })
564
564
  })
565
565
 
566
+ it('setContinueEnabled enables and disables the journey continue button', () => {
567
+ map.setContinueEnabled(true)
568
+ expect(map.eventBus.emit).toHaveBeenCalledWith('app:togglebuttonstate', { id: 'journeyContinue', prop: 'disabled', value: false })
569
+
570
+ map.setContinueEnabled(false)
571
+ expect(map.eventBus.emit).toHaveBeenCalledWith('app:togglebuttonstate', { id: 'journeyContinue', prop: 'disabled', value: true })
572
+ })
573
+
566
574
  it('fitToBounds and setView emit correct events', () => {
567
575
  const bbox = [-0.489, 51.28, 0.236, 51.686]
568
576
  const center = [-0.1276, 51.5074]
@@ -17,9 +17,34 @@ const exitButtonSlots = {
17
17
  showLabel: false
18
18
  }
19
19
 
20
+ const journeyBackSlots = { slot: 'actions', showLabel: true }
21
+ const journeyContinueSlots = { slot: 'actions', showLabel: true, order: 10 }
22
+
20
23
  // Default app buttons, panels and icons
21
24
  export const defaultAppConfig = {
22
25
  buttons: [{
26
+ id: 'journeyBack',
27
+ label: ({ appConfig }) => appConfig.backAndContinue?.backLabel,
28
+ variant: 'tertiary',
29
+ onClick: (_e, { appConfig, services }) =>
30
+ appConfig.behaviour === 'mapOnly' ? globalThis.history.back() : services.closeApp(),
31
+ excludeWhen: ({ appConfig, appState }) =>
32
+ !appConfig.backAndContinue?.backLabel ||
33
+ !appState.isFullscreen ||
34
+ (appConfig.behaviour === 'mapOnly' && globalThis.history.length <= 1),
35
+ mobile: journeyBackSlots,
36
+ tablet: journeyBackSlots,
37
+ desktop: journeyBackSlots
38
+ }, {
39
+ id: 'journeyContinue',
40
+ label: ({ appConfig }) => appConfig.backAndContinue?.continueLabel,
41
+ variant: 'primary',
42
+ onClick: (_e, { services, pluginStates, mapState }) => services.eventBus.emit('app:continue', { pluginStates, mapState }),
43
+ excludeWhen: ({ appConfig, appState }) => !appConfig.backAndContinue?.continueLabel || !appState.isFullscreen,
44
+ mobile: journeyContinueSlots,
45
+ tablet: journeyContinueSlots,
46
+ desktop: journeyContinueSlots
47
+ }, {
23
48
  id: 'exit',
24
49
  label: 'Exit',
25
50
  iconId: 'close',
@@ -15,6 +15,8 @@ describe('defaultAppConfig', () => {
15
15
  const buttons = defaultAppConfig.buttons
16
16
  const fullscreenBtn = buttons.find(b => b.id === 'fullscreen')
17
17
  const exitBtn = buttons.find(b => b.id === 'exit')
18
+ const journeyBackBtn = buttons.find(b => b.id === 'journeyBack')
19
+ const journeyContinueBtn = buttons.find(b => b.id === 'journeyContinue')
18
20
  const zoomInBtn = buttons.find(b => b.id === 'zoomIn')
19
21
  const zoomOutBtn = buttons.find(b => b.id === 'zoomOut')
20
22
 
@@ -49,6 +51,54 @@ describe('defaultAppConfig', () => {
49
51
  expect(servicesMock.closeApp).toHaveBeenCalled()
50
52
  })
51
53
 
54
+ // --- JOURNEY BACK BUTTON ---
55
+ it('covers all branches of journeyBack excludeWhen', () => {
56
+ const base = { appConfig: { backAndContinue: { backLabel: 'Back' }, behaviour: 'buttonFirst' }, appState: { isFullscreen: true } }
57
+ expect(journeyBackBtn.excludeWhen({ appConfig: { backAndContinue: null, behaviour: 'buttonFirst' }, appState: { isFullscreen: true } })).toBe(true)
58
+ expect(journeyBackBtn.excludeWhen({ appConfig: { backAndContinue: { backLabel: 'Back' }, behaviour: 'buttonFirst' }, appState: { isFullscreen: false } })).toBe(true)
59
+ expect(journeyBackBtn.excludeWhen({ appConfig: { backAndContinue: { backLabel: 'Back' }, behaviour: 'mapOnly' }, appState: { isFullscreen: true } })).toBe(globalThis.history.length <= 1)
60
+ expect(journeyBackBtn.excludeWhen(base)).toBe(false)
61
+ })
62
+
63
+ it('journeyBack onClick calls history.back for mapOnly and closeApp otherwise', () => {
64
+ const historySpy = jest.spyOn(globalThis.history, 'back').mockImplementation(() => {})
65
+ const servicesMock = { closeApp: jest.fn() }
66
+
67
+ journeyBackBtn.onClick({}, { appConfig: { behaviour: 'mapOnly' }, services: servicesMock })
68
+ expect(historySpy).toHaveBeenCalled()
69
+ expect(servicesMock.closeApp).not.toHaveBeenCalled()
70
+
71
+ journeyBackBtn.onClick({}, { appConfig: { behaviour: 'buttonFirst' }, services: servicesMock })
72
+ expect(servicesMock.closeApp).toHaveBeenCalled()
73
+
74
+ historySpy.mockRestore()
75
+ })
76
+
77
+ // --- JOURNEY CONTINUE BUTTON ---
78
+ it('covers all branches of journeyContinue excludeWhen', () => {
79
+ expect(journeyContinueBtn.excludeWhen({ appConfig: { backAndContinue: null }, appState: { isFullscreen: true } })).toBe(true)
80
+ expect(journeyContinueBtn.excludeWhen({ appConfig: { backAndContinue: { continueLabel: 'Continue' } }, appState: { isFullscreen: false } })).toBe(true)
81
+ expect(journeyContinueBtn.excludeWhen({ appConfig: { backAndContinue: { continueLabel: 'Continue' } }, appState: { isFullscreen: true } })).toBe(false)
82
+ })
83
+
84
+ it('journeyBack label returns backLabel from config', () => {
85
+ expect(journeyBackBtn.label({ appConfig: { backAndContinue: { backLabel: 'Back' } } })).toBe('Back')
86
+ expect(journeyBackBtn.label({ appConfig: { backAndContinue: null } })).toBeUndefined()
87
+ })
88
+
89
+ it('journeyContinue label returns continueLabel from config', () => {
90
+ expect(journeyContinueBtn.label({ appConfig: { backAndContinue: { continueLabel: 'Continue' } } })).toBe('Continue')
91
+ expect(journeyContinueBtn.label({ appConfig: { backAndContinue: null } })).toBeUndefined()
92
+ })
93
+
94
+ it('journeyContinue onClick emits app:continue with pluginStates and mapState', () => {
95
+ const eventBusMock = { emit: jest.fn() }
96
+ const pluginStates = { interact: { selectedFeatures: [] } }
97
+ const mapState = { zoom: 12, center: [-1.5, 53.0] }
98
+ journeyContinueBtn.onClick({}, { services: { eventBus: eventBusMock }, pluginStates, mapState })
99
+ expect(eventBusMock.emit).toHaveBeenCalledWith('app:continue', { pluginStates, mapState })
100
+ })
101
+
52
102
  // --- FULLSCREEN BUTTON (Line 39 Coverage) ---
53
103
  it('evaluates fullscreen label and icon states', () => {
54
104
  const containerMock = { requestFullscreen: jest.fn() }
@@ -19,6 +19,7 @@ const defaults = {
19
19
  enableZoomControls: true,
20
20
  genericErrorText: 'There was a problem loading the map. Please try again later.',
21
21
  hasExitButton: false,
22
+ backAndContinue: null,
22
23
  hybridWidth: null, // Defaults to maxMobileWidth if not set
23
24
  keyboardHintText: '<span class="im-u-visually-hidden">Press </span><kbd>Shift</kbd> + <kbd>?</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',
24
25
  mapLabel: 'Interactive map application',
@@ -43,6 +43,7 @@
43
43
 
44
44
  // Action bar (Needs to fit evently if tools are in right hand column)
45
45
  --action-bar-max-width: calc(100% - (var(--button-size) * 2) - (var(--primary-gap) * 4));
46
+ --action-button-min-width: 120px;
46
47
 
47
48
  // Attributions
48
49
  --attributions-padding: 2px 5px;
@@ -41,6 +41,13 @@ export const patternRegistry = {
41
41
  patterns.clear()
42
42
  },
43
43
 
44
+ initialise () {
45
+ // Seed built-in patterns
46
+ Object.entries(BUILT_IN_PATTERNS).forEach(([id, svgContent]) => {
47
+ this.register(id, svgContent)
48
+ })
49
+ },
50
+
44
51
  /**
45
52
  * Returns the raw (un-coloured) inner SVG content for a style's pattern.
46
53
  * Precedence: inline fillPatternSvgContent → named fillPattern from registry.
@@ -102,7 +109,4 @@ export const patternRegistry = {
102
109
  }
103
110
  }
104
111
 
105
- // Seed built-in patterns
106
- Object.entries(BUILT_IN_PATTERNS).forEach(([id, svgContent]) => {
107
- patternRegistry.register(id, svgContent)
108
- })
112
+ patternRegistry.initialise() // Seed built-in patterns
package/src/types.js CHANGED
@@ -680,6 +680,13 @@
680
680
  * @property {string} [genericErrorText]
681
681
  * Fallback error message shown when the map fails to load.
682
682
  *
683
+ * @property {{ backLabel?: string, continueLabel?: string, continueEnabledWhen?: function }} [backAndContinue=null]
684
+ * When set, shows Back and/or Continue buttons in the actions bar when the map is fullscreen.
685
+ * Omit `backLabel` to suppress the Back button; omit `continueLabel` to suppress the Continue button.
686
+ * `continueEnabledWhen({ pluginStates, mapState })` is a reactive predicate that controls the enabled
687
+ * state of the Continue button — use this instead of `setContinueEnabled()` for declarative control.
688
+ * In `mapOnly` behaviour the Back button is hidden when there is no browser history to go back to.
689
+ *
683
690
  * @property {boolean} [hasExitButton=false]
684
691
  * Whether an exit map button is displayed when the app is fullscreen.
685
692
  *
@@ -8,8 +8,7 @@ export const getEffectivePixelRatio = (pixelRatio) => Math.max(PATTERN_MIN_PIXEL
8
8
  export const hashString = (str) => {
9
9
  let hash = 0
10
10
  for (const ch of str) {
11
- hash = ((hash << 5) - hash) + ch.codePointAt(0)
12
- hash = hash & hash
11
+ hash = Math.trunc(((hash << 5) - hash) + ch.codePointAt(0))
13
12
  }
14
13
  return Math.abs(hash).toString(36) // NOSONAR: base36 encoding for compact alphanumeric hash string
15
14
  }
@@ -14,9 +14,18 @@ describe('hashString', () => {
14
14
  expect(hashString('hello')).toBe(hashString('hello'))
15
15
  })
16
16
 
17
+ it('returns the same hash for the same input', () => {
18
+ expect(hashString('https://tiles.example.com/{z}/{x}/{y}'))
19
+ .toBe(hashString('https://tiles.example.com/{z}/{x}/{y}'))
20
+ })
21
+
17
22
  test('produces different values for different inputs', () => {
18
23
  expect(hashString('a')).not.toBe(hashString('b'))
19
24
  })
25
+
26
+ it('handles an empty string without throwing', () => {
27
+ expect(() => hashString('')).not.toThrow()
28
+ })
20
29
  })
21
30
 
22
31
  describe('injectColors', () => {