Skip to content

Commit

Permalink
test(component): drop false-positive Sidebar tests
Browse files Browse the repository at this point in the history
I don't think we can rely on a fake DOM environment to test hover states correctly. We should write
integration tests for `<Sidebar collapsed/>` behavior in `cypress`.
  • Loading branch information
tulup-conner committed Jul 31, 2022
1 parent 1695af5 commit 1d05f61
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
24 changes: 0 additions & 24 deletions src/lib/components/Sidebar/Sidebar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,6 @@ describe.concurrent('Components / Sidebar', () => {
});
});

describe('`Sidebar.Collapse` and `Sidebar.Item`', () => {
it('should display tooltip', () => {
const items = getSidebarItems(render(<TestSidebar collapsed />));

items.forEach((item) => {
expect(item.firstElementChild).toHaveAttribute('data-testid', 'tooltip-target');
});
});

it("shouldn't display text content", () => {
const items = getSidebarItemContents(render(<TestSidebar collapsed />));

items.forEach((item) => expect(item).toHaveClass('hidden'));
});
});

describe('`Sidebar.Item`', () => {
it("shouldn't display `label`", () => {
const labels = getSidebarLabels(render(<TestSidebar collapsed />));

labels.forEach((label) => expect(label).not.toBeVisible());
});
});

describe('`Sidebar.Logo`', () => {
it("shouldn't display text content", () => {
const logo = getSidebarLogo(render(<TestSidebar collapsed />));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Sidebar/Sidebar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ CTAButton.args = {
</Sidebar.Items>
<Sidebar.CTA>
<div className="mb-3 flex items-center">
<Badge color="yellow">Beta</Badge>
<Badge color="warning">Beta</Badge>
<div className="-m-1.5 ml-auto">
<Button aria-label="Close" outline>
<svg className="h-4 w-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
Expand Down

0 comments on commit 1d05f61

Please sign in to comment.