Skip to content

Commit

Permalink
tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
syedsalehinipg committed Jan 25, 2024
1 parent 51308d5 commit 792d189
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/TreeViewList/TreeViewList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,49 @@ test("should hide child when is collapsed", async ({ page }) => {
.getByText("GearSpred", { exact: true })
).toBeHidden();
});

test("should expand the parent and child nodes that match the search term", async ({
page
}) => {
await page.goto(
"http://localhost:6006/?path=/story/lists-treeviewlist--default&args=expandSearchTerm:true;searchTerm:ratio"
);
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("BRK")
).toBeVisible();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("Pedal")
).toBeVisible();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("Ratio", { exact: true })
).toBeVisible();
});

test("should not expand the child nodes when expand for search is not enabled", async ({
page
}) => {
await page.goto(
"http://localhost:6006/?path=/story/lists-treeviewlist--default&args=expandSearchTerm:false;searchTerm:ratio"
);
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("BRK")
).toBeVisible();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("Pedal")
).toBeHidden();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("Ratio", { exact: true })
).toBeHidden();
});

0 comments on commit 792d189

Please sign in to comment.