diff --git a/src/stories/Navigation.stories.tsx b/src/stories/Navigation.stories.tsx index 4bd4180..cf6d7c2 100644 --- a/src/stories/Navigation.stories.tsx +++ b/src/stories/Navigation.stories.tsx @@ -1,16 +1,19 @@ import { Meta, StoryObj } from '@storybook/react'; -import Navigation from '../components/Navigation/Navigation'; +import { expect } from '@storybook/jest'; +import { userEvent, within } from '@storybook/testing-library'; import { useState } from 'react'; import { - SVGNavActiveFeed, - SVGNavActiveProfile, - SVGNavFeed, - SVGNavProfile, - SVGNavWrite24, + SVGNavAlarm, + SVGNavAlarmFilled, + SVGNavEdit, + SVGNavEditFilled, + SVGNavHome, + SVGNavHomeFilled, + SVGNavUser, + SVGNavUserFilled, } from '../.'; -import { userEvent, within } from '@storybook/testing-library'; -import { expect } from '@storybook/jest'; +import Navigation from '../components/Navigation/Navigation'; const meta = { title: 'Components/Navigation', @@ -29,89 +32,97 @@ type Story = StoryObj; export const Default: Story = { render: () => { - const [navPosition, setNavPosition] = useState<'left' | 'center' | 'right'>( - 'center', - ); + const [navPosition, setNavPosition] = useState< + 'home' | 'edit' | 'alarm' | 'user' + >('alarm'); return ( - <> -
- - setNavPosition('left')}> - {navPosition === 'left' ? : } - - setNavPosition('center')} - > - - - setNavPosition('right')}> - {navPosition === 'right' ? ( - - ) : ( - - )} - - - + + setNavPosition('home')}> + {navPosition === 'home' ? : } + + setNavPosition('edit')}> + {navPosition === 'edit' ? : } + + setNavPosition('alarm')}> + {navPosition === 'alarm' ? : } + + setNavPosition('user')}> + {navPosition === 'user' ? : } + + ); }, }; export const InteractionTest: Story = { render: () => { - const [navPosition, setNavPosition] = useState<'left' | 'center' | 'right'>( - 'center', - ); + const [navPosition, setNavPosition] = useState< + 'home' | 'edit' | 'alarm' | 'user' + >('alarm'); return ( - <> -
- - setNavPosition('left')} - > - {navPosition === 'left' ? : } - - setNavPosition('center')} - > - - - setNavPosition('right')} - > - {navPosition === 'right' ? ( - - ) : ( - - )} - - - + + setNavPosition('home')} + > + {navPosition === 'home' ? : } + + setNavPosition('edit')} + > + {navPosition === 'edit' ? : } + + setNavPosition('alarm')} + > + {navPosition === 'alarm' ? : } + + setNavPosition('user')} + > + {navPosition === 'user' ? : } + + ); }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); const navigationItems = await canvas.findAllByTestId('navigation-item'); - const [feed, my] = [navigationItems[0], navigationItems[2]]; - const SVGDisActivatedFeed = feed.children[0]; - const SVGDisActivatedMy = my.children[0]; + const [home, edit, alarm, user] = [ + navigationItems[0], + navigationItems[1], + navigationItems[2], + navigationItems[3], + ]; + const SVGDisActivatedFeed = home.children[0]; + const SVGDisActivatedMy = edit.children[0]; + const SVGDisActivatedAlarm = alarm.children[0]; + const SVGDisActivatedUser = user.children[0]; - await userEvent.click(feed, { + await userEvent.click(home, { delay: 300, }); expect(SVGDisActivatedFeed).not.toBeInTheDocument(); - await userEvent.click(my, { + await userEvent.click(edit, { delay: 300, }); expect(SVGDisActivatedMy).not.toBeInTheDocument(); + + await userEvent.click(alarm, { + delay: 300, + }); + expect(SVGDisActivatedAlarm).not.toBeInTheDocument(); + + await userEvent.click(user, { + delay: 300, + }); + expect(SVGDisActivatedUser).not.toBeInTheDocument(); }, };