Skip to content

Commit

Permalink
storybook test with jim (#322)
Browse files Browse the repository at this point in the history
Co-authored-by: ethangardner <[email protected]>
Co-authored-by: Ethan Gardner <[email protected]>
  • Loading branch information
3 people authored Oct 15, 2024
1 parent 6054a64 commit b21c1e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ 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']],
] as const;
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']],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -30,12 +32,19 @@ export default storyConfig;

export const Basic: StoryObj<typeof CheckboxPatternEdit> = {
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();
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit b21c1e7

Please sign in to comment.