diff options
Diffstat (limited to 'src/components/organisms/modals')
3 files changed, 13 insertions, 47 deletions
diff --git a/src/components/organisms/modals/settings-modal.stories.tsx b/src/components/organisms/modals/settings-modal.stories.tsx index 7af0d60..57ce00f 100644 --- a/src/components/organisms/modals/settings-modal.stories.tsx +++ b/src/components/organisms/modals/settings-modal.stories.tsx @@ -1,6 +1,5 @@ -import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { storageKey as ackeeStorageKey } from '../../organisms/forms/ackee-toggle/ackee-toggle.fixture'; -import { storageKey as motionStorageKey } from '../../organisms/forms/motion-toggle/motion-toggle.fixture'; +import type { ComponentMeta, ComponentStory } from '@storybook/react'; +import { storageKey as motionStorageKey } from '../forms/motion-toggle/motion-toggle.fixture'; import { SettingsModal } from './settings-modal'; /** @@ -10,16 +9,6 @@ export default { title: 'Organisms/Modals', component: SettingsModal, argTypes: { - ackeeStorageKey: { - control: { - type: 'text', - }, - description: 'A local storage key for Ackee.', - type: { - name: 'string', - required: true, - }, - }, className: { control: { type: 'text', @@ -71,6 +60,5 @@ const Template: ComponentStory<typeof SettingsModal> = (args) => ( */ export const Settings = Template.bind({}); Settings.args = { - ackeeStorageKey, motionStorageKey, }; diff --git a/src/components/organisms/modals/settings-modal.test.tsx b/src/components/organisms/modals/settings-modal.test.tsx index bb0cdf2..26d046a 100644 --- a/src/components/organisms/modals/settings-modal.test.tsx +++ b/src/components/organisms/modals/settings-modal.test.tsx @@ -1,41 +1,30 @@ import { describe, expect, it } from '@jest/globals'; -import { render, screen } from '../../../../tests/utils'; -import { storageKey as ackeeStorageKey } from '../../organisms/forms/ackee-toggle/ackee-toggle.fixture'; -import { storageKey as motionStorageKey } from '../../organisms/forms/motion-toggle/motion-toggle.fixture'; +import { render, screen as rtlScreen } from '../../../../tests/utils'; +import { storageKey as motionStorageKey } from '../forms/motion-toggle/motion-toggle.fixture'; import { SettingsModal } from './settings-modal'; describe('SettingsModal', () => { it('renders the modal heading', () => { - render( - <SettingsModal - ackeeStorageKey={ackeeStorageKey} - motionStorageKey={motionStorageKey} - /> - ); - expect(screen.getByText(/Settings/i)).toBeInTheDocument(); + render(<SettingsModal motionStorageKey={motionStorageKey} />); + expect(rtlScreen.getByText(/Settings/i)).toBeInTheDocument(); }); it('renders a settings form', () => { - render( - <SettingsModal - ackeeStorageKey={ackeeStorageKey} - motionStorageKey={motionStorageKey} - /> - ); + render(<SettingsModal motionStorageKey={motionStorageKey} />); expect( - screen.getByRole('form', { name: /^Settings form/i }) + rtlScreen.getByRole('form', { name: /^Settings form/i }) ).toBeInTheDocument(); expect( - screen.getByRole('radiogroup', { name: /^Theme:/i }) + rtlScreen.getByRole('radiogroup', { name: /^Theme:/i }) ).toBeInTheDocument(); expect( - screen.getByRole('radiogroup', { name: /^Code blocks:/i }) + rtlScreen.getByRole('radiogroup', { name: /^Code blocks:/i }) ).toBeInTheDocument(); expect( - screen.getByRole('radiogroup', { name: /^Animations:/i }) + rtlScreen.getByRole('radiogroup', { name: /^Animations:/i }) ).toBeInTheDocument(); expect( - screen.getByRole('radiogroup', { name: /^Tracking:/i }) + rtlScreen.getByRole('radiogroup', { name: /^Tracking:/i }) ).toBeInTheDocument(); }); }); diff --git a/src/components/organisms/modals/settings-modal.tsx b/src/components/organisms/modals/settings-modal.tsx index 5a53bbd..f62312b 100644 --- a/src/components/organisms/modals/settings-modal.tsx +++ b/src/components/organisms/modals/settings-modal.tsx @@ -3,7 +3,6 @@ import { useIntl } from 'react-intl'; import { Form, Heading, Icon, Modal, type ModalProps } from '../../atoms'; import { AckeeToggle, - type AckeeToggleProps, MotionToggle, type MotionToggleProps, PrismThemeToggle, @@ -13,10 +12,6 @@ import styles from './settings-modal.module.scss'; export type SettingsModalProps = Pick<ModalProps, 'className'> & { /** - * The local storage key for Ackee settings. - */ - ackeeStorageKey: AckeeToggleProps['storageKey']; - /** * The local storage key for Reduce motion settings. */ motionStorageKey: MotionToggleProps['storageKey']; @@ -29,7 +24,6 @@ export type SettingsModalProps = Pick<ModalProps, 'className'> & { */ export const SettingsModal: FC<SettingsModalProps> = ({ className = '', - ackeeStorageKey, motionStorageKey, }) => { const intl = useIntl(); @@ -70,12 +64,7 @@ export const SettingsModal: FC<SettingsModalProps> = ({ defaultValue="on" storageKey={motionStorageKey} /> - <AckeeToggle - className={styles.item} - direction="upwards" - defaultValue="full" - storageKey={ackeeStorageKey} - /> + <AckeeToggle className={styles.item} direction="upwards" /> </Form> </Modal> ); |
