@@ -797,6 +797,25 @@ describe('Maps Client JS', () => {
797797 return /** @type {HTMLAnchorElement } */ ( linkEl )
798798 }
799799
800+ /**
801+ * Get the decsription element by id
802+ * @param {HTMLDivElement } listContainer
803+ * @param {string } id
804+ */
805+ function getDescription ( listContainer , id ) {
806+ const descriptionEl = listContainer . querySelector (
807+ `input[id="description_${ id } "]`
808+ )
809+
810+ expect ( descriptionEl ) . toBeDefined ( )
811+
812+ if ( descriptionEl === null ) {
813+ throw new Error ( `Unexpected null found for description ${ id } ` )
814+ }
815+
816+ return /** @type {HTMLInputElement } */ ( descriptionEl )
817+ }
818+
800819 describe ( 'Map initialisation' , ( ) => {
801820 test ( 'initMaps geospatial component initializes without errors when DOM elements are present' , ( ) => {
802821 initialiseGeospatialMaps ( )
@@ -1126,25 +1145,19 @@ describe('Maps Client JS', () => {
11261145 )
11271146 } )
11281147
1129- test . skip ( 'description changed' , ( ) => {
1148+ test ( 'description changed' , ( ) => {
11301149 const { geospatialInput, listContainer } = initialiseGeospatialMaps ( )
11311150
11321151 // Manually change the description
1133- const buckinghamPalaceDescriptionEl = listContainer . querySelector (
1134- 'input[id="description_6d67810c-7228-4f71-b6ec-0d16b132fcd7"]'
1152+ const buckinghamPalaceInputEl = getDescription (
1153+ listContainer ,
1154+ '6d67810c-7228-4f71-b6ec-0d16b132fcd7'
11351155 )
11361156
1137- if ( buckinghamPalaceDescriptionEl === null ) {
1138- throw new Error (
1139- 'Unexpected null found for buckinghamPalaceDescriptionEl'
1140- )
1141- }
1142-
1143- const buckinghamPalaceInputEl = /** @type {HTMLInputElement } */ (
1144- buckinghamPalaceDescriptionEl
1145- )
11461157 buckinghamPalaceInputEl . value = 'New description'
1147- buckinghamPalaceInputEl . dispatchEvent ( new window . Event ( 'change' ) )
1158+ buckinghamPalaceInputEl . dispatchEvent (
1159+ new window . Event ( 'change' , { bubbles : true } )
1160+ )
11481161
11491162 expect ( JSON . parse ( geospatialInput . value ) ) . toEqual ( [
11501163 {
0 commit comments