import { showEmptyDatasetModal } from "modal";
describe("Empty data set modal", () => {
describe("When a modal element exists on the page", () => {
beforeEach(() => {
document.body.innerHTML = `
Modal title
Modal body text goes here.
`;
});
it("Adds a class to make the modal visible", () => {
showEmptyDatasetModal();
const modal = document.querySelector(".modal");
expect(modal.classList.contains('show')).toBe(true);
});
});
describe("When a modal doesn't exist on the page", () => {
beforeEach(() => {
document.body.innerHTML = `
`
})
it("ignores the content", () =>{
showEmptyDatasetModal();
const modal = document.querySelector(".modal");
expect(modal).toBe(null);
})
})
});