From dcf79b0c99e77751e770cb65c6c6d94549f4e82d Mon Sep 17 00:00:00 2001 From: Garrett Bear Date: Mon, 14 Nov 2022 13:41:03 -0800 Subject: [PATCH] Feat/16185/button primary housekeeping (#16457) * ButtonPrimary housekeeping * use sizes * update test and danger type --- .../__snapshots__/button-primary.test.js.snap | 16 ++++++++++++++++ .../button-primary/button-primary.js | 2 +- .../button-primary/button-primary.stories.js | 12 ++++++++---- .../button-primary/button-primary.test.js | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 ui/components/component-library/button-primary/__snapshots__/button-primary.test.js.snap diff --git a/ui/components/component-library/button-primary/__snapshots__/button-primary.test.js.snap b/ui/components/component-library/button-primary/__snapshots__/button-primary.test.js.snap new file mode 100644 index 000000000..786e23cda --- /dev/null +++ b/ui/components/component-library/button-primary/__snapshots__/button-primary.test.js.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ButtonPrimary should render button element correctly 1`] = ` +
+ +
+`; diff --git a/ui/components/component-library/button-primary/button-primary.js b/ui/components/component-library/button-primary/button-primary.js index 9cfadcea8..6b7fce938 100644 --- a/ui/components/component-library/button-primary/button-primary.js +++ b/ui/components/component-library/button-primary/button-primary.js @@ -32,7 +32,7 @@ ButtonPrimary.propTypes = { */ danger: PropTypes.bool, /** - * The possible size values for ButtonPrimary: 'SIZES.SM', 'SIZES.MD', 'SIZES.LG', + * Possible size values: 'SIZES.SM'(32px), 'SIZES.MD'(40px), 'SIZES.LG'(48px). * Default value is 'SIZES.MD'. */ size: PropTypes.oneOf(Object.values(BUTTON_PRIMARY_SIZES)), diff --git a/ui/components/component-library/button-primary/button-primary.stories.js b/ui/components/component-library/button-primary/button-primary.stories.js index 114b07d56..a125c6999 100644 --- a/ui/components/component-library/button-primary/button-primary.stories.js +++ b/ui/components/component-library/button-primary/button-primary.stories.js @@ -1,5 +1,9 @@ import React from 'react'; -import { ALIGN_ITEMS, DISPLAY } from '../../../helpers/constants/design-system'; +import { + ALIGN_ITEMS, + DISPLAY, + SIZES, +} from '../../../helpers/constants/design-system'; import Box from '../../ui/box/box'; import { ICON_NAMES } from '../icon'; import { ButtonPrimary } from './button-primary'; @@ -110,13 +114,13 @@ DefaultStory.storyName = 'Default'; export const Size = (args) => ( - + Small Button - + Medium (Default) Button - + Large Button diff --git a/ui/components/component-library/button-primary/button-primary.test.js b/ui/components/component-library/button-primary/button-primary.test.js index a325a04b1..83892c345 100644 --- a/ui/components/component-library/button-primary/button-primary.test.js +++ b/ui/components/component-library/button-primary/button-primary.test.js @@ -14,6 +14,7 @@ describe('ButtonPrimary', () => { expect(getByText('Button Primary')).toBeDefined(); expect(container.querySelector('button')).toBeDefined(); expect(getByTestId('button-primary')).toHaveClass('mm-button'); + expect(container).toMatchSnapshot(); }); it('should render anchor element correctly', () => {