diff --git a/packages/web/src/js/__tests__/Toast.test.ts b/packages/web/src/js/__tests__/Toast.test.ts
index 23d4237396..708314a4a2 100644
--- a/packages/web/src/js/__tests__/Toast.test.ts
+++ b/packages/web/src/js/__tests__/Toast.test.ts
@@ -2,12 +2,18 @@ import { clearFixture, getFixture } from '../../../tests/helpers/fixture';
import Toast from '../Toast';
import { CLASS_NAME_HIDDEN, CLASS_NAME_OPEN } from '../constants';
+const testId = 'toast-test';
+
const toastHtmlClosed = `
-
+
+
+
`;
const toastHtmlOpened = `
-
+
+
+
`;
describe('Toast', () => {
@@ -55,12 +61,14 @@ describe('Toast', () => {
const element = fixtureEl.querySelector('.ToastBar') as HTMLElement;
const toast = new Toast(element);
+ const trigger = fixtureEl.querySelector(`[data-spirit-target="#${testId}"]`) as HTMLButtonElement;
const showSpy = jest.spyOn(Toast.prototype, 'show');
await toast.show();
expect(showSpy).toHaveBeenCalled();
+ expect(trigger).toHaveAttribute('aria-expanded', 'true');
expect(element).toHaveClass(CLASS_NAME_OPEN);
});
});
@@ -71,12 +79,14 @@ describe('Toast', () => {
const element = fixtureEl.querySelector('.ToastBar') as HTMLElement;
const toast = new Toast(element);
+ const trigger = fixtureEl.querySelector(`[data-spirit-target="#${testId}"]`) as HTMLButtonElement;
const hideSpy = jest.spyOn(Toast.prototype, 'hide');
await toast.hide();
expect(hideSpy).toHaveBeenCalled();
+ expect(trigger).toHaveAttribute('aria-expanded', 'false');
expect(element).toHaveClass(CLASS_NAME_HIDDEN);
});
});