@defra/interactive-map 0.0.52-alpha → 0.0.54-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.
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/context.md +30 -12
- package/docs/api/marker-config.md +16 -8
- package/docs/api/symbol-config.md +24 -9
- package/docs/api/symbol-registry.md +49 -14
- package/docs/api.md +11 -3
- package/docs/plugins/datasets.md +6 -10
- package/docs/plugins/draw.md +2 -1
- package/docs/plugins/map-key.md +47 -4
- package/package.json +1 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +6 -6
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/maplibre/layerBuilders.js +10 -10
- package/plugins/datasets/src/adapters/maplibre/layerBuilders.test.js +22 -6
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +9 -3
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +18 -3
- package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +3 -3
- package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +20 -27
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.js +16 -70
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +30 -115
- package/plugins/datasets/src/adapters/openlayers/layerBuilders.js +11 -13
- package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +11 -3
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +48 -19
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +101 -13
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +27 -28
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +51 -32
- package/plugins/datasets/src/fetch/createDynamicSource.js +2 -2
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +2 -2
- package/plugins/datasets/src/initialise/defaults.js +16 -27
- package/plugins/datasets/src/initialise/defaults.test.js +25 -57
- package/plugins/datasets/src/initialise/initialiseDatasets.js +1 -4
- package/plugins/datasets/src/reducers/__data__/demoDatasets.js +1 -3
- package/plugins/datasets/src/reducers/mappedDatasetsReducer.test.js +1 -1
- package/plugins/datasets/src/registry/dataset.js +23 -17
- package/plugins/datasets/src/registry/dataset.test.js +114 -11
- package/plugins/datasets/src/registry/mapboxStyleDataset.js +1 -1
- package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +7 -5
- package/plugins/draw/src/DrawInit.test.jsx +18 -2
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +11 -5
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -11
- package/plugins/draw/src/adapters/maplibre/mapboxDraw.js +12 -9
- package/plugins/draw/src/adapters/maplibre/mapboxDraw.test.js +18 -0
- package/plugins/draw/src/adapters/maplibre/pointSymbolImages.js +81 -56
- package/plugins/draw/src/adapters/maplibre/pointSymbolImages.test.js +149 -80
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +7 -6
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +22 -25
- package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.js +26 -8
- package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.test.js +58 -16
- package/plugins/draw/src/adapters/openlayers/core/styles.js +33 -20
- package/plugins/draw/src/adapters/openlayers/core/styles.test.js +47 -21
- package/plugins/draw/src/adapters/openlayers/olDraw.js +16 -12
- package/plugins/draw/src/adapters/openlayers/olDraw.test.js +27 -32
- package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.js +44 -49
- package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +100 -119
- package/plugins/draw/src/defaults.js +2 -6
- package/plugins/draw/src/utils/stripInternalProperties.test.js +2 -1
- package/plugins/draw/src/utils/symbolKeys.js +3 -4
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/map-key/dist/css/index.css +1 -1
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -2
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/map-key/src/components/Key/Key.jsx +8 -4
- package/plugins/map-key/src/components/Key/Key.module.scss +144 -53
- package/plugins/map-key/src/components/Key/KeyGroupItem.jsx +36 -3
- package/plugins/map-key/src/components/Key/KeyGroupItem.test.jsx +44 -2
- package/plugins/map-key/src/components/Key/KeyItem.jsx +2 -2
- package/plugins/map-key/src/components/Key/KeySvg.jsx +19 -18
- package/plugins/map-key/src/components/Key/KeySvg.test.jsx +25 -18
- package/plugins/map-key/src/components/Key/KeySvgPattern.jsx +1 -2
- package/plugins/map-key/src/components/Key/KeySvgPattern.test.jsx +3 -1
- package/plugins/map-key/src/components/Key/KeySvgRamp.jsx +35 -6
- package/plugins/map-key/src/components/Key/KeySvgRamp.test.jsx +56 -16
- package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +26 -12
- package/plugins/map-key/src/components/Key/KeySvgSymbol.test.jsx +24 -74
- package/plugins/map-key/src/components/Key/MapKey.jsx +3 -1
- package/plugins/map-key/src/components/Key/svgProperties.js +8 -2
- package/plugins/map-key/src/components/Key/useRampOrientation.js +61 -0
- package/plugins/map-key/src/components/Key/useRampOrientation.test.jsx +155 -0
- package/plugins/map-key/src/index.js +34 -0
- package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +15 -0
- package/plugins/map-key/src/registry/index.js +0 -2
- package/plugins/map-key/src/registry/index.test.js +1 -9
- package/plugins/map-key/src/utils/groupStyles.js +5 -2
- package/plugins/menu/src/registry/index.js +0 -2
- package/plugins/menu/src/registry/index.test.js +1 -9
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/plugins/search/src/Search.jsx +0 -1
- package/plugins/search/src/components/Form/Form.jsx +3 -3
- package/plugins/search/src/components/Suggestions/Suggestions.jsx +2 -0
- package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +6 -0
- package/plugins/search/src/defaults.js +3 -0
- package/plugins/search/src/events/formHandlers.js +3 -9
- package/plugins/search/src/events/formHandlers.test.js +6 -9
- package/plugins/search/src/events/inputHandlers.js +8 -2
- package/plugins/search/src/events/inputHandlers.test.js +20 -0
- package/plugins/search/src/events/suggestionHandlers.js +3 -5
- package/plugins/search/src/events/suggestionHandlers.test.js +5 -8
- package/plugins/search/src/utils/showResult.js +9 -0
- package/plugins/search/src/utils/showResult.test.js +16 -0
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/src/openlayersProvider.js +102 -2
- package/providers/beta/openlayers/src/openlayersProvider.test.js +95 -0
- package/providers/beta/openlayers/src/utils/highlightFeatures.js +20 -25
- package/providers/beta/openlayers/src/utils/highlightFeatures.test.js +73 -38
- package/providers/beta/openlayers/src/utils/patternImages.js +61 -0
- package/providers/beta/openlayers/src/utils/patternImages.test.js +74 -0
- package/providers/beta/openlayers/src/utils/symbolImages.js +103 -95
- package/providers/beta/openlayers/src/utils/symbolImages.test.js +136 -85
- package/providers/mapProvider.js +53 -1
- package/providers/mapProvider.test.js +6 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/maplibreProvider.js +50 -17
- package/providers/maplibre/src/maplibreProvider.test.js +74 -20
- package/providers/maplibre/src/utils/highlightFeatures.js +19 -14
- package/providers/maplibre/src/utils/highlightFeatures.test.js +20 -14
- package/providers/maplibre/src/utils/patternImages.js +46 -29
- package/providers/maplibre/src/utils/patternImages.test.js +52 -4
- package/providers/maplibre/src/utils/symbolImages.js +80 -39
- package/providers/maplibre/src/utils/symbolImages.test.js +157 -54
- package/src/App/components/Hints/Hints.module.scss +1 -1
- package/src/App/components/Markers/Markers.jsx +16 -25
- package/src/App/components/Markers/Markers.test.jsx +34 -48
- package/src/App/components/Markers/SymbolLabelMarker.jsx +1 -1
- package/src/App/components/Markers/SymbolMarker.jsx +1 -1
- package/src/App/components/Viewport/Viewport.jsx +6 -4
- package/src/App/components/Viewport/Viewport.test.jsx +18 -1
- package/src/App/hooks/useMapAnnouncements.js +7 -2
- package/src/App/hooks/useMapAnnouncements.test.js +13 -2
- package/src/App/hooks/useModalPanelBehaviour.js +3 -1
- package/src/App/initialiseApp.js +1 -1
- package/src/App/store/ServiceProvider.jsx +12 -3
- package/src/App/store/ServiceProvider.test.jsx +39 -0
- package/src/InteractiveMap/InteractiveMap.js +3 -3
- package/src/config/appConfig.js +1 -5
- package/src/config/mapSizeScales.js +8 -0
- package/src/config/symbolConfig.js +101 -25
- package/src/services/mapFocus.js +64 -0
- package/src/services/mapFocus.test.js +76 -0
- package/src/services/patternRegistry.js +97 -76
- package/src/services/patternRegistry.test.js +19 -1
- package/src/services/symbolComposer.js +184 -0
- package/src/services/symbolComposer.test.js +132 -0
- package/src/services/symbolRegistry.js +326 -155
- package/src/services/symbolRegistry.test.js +334 -32
- package/src/types.js +11 -5
- package/src/utils/detectInterfaceType.js +16 -5
- package/src/utils/detectInterfaceType.test.js +32 -0
- package/src/utils/hashString.js +23 -0
- package/src/utils/hashString.test.js +29 -0
- package/src/utils/imageDataCache.js +43 -0
- package/src/utils/imageDataCache.test.js +38 -0
- package/src/utils/pathBounds.js +330 -0
- package/src/utils/pathBounds.test.js +145 -0
- package/src/utils/patternUtils.js +0 -8
- package/src/utils/patternUtils.test.js +0 -25
- package/src/utils/recentImageSets.js +35 -0
- package/src/utils/recentImageSets.test.js +46 -0
- package/src/utils/symbolUtils.js +26 -29
- package/src/utils/symbolUtils.test.js +27 -41
- package/plugins/map-key/dist/umd/im-map-key-plugin.js.LICENSE.txt +0 -1
package/src/utils/symbolUtils.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { SYMBOL_SIZES } from '../config/symbolConfig.js'
|
|
2
|
+
import { logger } from '../services/logger.js'
|
|
3
|
+
|
|
4
|
+
// Each unknown symbol size is reported once, rather than on every render
|
|
5
|
+
const reportedSizes = new Set()
|
|
6
|
+
const quoted = (text) => `'${text}'`
|
|
7
|
+
|
|
1
8
|
// Symbol style props in dataset style that carry token values.
|
|
2
9
|
// These use the 'symbol' prefix to distinguish them from fill/stroke props at the same level.
|
|
3
10
|
// The prefix is stripped before passing tokens to the registry (e.g. symbolBackgroundColor → backgroundColor).
|
|
@@ -7,15 +14,15 @@ const SYMBOL_STYLE_PROPS = new Set([
|
|
|
7
14
|
])
|
|
8
15
|
|
|
9
16
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param {Object}
|
|
17
|
+
* Whether a dataset or draw style draws a symbol: a `symbol` id or inline `symbolSvgContent`.
|
|
18
|
+
* @param {Object} [style]
|
|
12
19
|
* @returns {boolean}
|
|
13
20
|
*/
|
|
14
|
-
export const hasSymbol = (
|
|
21
|
+
export const hasSymbol = (style) => !!(style?.symbol || style?.symbolSvgContent)
|
|
15
22
|
|
|
16
23
|
/**
|
|
17
24
|
* Returns true if a marker item should render as a standalone label with no symbol.
|
|
18
|
-
* Requires label content and at least one of symbol/
|
|
25
|
+
* Requires label content and at least one of symbol/svgContent to be explicitly null.
|
|
19
26
|
* Undefined values fall through to render-time default symbol resolution.
|
|
20
27
|
*
|
|
21
28
|
* @param {Object} marker
|
|
@@ -25,10 +32,10 @@ export const isStandaloneLabel = (marker) => {
|
|
|
25
32
|
if (!marker.label) {
|
|
26
33
|
return false
|
|
27
34
|
}
|
|
28
|
-
if (marker.symbol || marker.
|
|
35
|
+
if (marker.symbol || marker.svgContent) {
|
|
29
36
|
return false
|
|
30
37
|
}
|
|
31
|
-
return marker.symbol === null || marker.
|
|
38
|
+
return marker.symbol === null || marker.svgContent === null
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
/**
|
|
@@ -53,31 +60,21 @@ export const getSymbolStyleColors = (dataset) => {
|
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
/**
|
|
56
|
-
* Returns the
|
|
57
|
-
*
|
|
63
|
+
* Returns the scale factor for a symbol size ('small' | 'medium' | 'large'). Missing means
|
|
64
|
+
* medium; an unknown value is warned about (once) and also treated as medium.
|
|
65
|
+
* The one place a size becomes a number — extend here to accept other sizes or raw factors.
|
|
58
66
|
*
|
|
59
|
-
* @param {
|
|
60
|
-
* @
|
|
61
|
-
* @returns {string}
|
|
67
|
+
* @param {string} [size]
|
|
68
|
+
* @returns {number}
|
|
62
69
|
*/
|
|
63
|
-
export const
|
|
64
|
-
if (
|
|
65
|
-
return
|
|
70
|
+
export const getSymbolScale = (size) => {
|
|
71
|
+
if (size == null || Object.keys(SYMBOL_SIZES).includes(size)) {
|
|
72
|
+
return SYMBOL_SIZES[size] ?? SYMBOL_SIZES.medium
|
|
66
73
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* Returns the anchor for a dataset's symbol as [x, y] in 0–1 space.
|
|
72
|
-
* Precedence: dataset.symbolAnchor → symbolDef anchor → [0.5, 0.5].
|
|
73
|
-
*
|
|
74
|
-
* @param {Object} dataset
|
|
75
|
-
* @param {Object|undefined} symbolDef
|
|
76
|
-
* @returns {number[]}
|
|
77
|
-
*/
|
|
78
|
-
export const getSymbolAnchor = (dataset, symbolDef) => {
|
|
79
|
-
if (dataset.symbolAnchor) {
|
|
80
|
-
return dataset.symbolAnchor
|
|
74
|
+
if (!reportedSizes.has(size)) {
|
|
75
|
+
reportedSizes.add(size)
|
|
76
|
+
const expected = Object.keys(SYMBOL_SIZES).map(quoted).join(', ')
|
|
77
|
+
logger.warn(`Unknown symbol size "${size}" — expected ${expected}. Using 'medium'.`)
|
|
81
78
|
}
|
|
82
|
-
return
|
|
79
|
+
return SYMBOL_SIZES.medium
|
|
83
80
|
}
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
hasSymbol,
|
|
3
3
|
isStandaloneLabel,
|
|
4
4
|
getSymbolStyleColors,
|
|
5
|
-
|
|
6
|
-
getSymbolAnchor
|
|
5
|
+
getSymbolScale
|
|
7
6
|
} from './symbolUtils.js'
|
|
7
|
+
import { logger } from '../services/logger.js'
|
|
8
|
+
|
|
9
|
+
jest.mock('../services/logger.js', () => ({ logger: { warn: jest.fn() } }))
|
|
8
10
|
|
|
9
11
|
// ─── hasSymbol ────────────────────────────────────────────────────────────────
|
|
10
12
|
|
|
@@ -17,6 +19,10 @@ describe('hasSymbol', () => {
|
|
|
17
19
|
expect(hasSymbol({ symbolSvgContent: '<circle/>' })).toBe(true)
|
|
18
20
|
})
|
|
19
21
|
|
|
22
|
+
it('returns false with no style at all', () => {
|
|
23
|
+
expect(hasSymbol(undefined)).toBe(false)
|
|
24
|
+
})
|
|
25
|
+
|
|
20
26
|
it('returns false when symbol is absent', () => {
|
|
21
27
|
expect(hasSymbol({})).toBe(false)
|
|
22
28
|
})
|
|
@@ -38,11 +44,11 @@ describe('isStandaloneLabel', () => {
|
|
|
38
44
|
expect(isStandaloneLabel({ label: 'My label', symbol: 'pin' })).toBe(false)
|
|
39
45
|
})
|
|
40
46
|
|
|
41
|
-
it('returns false when marker has
|
|
42
|
-
expect(isStandaloneLabel({ label: 'My label',
|
|
47
|
+
it('returns false when marker has svgContent (line 28)', () => {
|
|
48
|
+
expect(isStandaloneLabel({ label: 'My label', svgContent: '<circle/>' })).toBe(false)
|
|
43
49
|
})
|
|
44
50
|
|
|
45
|
-
it('returns false when label is present but both symbol and
|
|
51
|
+
it('returns false when label is present but both symbol and svgContent are undefined (line 31)', () => {
|
|
46
52
|
expect(isStandaloneLabel({ label: 'My label' })).toBe(false)
|
|
47
53
|
})
|
|
48
54
|
|
|
@@ -50,8 +56,8 @@ describe('isStandaloneLabel', () => {
|
|
|
50
56
|
expect(isStandaloneLabel({ label: 'My label', symbol: null })).toBe(true)
|
|
51
57
|
})
|
|
52
58
|
|
|
53
|
-
it('returns true when label is present and
|
|
54
|
-
expect(isStandaloneLabel({ label: 'My label',
|
|
59
|
+
it('returns true when label is present and svgContent is explicitly null (line 31)', () => {
|
|
60
|
+
expect(isStandaloneLabel({ label: 'My label', svgContent: null })).toBe(true)
|
|
55
61
|
})
|
|
56
62
|
})
|
|
57
63
|
|
|
@@ -103,46 +109,26 @@ describe('getSymbolStyleColors', () => {
|
|
|
103
109
|
})
|
|
104
110
|
})
|
|
105
111
|
|
|
106
|
-
// ───
|
|
107
|
-
|
|
108
|
-
describe('getSymbolViewBox', () => {
|
|
109
|
-
it('returns symbolViewBox from dataset', () => {
|
|
110
|
-
const dataset = { symbol: 'custom', symbolViewBox: '0 0 24 24' }
|
|
111
|
-
expect(getSymbolViewBox(dataset, undefined)).toBe('0 0 24 24')
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
it('falls back to symbolDef viewBox', () => {
|
|
115
|
-
const symbolDef = { id: 'pin', viewBox: '0 0 38 38' }
|
|
116
|
-
expect(getSymbolViewBox({ symbol: 'pin' }, symbolDef)).toBe('0 0 38 38')
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
it('returns default viewBox when neither source has one', () => {
|
|
120
|
-
expect(getSymbolViewBox({ symbol: 'pin' }, {})).toBe('0 0 38 38')
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it('returns default viewBox when symbolDef is undefined', () => {
|
|
124
|
-
expect(getSymbolViewBox({ symbol: 'pin' }, undefined)).toBe('0 0 38 38')
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
// ─── getSymbolAnchor ──────────────────────────────────────────────────────────
|
|
112
|
+
// ─── getSymbolScale ───────────────────────────────────────────────────────────
|
|
129
113
|
|
|
130
|
-
describe('
|
|
131
|
-
it('
|
|
132
|
-
|
|
133
|
-
expect(getSymbolAnchor(dataset, undefined)).toEqual([0.5, 0.9])
|
|
114
|
+
describe('getSymbolScale', () => {
|
|
115
|
+
it.each([['small', 0.75], ['medium', 1], ['large', 1.25]])('maps %s to %s', (size, scale) => {
|
|
116
|
+
expect(getSymbolScale(size)).toBe(scale)
|
|
134
117
|
})
|
|
135
118
|
|
|
136
|
-
it('
|
|
137
|
-
|
|
138
|
-
expect(
|
|
119
|
+
it('treats a missing size as medium, without a warning', () => {
|
|
120
|
+
expect(getSymbolScale(undefined)).toBe(1)
|
|
121
|
+
expect(logger.warn).not.toHaveBeenCalled()
|
|
139
122
|
})
|
|
140
123
|
|
|
141
|
-
it('
|
|
142
|
-
expect(
|
|
124
|
+
it('warns once about an unknown size, and treats it as medium', () => {
|
|
125
|
+
expect(getSymbolScale('huge')).toBe(1)
|
|
126
|
+
expect(getSymbolScale('huge')).toBe(1)
|
|
127
|
+
expect(logger.warn).toHaveBeenCalledTimes(1)
|
|
128
|
+
expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('Unknown symbol size "huge"'))
|
|
143
129
|
})
|
|
144
130
|
|
|
145
|
-
it('
|
|
146
|
-
expect(
|
|
131
|
+
it('doesn\'t mistake inherited object keys for sizes', () => {
|
|
132
|
+
expect(getSymbolScale('toString')).toBe(1)
|
|
147
133
|
})
|
|
148
134
|
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|