-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fid dnd to first child * Build * Changelog * Test * Use switch * Build * Move generateHitAreas test * Add test for ghostDropHint
- Loading branch information
Showing
9 changed files
with
155 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Node } from "../../node"; | ||
import GhostDropHint from "../../nodeElement/ghostDropHint"; | ||
import { Position } from "../../position"; | ||
|
||
beforeEach(() => { | ||
document.body.innerHTML = ""; | ||
}); | ||
|
||
it("creates a hint element after the node element when the position is After", () => { | ||
const nodeElement = document.createElement("div"); | ||
document.body.append(nodeElement); | ||
|
||
const node = new Node(); | ||
new GhostDropHint(node, nodeElement, Position.After); | ||
|
||
expect(nodeElement.nextSibling).toHaveClass("jqtree-ghost"); | ||
expect(nodeElement.previousSibling).toBeNull(); | ||
expect(nodeElement.children).toBeEmpty(); | ||
}); | ||
|
||
it("creates a hint element after the node element when the position is Before", () => { | ||
const nodeElement = document.createElement("div"); | ||
document.body.append(nodeElement); | ||
|
||
const node = new Node(); | ||
new GhostDropHint(node, nodeElement, Position.Before); | ||
|
||
expect(nodeElement.previousSibling).toHaveClass("jqtree-ghost"); | ||
expect(nodeElement.nextSibling).toBeNull(); | ||
expect(nodeElement.children).toBeEmpty(); | ||
}); | ||
|
||
it("creates a hint element after the node element when the position is Inside and the node is an open folder", () => { | ||
const nodeElement = document.createElement("div"); | ||
document.body.append(nodeElement); | ||
|
||
const childElement = document.createElement("div"); | ||
nodeElement.append(childElement); | ||
|
||
const node = new Node({ is_open: true }); | ||
const childNode = new Node(); | ||
childNode.element = childElement; | ||
node.addChild(childNode); | ||
|
||
new GhostDropHint(node, nodeElement, Position.Inside); | ||
|
||
expect(nodeElement.previousSibling).toBeNull(); | ||
expect(nodeElement.nextSibling).toBeNull(); | ||
expect(nodeElement.children.length).toBe(2); | ||
expect(nodeElement.children[0]).toHaveClass("jqtree-ghost"); | ||
}); | ||
|
||
it("creates a hint element after the node element when the position is Inside and the node is a closed folder", () => { | ||
const nodeElement = document.createElement("div"); | ||
document.body.append(nodeElement); | ||
|
||
const node = new Node(); | ||
node.addChild(new Node()); | ||
|
||
new GhostDropHint(node, nodeElement, Position.Inside); | ||
|
||
expect(nodeElement.nextSibling).toHaveClass("jqtree-ghost"); | ||
expect(nodeElement.previousSibling).toBeNull(); | ||
expect(nodeElement.children).toBeEmpty(); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.