mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-15 17:44:03 -05:00
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
beforeAll(() => {
|
|
require('../../app/assets/javascripts/errorBanner.js')
|
|
});
|
|
|
|
afterAll(() => {
|
|
require('./support/teardown.js');
|
|
});
|
|
|
|
describe("Error Banner", () => {
|
|
afterEach(() => {
|
|
document.body.innerHTML = '';
|
|
});
|
|
|
|
describe("The `hideBanner` method", () => {
|
|
test("Will hide the element", () => {
|
|
document.body.innerHTML = `
|
|
<span class="usa-error-message banner-dangerous js-error-visible">
|
|
</span>`;
|
|
window.GOVUK.ErrorBanner.hideBanner();
|
|
expect(document.querySelector('.banner-dangerous').classList).toContain('display-none')
|
|
});
|
|
});
|
|
|
|
describe("The `showBanner` method", () => {
|
|
beforeEach(() => {
|
|
document.body.innerHTML = `
|
|
<span class="usa-error-message banner-dangerous js-error-visible display-none">
|
|
</span>`;
|
|
|
|
window.GOVUK.ErrorBanner.showBanner('Some Err');
|
|
});
|
|
|
|
test("Will show the element", () => {
|
|
expect(document.querySelector('.banner-dangerous').classList).not.toContain('display-none')
|
|
});
|
|
});
|
|
});
|