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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
FieldRow,
FieldError,
FieldHint,
FieldDescription,
Accordion,
AccordionItem,
ModalHeader,
Expand Down Expand Up @@ -315,7 +314,7 @@ const CreateChannelModal = ({ teamId = '', onClose, reload }: CreateChannelModal
)}
/>
</FieldRow>
<FieldDescription id={`${encryptedId}-hint`}>{getEncryptedHint({ isPrivate, encrypted })}</FieldDescription>
<FieldHint id={`${encryptedId}-hint`}>{getEncryptedHint({ isPrivate, encrypted })}</FieldHint>
</Field>
<Field>
<FieldRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
FieldLabel,
FieldRow,
FieldError,
FieldDescription,
FieldHint,
Accordion,
AccordionItem,
Expand Down Expand Up @@ -241,9 +240,9 @@ const CreateTeamModal = ({ onClose }: CreateTeamModalProps) => {
)}
/>
</FieldRow>
<FieldDescription id={`${privateId}-hint`}>
<FieldHint id={`${privateId}-hint`}>
{isPrivate ? t('People_can_only_join_by_being_invited') : t('Anyone_can_access')}
</FieldDescription>
</FieldHint>
</Field>
</FieldGroup>
<Accordion>
Expand All @@ -270,7 +269,7 @@ const CreateTeamModal = ({ onClose }: CreateTeamModalProps) => {
)}
/>
</FieldRow>
<FieldDescription id={`${encryptedId}-hint`}>{getEncryptedHint({ isPrivate, encrypted })}</FieldDescription>
<FieldHint id={`${encryptedId}-hint`}>{getEncryptedHint({ isPrivate, encrypted })}</FieldHint>
</Field>
<Field>
<FieldRow>
Expand All @@ -290,9 +289,9 @@ const CreateTeamModal = ({ onClose }: CreateTeamModalProps) => {
)}
/>
</FieldRow>
<FieldDescription id={`${readOnlyId}-hint`}>
<FieldHint id={`${readOnlyId}-hint`}>
{readOnly ? t('Read_only_field_hint_enabled', { roomType: 'team' }) : t('Anyone_can_send_new_messages')}
</FieldDescription>
</FieldHint>
</Field>
<Field>
<FieldRow>
Expand All @@ -311,7 +310,7 @@ const CreateTeamModal = ({ onClose }: CreateTeamModalProps) => {
)}
/>
</FieldRow>
{broadcast && <FieldDescription id={`${broadcastId}-hint`}>{t('Teams_New_Broadcast_Description')}</FieldDescription>}
{broadcast && <FieldHint id={`${broadcastId}-hint`}>{t('Teams_New_Broadcast_Description')}</FieldHint>}
</Field>
</FieldGroup>
</AccordionItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { composeStories } from '@storybook/react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';

import CreateChannelModal from './CreateChannelModal';
import * as stories from './CreateChannelModal.stories';
import { testCreateChannelModal } from '../../../NavBarV2/NavBarPagesGroup/actions/testCreateChannelModal';

jest.mock('../../../lib/utils/goToRoomById', () => ({
goToRoomById: jest.fn(),
}));

testCreateChannelModal(CreateChannelModal);

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

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

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

const results = await axe(container);
expect(results).toHaveNoViolations();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Meta, StoryFn } from '@storybook/react';

import CreateChanelModal from './CreateChannelModal';
import CreateChannelModalV2 from '../../../NavBarV2/NavBarPagesGroup/actions/CreateChannelModal';

export default {
title: 'views/sidebar/CreateChanelModal',
component: CreateChanelModal,
} satisfies Meta<typeof CreateChanelModal>;

export const Default: StoryFn<typeof CreateChanelModal> = (args) => <CreateChanelModal {...args} />;
export const DefaultVersion2: StoryFn<typeof CreateChannelModalV2> = (args) => <CreateChannelModalV2 {...args} />;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
FieldRow,
FieldError,
FieldHint,
FieldDescription,
Accordion,
AccordionItem,
ModalHeader,
Expand Down Expand Up @@ -311,7 +310,7 @@ const CreateChannelModal = ({ teamId = '', mainRoom, onClose, reload }: CreateCh
)}
/>
</FieldRow>
<FieldDescription id={`${encryptedId}-hint`}>{getEncryptedHint({ isPrivate, encrypted })}</FieldDescription>
<FieldHint id={`${encryptedId}-hint`}>{getEncryptedHint({ isPrivate, encrypted })}</FieldHint>
</Field>
<Field>
<FieldRow>
Expand Down
Loading
Loading