Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-bikes-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/fuselage': patch
---

fix(fuselage): SidebarItemV2 visual regressions
29 changes: 29 additions & 0 deletions packages/fuselage/src/components/Sidebar/SidebarItem.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { composeStories } from '@storybook/react-webpack5';
import { axe } from 'jest-axe';

import { render } from '../../testing';

import * as stories from './SidebarItem.stories';

const testCases = Object.values(composeStories(stories)).map((Story) => [
Story.storyName || 'Story',
Story,
]);

test.each(testCases)(
`renders %s without crashing`,
async (_storyname, Story) => {
const tree = render(<Story />);
expect(tree.baseElement).toMatchSnapshot();
},
);

test.each(testCases)(
'%s should have no a11y violations',
async (_storyname, Story) => {
const { container } = render(<Story />);

const results = await axe(container);
expect(results).toHaveNoViolations();
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ export default {
},
} satisfies Meta<typeof SidebarItem>;

const sidebarItemActions = (
<SidebarItemActions>
<SidebarItemAction aria-label='accept' secondary success icon='phone' />
<SidebarItemAction
aria-label='cancel'
secondary
danger
icon='circle-cross'
/>
<SidebarItemAction aria-label='delete' secondary info icon='trash' />
<SidebarItemAction aria-label='accept' secondary icon='phone' />
</SidebarItemActions>
);

export const Default: StoryFn<typeof SidebarItem> = () => (
<>
<SidebarItem>
Expand All @@ -50,14 +64,7 @@ export const Default: StoryFn<typeof SidebarItem> = () => (
</SidebarItemTitle>
</SidebarItemWrapper>
</SidebarItemContent>
<SidebarItemContainer>
<SidebarItemActions>
<SidebarItemAction secondary success icon='phone' />
<SidebarItemAction secondary danger icon='circle-cross' />
<SidebarItemAction secondary info icon='trash' />
<SidebarItemAction secondary icon='phone' />
</SidebarItemActions>
</SidebarItemContainer>
<SidebarItemContainer>{sidebarItemActions}</SidebarItemContainer>
</SidebarItem>

<SidebarItem highlighted is='a'>
Expand All @@ -75,14 +82,7 @@ export const Default: StoryFn<typeof SidebarItem> = () => (
<SidebarItemTitle>highlighted</SidebarItemTitle>
</SidebarItemWrapper>
</SidebarItemContent>
<SidebarItemContainer>
<SidebarItemActions>
<SidebarItemAction secondary success icon='phone' />
<SidebarItemAction secondary danger icon='circle-cross' />
<SidebarItemAction secondary info icon='trash' />
<SidebarItemAction secondary icon='phone' />
</SidebarItemActions>
</SidebarItemContainer>
<SidebarItemContainer />
</SidebarItem>
<SidebarItem selected is='a'>
<SidebarItemAvatar>
Expand All @@ -102,14 +102,7 @@ export const Default: StoryFn<typeof SidebarItem> = () => (
</SidebarItemTitle>
</SidebarItemWrapper>
</SidebarItemContent>
<SidebarItemContainer>
<SidebarItemActions>
<SidebarItemAction secondary success icon='phone' />
<SidebarItemAction secondary danger icon='circle-cross' />
<SidebarItemAction secondary info icon='trash' />
<SidebarItemAction secondary icon='phone' />
</SidebarItemActions>
</SidebarItemContainer>
<SidebarItemContainer>{sidebarItemActions}</SidebarItemContainer>
</SidebarItem>
<SidebarItem is='a'>
<SidebarItemAvatar>
Expand Down Expand Up @@ -140,12 +133,7 @@ export const Default: StoryFn<typeof SidebarItem> = () => (
</SidebarItemContent>
</SidebarItemContent>
<SidebarItemContainer>
<SidebarItemActions>
<SidebarItemAction secondary success icon='phone' />
<SidebarItemAction secondary danger icon='circle-cross' />
<SidebarItemAction secondary info icon='trash' />
<SidebarItemAction secondary icon='phone' />
</SidebarItemActions>
<SidebarItemContainer>{sidebarItemActions}</SidebarItemContainer>
</SidebarItemContainer>
</SidebarItem>
</>
Expand Down
Loading
Loading