diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f91acd86bb..5224b9577f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -44,6 +44,7 @@ Changelog * Maintenance: Remove unnecessary box-sizing: border-box declarations in SCSS (Albina Starykova) * Maintenance: Migrated `initTooltips` to TypeScript add JSDoc and unit tests (Fatuma Abdullahi) * Maintenance: Migrated `initTagField` from core.js to own TypeScript file and add unit tests (Chisom Okeoma) + * Maintenance: Added unit tests & JSDoc to `initDissmisibles` (Yekasumah) 4.1.2 (xx.xx.xxxx) - IN DEVELOPMENT diff --git a/client/src/includes/initDismissibles.test.js b/client/src/includes/initDismissibles.test.js new file mode 100644 index 0000000000..84808e7c08 --- /dev/null +++ b/client/src/includes/initDismissibles.test.js @@ -0,0 +1,87 @@ +import { initDismissibles, updateDismissibles } from './initDismissibles'; + +jest.mock('../config/wagtailConfig.js', () => ({ + WAGTAIL_CONFIG: { + ADMIN_URLS: { DISMISSIBLES: '/admin/dismissibles/' }, + CSRF_HEADER_NAME: 'X-CSRFToken', + CSRF_TOKEN: 'test-token', + }, +})); + +describe('initDismissibles', () => { + it('should not error if there are no dismissibles', () => { + document.body.innerHTML = '