Skip to content

Commit 863e0c4

Browse files
Code coverage
1 parent 3fcd8b1 commit 863e0c4

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/client/javascripts/geospatial-map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export function focusFeature(feature, mapProvider) {
195195
* @param {boolean} [disabled] - render the list with disabled links
196196
* @param {boolean} [readonly] - render the list item in readonly mode
197197
*/
198-
function createFeatureHTML(
198+
export function createFeatureHTML(
199199
feature,
200200
index,
201201
mapId,

test/client/javascripts/map.test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { createFeaturesHTML } from '~/src/client/javascripts/geospatial-map.js'
1+
import {
2+
createFeatureHTML,
3+
createFeaturesHTML
4+
} from '~/src/client/javascripts/geospatial-map.js'
25
import {
36
formSubmitFactory,
47
getCentroidGridRef,
@@ -1292,6 +1295,15 @@ describe('Maps Client JS', () => {
12921295
expect(html).toContain('data-action="edit"')
12931296
expect(html).not.toContain('data-action="focus"')
12941297
})
1298+
1299+
test('createFeatureHTML - normal (defaults)', () => {
1300+
const html = createFeatureHTML(features[1], 0, 'test')
1301+
1302+
expect(html).toContain('data-action="delete"')
1303+
expect(html).toContain('data-action="edit"')
1304+
expect(html).not.toContain('govuk-link--disabled')
1305+
expect(html).not.toContain('data-action="focus"')
1306+
})
12951307
})
12961308
})
12971309

0 commit comments

Comments
 (0)