diff --git a/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx b/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx index 822619df..03bdfa56 100644 --- a/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx +++ b/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx @@ -90,6 +90,7 @@ const sidebarPatterns: DropdownPattern[] = [ ['form-summary', defaultFormConfig.patterns['form-summary']], ['fieldset', defaultFormConfig.patterns['fieldset']], ['input', defaultFormConfig.patterns['input']], + ['checkbox', defaultFormConfig.patterns['checkbox']], ['paragraph', defaultFormConfig.patterns['paragraph']], ['rich-text', defaultFormConfig.patterns['rich-text']], ['radio-group', defaultFormConfig.patterns['radio-group']], @@ -97,6 +98,7 @@ const sidebarPatterns: DropdownPattern[] = [ export const fieldsetPatterns: DropdownPattern[] = [ ['form-summary', defaultFormConfig.patterns['form-summary']], ['input', defaultFormConfig.patterns['input']], + ['checkbox', defaultFormConfig.patterns['checkbox']], ['paragraph', defaultFormConfig.patterns['paragraph']], ['rich-text', defaultFormConfig.patterns['rich-text']], ['radio-group', defaultFormConfig.patterns['radio-group']], diff --git a/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.stories.tsx b/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.stories.tsx index b1c289fc..8b068562 100644 --- a/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.stories.tsx +++ b/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.stories.tsx @@ -10,6 +10,8 @@ import { } from './common/story-helper.js'; import FormEdit from '../index.js'; import { enLocale as message } from '@atj/common'; +import { expect } from '@storybook/test'; +import { within } from '@testing-library/react'; const pattern: CheckboxPattern = { id: '1', @@ -30,12 +32,19 @@ export default storyConfig; export const Basic: StoryObj = { play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + const updatedLabel = 'Updated checkbox pattern'; + await testUpdateFormFieldOnSubmit( canvasElement, message.patterns.checkbox.displayName, message.patterns.checkbox.fieldLabel, - 'Updated checkbox pattern' + updatedLabel ); + + await expect( + await canvas.findByLabelText(updatedLabel) + ).toBeInTheDocument(); }, }; diff --git a/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.test.tsx b/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.test.tsx index d34b7950..b28d8631 100644 --- a/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.test.tsx +++ b/packages/design/src/FormManager/FormEdit/components/CheckboxPatternEdit.test.tsx @@ -1,12 +1,7 @@ /** * @vitest-environment jsdom */ -import { expect, it } from 'vitest'; +import { describeStories } from '../../../test-helper.js'; +import meta, * as stories from './CheckboxPatternEdit.stories.js'; -it('Is a placeholder test for now', () => { - expect(true).to.be.true; -}); -// import { describeStories } from '../../../test-helper'; -// import meta, * as stories from './CheckboxPatternEdit.stories'; - -// describeStories(meta, stories); +describeStories(meta, stories);