diff --git a/app/assets/javascripts/updateStatus.js b/app/assets/javascripts/updateStatus.js index d39e232be..b02ae1690 100644 --- a/app/assets/javascripts/updateStatus.js +++ b/app/assets/javascripts/updateStatus.js @@ -49,11 +49,11 @@ this.$textbox .attr( - 'aria-described-by', + 'aria-describedby', ( - this.$textbox.attr('aria-described-by') || '' + this.$textbox.attr('aria-describedby') || '' ) + ( - this.$textbox.attr('aria-described-by') ? ' ' : '' + this.$textbox.attr('aria-describedby') ? ' ' : '' ) + id ) .on('input', throttle(this.update, 150)) diff --git a/tests/javascripts/updateStatus.test.js b/tests/javascripts/updateStatus.test.js index a626d1fdb..5966f40e7 100644 --- a/tests/javascripts/updateStatus.test.js +++ b/tests/javascripts/updateStatus.test.js @@ -46,7 +46,7 @@ describe('Update content', () => { Template content Example hint text - Content of message + Content of message Initial content @@ -78,21 +78,21 @@ describe('Update content', () => { ); expect( - document.getElementById('template_content').getAttribute('aria-described-by') + document.getElementById('template_content').getAttribute('aria-describedby') ).toEqual( "example-hint-text update-status" ); }); - test("It should handle a textarea without an aria-described-by attribute", () => { + test("It should handle a textarea without an aria-describedby attribute", () => { - document.getElementById('template_content').removeAttribute('aria-described-by'); + document.getElementById('template_content').removeAttribute('aria-describedby'); window.GOVUK.modules.start(); expect( - document.getElementById('template_content').getAttribute('aria-described-by') + document.getElementById('template_content').getAttribute('aria-describedby') ).toEqual( "update-status" );