Loader tests
This commit is contained in:
parent
21a03aed8c
commit
be4524e5ad
1 changed files with 54 additions and 0 deletions
|
|
@ -28,4 +28,58 @@ describe("loader.vue", () => {
|
|||
loaderPosition: "left",
|
||||
});
|
||||
});
|
||||
|
||||
describe("Blocking interaction on page", () => {
|
||||
test("Does capture clicks if enabled (default)", async () => {
|
||||
// Arrange
|
||||
const div = document.createElement("div");
|
||||
div.id = "parent";
|
||||
document.body.appendChild(div);
|
||||
|
||||
const parentClickFn = jest.fn();
|
||||
|
||||
div.addEventListener("click", parentClickFn);
|
||||
|
||||
const wrapper = shallowMount(loader, {
|
||||
props: {},
|
||||
attachTo: "#parent",
|
||||
});
|
||||
|
||||
// Act
|
||||
await wrapper.trigger("click");
|
||||
|
||||
// Assert
|
||||
expect(parentClickFn).not.toBeCalled();
|
||||
|
||||
// Cleanup
|
||||
document.body.removeChild(div);
|
||||
});
|
||||
|
||||
test("Does not capture clicks if disabled", async () => {
|
||||
// Arrange
|
||||
const div = document.createElement("div");
|
||||
div.id = "parent";
|
||||
document.body.appendChild(div);
|
||||
|
||||
const parentClickFn = jest.fn();
|
||||
|
||||
div.addEventListener("click", parentClickFn);
|
||||
|
||||
const wrapper = shallowMount(loader, {
|
||||
props: {
|
||||
allowPageInteraction: true,
|
||||
},
|
||||
attachTo: "#parent",
|
||||
});
|
||||
|
||||
// Act
|
||||
await wrapper.trigger("click");
|
||||
|
||||
// Assert
|
||||
expect(parentClickFn).toBeCalled();
|
||||
|
||||
// Cleanup
|
||||
document.body.removeChild(div);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue