-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cf43bd
commit d1de2d7
Showing
4 changed files
with
89 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { expect, test } from "@playwright/test" | ||
|
||
test.describe("CategoryBar Component", () => { | ||
const STORY_URL = | ||
"http://localhost:6006/?path=/story/visualization-categorybar--default" | ||
|
||
test("renders the category bar component", async ({ page }) => { | ||
await page.goto(STORY_URL) | ||
const storyFrame = page.frameLocator( | ||
'iframe[title="storybook-preview-iframe"]', | ||
) | ||
|
||
await expect(storyFrame.getByTestId("category-bar")).toBeVisible() | ||
}) | ||
|
||
test("displays correct label values", async ({ page }) => { | ||
await page.goto(STORY_URL) | ||
const storyFrame = page.frameLocator( | ||
'iframe[title="storybook-preview-iframe"]', | ||
) | ||
await expect(storyFrame.getByText("0").first()).toBeVisible() | ||
await expect(storyFrame.getByText("70")).toBeVisible() | ||
await expect(storyFrame.getByText("88")).toBeVisible() | ||
await expect(storyFrame.getByText("100")).toBeVisible() | ||
}) | ||
|
||
test("renders all category segments", async ({ page }) => { | ||
await page.goto(STORY_URL) | ||
const storyFrame = page.frameLocator( | ||
'iframe[title="storybook-preview-iframe"]', | ||
) | ||
const categoryBar = storyFrame.getByTestId("category-bar") | ||
const segments = categoryBar.locator("div.h-full[style*='width']") | ||
|
||
await expect(segments).toHaveCount(3) | ||
}) | ||
|
||
test("renders with marker when provided", async ({ page }) => { | ||
await page.goto( | ||
"http://localhost:6006/?path=/story/visualization-categorybar--with-marker", | ||
) | ||
const storyFrame = page.frameLocator( | ||
'iframe[title="storybook-preview-iframe"]', | ||
) | ||
|
||
const marker = storyFrame.locator(".absolute.w-2.-translate-x-1\\/2") | ||
await expect(marker).toBeVisible() | ||
}) | ||
|
||
test("handles marker tooltip interaction", async ({ page }) => { | ||
await page.goto( | ||
"http://localhost:6006/?path=/story/visualization-categorybar--with-marker", | ||
) | ||
const storyFrame = page.frameLocator( | ||
'iframe[title="storybook-preview-iframe"]', | ||
) | ||
|
||
const marker = storyFrame.locator(".absolute.w-2.-translate-x-1\\/2") | ||
await marker.hover() | ||
}) | ||
|
||
test("maintains accessibility attributes", async ({ page }) => { | ||
await page.goto(STORY_URL) | ||
const storyFrame = page.frameLocator( | ||
'iframe[title="storybook-preview-iframe"]', | ||
) | ||
const categoryBar = storyFrame.getByTestId("category-bar") | ||
|
||
await expect(categoryBar).toHaveAttribute("aria-label", "Category bar") | ||
await expect(categoryBar).toHaveAttribute("tremor-id", "tremor-raw") | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Tremor Category Bar Changelog | ||
|
||
## 0.0.3 | ||
|
||
### Changes | ||
|
||
- Fix: Hidden aria elements | ||
|
||
## 0.0.2 | ||
|
||
### Changes | ||
|