Skip to content

Commit 4f80a3c

Browse files
Replace @defra/defra-map with @defra/interactive-map in JSSoc and tests
1 parent 0245d88 commit 4f80a3c

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/client/javascripts/location-map.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function osGridRefToLatLong(osGridRef) {
5757
const DEFAULT_LAT = 53.825564
5858
const DEFAULT_LONG = -2.421975
5959

60-
/** @type {DefraMapInitConfig} */
60+
/** @type {InteractiveMapInitConfig} */
6161
const defaultConfig = {
6262
zoom: '6',
6363
center: [DEFAULT_LONG, DEFAULT_LAT]
@@ -257,7 +257,7 @@ function processLocation(config, location, index) {
257257
/**
258258
* Create a Defra map instance
259259
* @param {string} mapId - the map id
260-
* @param {DefraMapInitConfig} initConfig - the map initial configuration
260+
* @param {InteractiveMapInitConfig} initConfig - the map initial configuration
261261
* @param {MapsEnvironmentConfig} mapsConfig - the map environment params
262262
*/
263263
function createMap(mapId, initConfig, mapsConfig) {
@@ -267,7 +267,7 @@ function createMap(mapId, initConfig, mapsConfig) {
267267
// @ts-expect-error - Defra namespace currently comes from UMD support files
268268
const defra = window.defra
269269

270-
/** @type {DefraMap} */
270+
/** @type {InteractiveMap} */
271271
const map = new defra.InteractiveMap(mapId, {
272272
...initConfig,
273273
mapProvider: defra.maplibreProvider(),
@@ -502,7 +502,7 @@ function getInitMapCenterConfig(center) {
502502
/**
503503
* Gets initial map config for a latlong location field
504504
* @param {HTMLDivElement} locationField - the latlong location field element
505-
* @returns {DefraMapInitConfig | undefined}
505+
* @returns {InteractiveMapInitConfig | undefined}
506506
*/
507507
function getInitLatLongMapConfig(locationField) {
508508
const { latInput, longInput } = getLatLongInputs(locationField)
@@ -521,7 +521,7 @@ function getInitLatLongMapConfig(locationField) {
521521
/**
522522
* Gets initial map config for a easting/northing location field
523523
* @param {HTMLDivElement} locationField - the eastingnorthing location field element
524-
* @returns {DefraMapInitConfig | undefined}
524+
* @returns {InteractiveMapInitConfig | undefined}
525525
*/
526526
function getInitEastingNorthingMapConfig(locationField) {
527527
const { eastingInput, northingInput } =
@@ -546,7 +546,7 @@ function getInitEastingNorthingMapConfig(locationField) {
546546
/**
547547
* Gets initial map config for an OS grid reference location field
548548
* @param {HTMLDivElement} locationField - the osgridref location field element
549-
* @returns {DefraMapInitConfig | undefined}
549+
* @returns {InteractiveMapInitConfig | undefined}
550550
*/
551551
function getInitOsGridRefMapConfig(locationField) {
552552
const osGridRefInput = getOsGridRefInput(locationField)
@@ -567,7 +567,7 @@ function getInitOsGridRefMapConfig(locationField) {
567567
/**
568568
* Bind a latlong field to the map
569569
* @param {HTMLDivElement} locationField - the latlong location field
570-
* @param {DefraMap} map - the map component instance (of DefraMap)
570+
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
571571
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
572572
*/
573573
function bindLatLongField(locationField, map, mapProvider) {
@@ -609,7 +609,7 @@ function bindLatLongField(locationField, map, mapProvider) {
609609
/**
610610
* Bind an eastingnorthing field to the map
611611
* @param {HTMLDivElement} locationField - the eastingnorthing location field
612-
* @param {DefraMap} map - the map component instance (of DefraMap)
612+
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
613613
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
614614
*/
615615
function bindEastingNorthingField(locationField, map, mapProvider) {
@@ -662,7 +662,7 @@ function bindEastingNorthingField(locationField, map, mapProvider) {
662662
/**
663663
* Bind an OS grid reference field to the map
664664
* @param {HTMLDivElement} locationField - the osgridref location field
665-
* @param {DefraMap} map - the map component instance (of DefraMap)
665+
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
666666
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
667667
*/
668668
function bindOsGridRefField(locationField, map, mapProvider) {
@@ -707,7 +707,7 @@ function bindOsGridRefField(locationField, map, mapProvider) {
707707

708708
/**
709709
* Updates the marker position and moves the map view port the new location
710-
* @param {DefraMap} map - the map component instance (of DefraMap)
710+
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
711711
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
712712
* @param {MapCenter} center - the point
713713
*/
@@ -724,7 +724,7 @@ function centerMap(map, mapProvider, center) {
724724
}
725725

726726
/**
727-
* @typedef {object} DefraMap - an instance of a DefraMap
727+
* @typedef {object} InteractiveMap - an instance of a InteractiveMap
728728
* @property {Function} on - register callback listeners to map events
729729
* @property {Function} addPanel - adds a new panel to the map
730730
* @property {Function} addMarker - adds/updates a marker
@@ -740,7 +740,7 @@ function centerMap(map, mapProvider, center) {
740740
*/
741741

742742
/**
743-
* @typedef {object} DefraMapInitConfig - additional config that can be provided to DefraMap
743+
* @typedef {object} InteractiveMapInitConfig - additional config that can be provided to InteractiveMap
744744
* @property {string} zoom - the zoom level of the map
745745
* @property {MapCenter} center - the center point of the map
746746
* @property {{ id: string, coords: MapCenter}[]} [markers] - the markers to add to the map

test/client/javascripts/location-map.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Location Maps Client JS', () => {
2121
addMarkerMock = jest.fn()
2222
addPanelMock = jest.fn()
2323

24-
class MockDefraMap {
24+
class MockInteractiveMap {
2525
// eslint-disable-next-line @typescript-eslint/no-empty-function
2626
on = onMock
2727
// eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -32,7 +32,7 @@ describe('Location Maps Client JS', () => {
3232

3333
// @ts-expect-error - loaded via UMD
3434
window.defra = {
35-
DefraMap: MockDefraMap,
35+
InteractiveMap: MockInteractiveMap,
3636
maplibreProvider: noop,
3737
openNamesProvider: noop,
3838
mapStylesPlugin: noop,

0 commit comments

Comments
 (0)