Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbraak committed Nov 2, 2024
1 parent e41c99b commit 1577e25
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/nodeElement/borderDropHint.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import BorderDropHint from "../../nodeElement/borderDropHint";

it("creates an element", () => {
const element = document.createElement("div");

const jqTreeElement = document.createElement("div");
jqTreeElement.classList.add("jqtree-element");
element.append(jqTreeElement);

new BorderDropHint(element, 0);

expect(jqTreeElement.children.length).toBe(1);
expect(jqTreeElement.children[0]).toHaveClass("jqtree-border");
});

it("doesn't create an element if the node doesn't have a jqtree-element child", () => {
const element = document.createElement("div");

new BorderDropHint(element, 0);

expect(element.children).toBeEmpty();
});

0 comments on commit 1577e25

Please sign in to comment.