|
1 | 1 | import { |
2 | 2 | createFeatureHTML, |
3 | | - createFeaturesHTML |
| 3 | + createFeaturesHTML, |
| 4 | + getHelpPanelHtml |
4 | 5 | } from '~/src/client/javascripts/geospatial-map.js' |
5 | 6 | import { |
6 | 7 | formSubmitFactory, |
@@ -289,6 +290,44 @@ describe('Maps Client JS', () => { |
289 | 290 | }) |
290 | 291 | }) |
291 | 292 |
|
| 293 | + describe('getHelpPanelHtml', () => { |
| 294 | + it('should handle only point', () => { |
| 295 | + expect(getHelpPanelHtml(true, false, false)).toBe( |
| 296 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Give the location a name</li></ul>' |
| 297 | + ) |
| 298 | + }) |
| 299 | + it('should handle only line', () => { |
| 300 | + expect(getHelpPanelHtml(false, true, false)).toBe( |
| 301 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add lines to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line</li><li>Give the location a name</li></ul>' |
| 302 | + ) |
| 303 | + }) |
| 304 | + it('should handle only shape', () => { |
| 305 | + expect(getHelpPanelHtml(false, false, true)).toBe( |
| 306 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add shapes to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a shape</li><li>Give the location a name</li></ul>' |
| 307 | + ) |
| 308 | + }) |
| 309 | + it('should handle point and line', () => { |
| 310 | + expect(getHelpPanelHtml(true, true, false)).toBe( |
| 311 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points or lines to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line</li><li>Give the location a name</li></ul>' |
| 312 | + ) |
| 313 | + }) |
| 314 | + it('should handle point and shape', () => { |
| 315 | + expect(getHelpPanelHtml(true, false, true)).toBe( |
| 316 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points or shapes to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a shape</li><li>Give the location a name</li></ul>' |
| 317 | + ) |
| 318 | + }) |
| 319 | + it('should handle line and shape', () => { |
| 320 | + expect(getHelpPanelHtml(false, true, true)).toBe( |
| 321 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add lines or shapes to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line or shape</li><li>Give the location a name</li></ul>' |
| 322 | + ) |
| 323 | + }) |
| 324 | + it('should handle point, line and shape', () => { |
| 325 | + expect(getHelpPanelHtml(true, true, true)).toBe( |
| 326 | + '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points, lines or shapes to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line or shape</li><li>Give the location a name</li></ul>' |
| 327 | + ) |
| 328 | + }) |
| 329 | + }) |
| 330 | + |
292 | 331 | describe('Easting northing component', () => { |
293 | 332 | beforeEach(() => { |
294 | 333 | document.body.innerHTML = ` |
|
0 commit comments