-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7773 from opengovsg/release_v6.152.0
build: release v6.152.0
- Loading branch information
Showing
19 changed files
with
544 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...rm/create/builder-and-design/BuilderAndDesignDrawer/DesignDrawer/DesignDrawer.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Meta, StoryFn } from '@storybook/react' | ||
|
||
import { FormColorTheme, FormLogoState, FormStartPage } from '~shared/types' | ||
|
||
import { createFormBuilderMocks } from '~/mocks/msw/handlers/admin-form' | ||
|
||
import { EditFieldDrawerDecorator, StoryRouter } from '~utils/storybook' | ||
|
||
import { CreatePageSidebarProvider } from '~features/admin-form/create/common' | ||
|
||
import { DesignDrawer } from './DesignDrawer' | ||
|
||
const DEFAULT_START_PAGE: FormStartPage = { | ||
logo: { state: FormLogoState.None }, | ||
colorTheme: FormColorTheme.Blue, | ||
estTimeTaken: 15, | ||
paragraph: | ||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt', | ||
} | ||
|
||
export default { | ||
title: 'Features/AdminForm/DesignDrawer', | ||
component: DesignDrawer, | ||
decorators: [ | ||
StoryRouter({ | ||
initialEntries: ['/61540ece3d4a6e50ac0cc6ff'], | ||
path: '/:formId', | ||
}), | ||
EditFieldDrawerDecorator, | ||
], | ||
parameters: { | ||
// Required so skeleton "animation" does not hide content. | ||
chromatic: { pauseAnimationAtEnd: true }, | ||
msw: [...createFormBuilderMocks({}, 0)], | ||
}, | ||
args: { | ||
startPage: DEFAULT_START_PAGE, | ||
}, | ||
} as Meta<StoryArgs> | ||
|
||
interface StoryArgs { | ||
startPage: FormStartPage | ||
} | ||
|
||
const Template: StoryFn<StoryArgs> = (args) => { | ||
return ( | ||
<CreatePageSidebarProvider> | ||
<DesignDrawer {...args} /> | ||
</CreatePageSidebarProvider> | ||
) | ||
} | ||
|
||
export const Default = Template.bind({}) | ||
|
||
export const WithEmptyParagraph = Template.bind({}) | ||
WithEmptyParagraph.args = { | ||
startPage: { ...DEFAULT_START_PAGE, paragraph: undefined }, | ||
} | ||
|
||
export const WithEmptyTimeTaken = Template.bind({}) | ||
WithEmptyTimeTaken.args = { | ||
startPage: { ...DEFAULT_START_PAGE, estTimeTaken: undefined }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,61 @@ export const Step2Empty = { | |
}, | ||
} | ||
|
||
export const Step2FixedEmailDefault = { | ||
// due to the double registration of 'workflow_type' there would be a weird interaction | ||
// where the default value will be reset | ||
// thus we have to manually select the field again | ||
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => { | ||
const canvas = within(canvasElement) | ||
await waitFor( | ||
async () => | ||
expect(await canvas.getByText('Save step')).not.toBeDisabled(), | ||
{ | ||
timeout: 5000, | ||
}, | ||
) | ||
await waitFor( | ||
async () => { | ||
await userEvent.click(await canvas.getByText('Fixed email(s)')) | ||
}, | ||
{ | ||
timeout: 5000, | ||
}, | ||
) | ||
}, | ||
args: { | ||
stepNumber: 1, | ||
defaultValues: { | ||
workflow_type: WorkflowType.Static, | ||
emails: ['[email protected]', 'invalidemail'], | ||
}, | ||
}, | ||
} | ||
export const Step2FixedEmailEmpty = { | ||
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => { | ||
const canvas = within(canvasElement) | ||
await waitFor( | ||
async () => | ||
expect(await canvas.getByText('Save step')).not.toBeDisabled(), | ||
{ | ||
timeout: 5000, | ||
}, | ||
) | ||
await waitFor( | ||
async () => { | ||
await userEvent.click(await canvas.getByText('Fixed email(s)')) | ||
}, | ||
{ | ||
timeout: 5000, | ||
}, | ||
) | ||
}, | ||
|
||
args: { | ||
stepNumber: 1, | ||
}, | ||
} | ||
|
||
export const DeletedApprovalFieldSelected = { | ||
args: { | ||
stepNumber: 1, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { Meta, StoryFn } from '@storybook/react' | |
import { times } from 'lodash' | ||
import { rest } from 'msw' | ||
|
||
import { UserId } from '~shared/types' | ||
import { | ||
AdminDashboardFormMetaDto, | ||
FormResponseMode, | ||
|
@@ -163,8 +164,38 @@ AllOpenDesktop.parameters = { | |
...BASE_MSW_HANDLERS, | ||
], | ||
} | ||
|
||
export const AllOpenDesktopNoAnnouncementModal = Template.bind({}) | ||
AllOpenDesktopNoAnnouncementModal.parameters = { | ||
...AllOpenDesktop.parameters, | ||
msw: [ | ||
...envHandlers, | ||
rest.get<AdminDashboardFormMetaDto[]>( | ||
'/api/v3/admin/forms', | ||
(req, res, ctx) => { | ||
return res(ctx.json(THIRTY_FORMS)) | ||
}, | ||
), | ||
getWorkspaces(), | ||
getUser({ | ||
delay: 0, | ||
mockUser: { | ||
...MOCK_USER, | ||
_id: 'undefined' as UserId, | ||
email: '[email protected]', | ||
}, | ||
}), | ||
], | ||
} | ||
|
||
export const AllOpenMobile = Template.bind({}) | ||
AllOpenMobile.parameters = { | ||
...Mobile.parameters, | ||
...AllOpenDesktop.parameters, | ||
} | ||
|
||
export const AllOpenMobileNoAnnouncementModal = Template.bind({}) | ||
AllOpenMobileNoAnnouncementModal.parameters = { | ||
...Mobile.parameters, | ||
...AllOpenDesktopNoAnnouncementModal.parameters, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.