Skip to content

Commit

Permalink
🧪 adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienwnklr committed Sep 18, 2023
1 parent f29063d commit b6833ef
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/drawer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ describe("Drawer", () => {
expect(drawer.$toolbar).toBeUndefined();
});

it("Init drawer width custom toolbar", () => {
it("Init drawer with default toolbar", () => {
const drawer = new Drawer(document.body.querySelector("#test") as HTMLDivElement);

expect(drawer.$toolbar).toBeInstanceOf(HTMLDivElement);
expect(drawer.$toolbar.querySelectorAll("button, input").length).toEqual(12);
});

it("Init drawer with custom toolbar", () => {
const drawer = new Drawer(
document.body.querySelector("#test") as HTMLDivElement,
{ defaultToolbar: false, autoSave: false }
Expand Down Expand Up @@ -82,6 +89,6 @@ describe("Drawer", () => {
drawer.changeTool("eraser");
expect(drawer.activeTool).toEqual("eraser");
expect(drawer.$eraserBtn.classList.contains("active")).toEqual(true);
})
});
});

0 comments on commit b6833ef

Please sign in to comment.