feat: Search a11y updated behavior. (#1614)

* feat: Updated accesibility on courseware search modal

* chore: Updated i18n to use useIntl() hook and dialog behavior updates

* feat: Added close when clicking on the modal backdrop

* chore: Swapped remove listeners with an AbortController

* fix: Fixed tests

* chore: Rolled back unintended husky script change
This commit is contained in:
Marcos Rigoli
2025-02-28 12:12:39 -03:00
committed by GitHub
parent ec360bc545
commit db3f1b9cb0
6 changed files with 151 additions and 93 deletions

View File

@@ -61,6 +61,18 @@ const supressWarningBlock = (callback) => {
};
/* eslint-enable no-console */
// Mocks for HTML Dialogs behavior. */
// jsdom does not support HTML Dialogs yet: https://github.com/jsdom/jsdom/issues/3294
HTMLDialogElement.prototype.show = jest.fn();
HTMLDialogElement.prototype.showModal = jest.fn(function mock() {
const onShowModal = new CustomEvent('show_modal');
this.dispatchEvent(onShowModal);
});
HTMLDialogElement.prototype.close = jest.fn(function mock() {
const onClose = new CustomEvent('close');
this.dispatchEvent(onClose);
});
// Mock Intersection Observer which is unavailable in the context of a test.
global.IntersectionObserver = jest.fn(function mockIntersectionObserver() {
this.observe = jest.fn();