Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbraak committed Apr 1, 2024
1 parent ea4a1b3 commit 9f0b943
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/jqTree/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,20 @@ describe("dataUrl", () => {
});
});
});

it("loads the data and selects the node based on the state", async () => {
localStorage.setItem("tree", '{"selected_node":[124]}');

given.$tree.tree({
dataUrl: { url: "/tree/" },
saveState: true,
});

await screen.findByText("node1");
expect((given.$tree.tree("getSelectedNode") as INode).name).toEqual(

Check failure on line 314 in src/test/jqTree/options.test.ts

View workflow job for this annotation

GitHub Actions / runner-job

Use `toBe` when expecting primitive literals
"node2",
);
});
});

describe("onCanSelectNode", () => {
Expand Down

0 comments on commit 9f0b943

Please sign in to comment.