From bd4a51b7b370828ca4882f1addd44c878e4ae8b4 Mon Sep 17 00:00:00 2001 From: Brandon Lenz Date: Fri, 26 Mar 2021 09:23:01 -0400 Subject: [PATCH 01/12] Bump uswds version --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1fb6f8e086..c0b48c5fc0 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "peerDependencies": { "react": "^16.x || ^17.x", "react-dom": "^16.x || ^17.x", - "uswds": "2.8.1" + "uswds": "2.9.0" }, "devDependencies": { "@babel/core": "^7.10.5", @@ -126,7 +126,7 @@ "ts-jest": "^26.1.2", "typescript": "^3.8.0", "url-loader": "^4.0.0", - "uswds": "2.8.1", + "uswds": "2.9.0", "webpack": "^4.41.0", "webpack-cli": "^4.0.0" }, diff --git a/yarn.lock b/yarn.lock index 0648deaaee..8adee7c173 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13939,10 +13939,10 @@ use@^3.1.0: resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== -uswds@2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/uswds/-/uswds-2.8.1.tgz#937505ad8f7be4c131e6d4e01d0128cf0995a49c" - integrity sha512-x7RkaVFVuRxptsuUZka6Mc+wUUL98keorOUFVxrBIgd3KV18upuF5V7osm9sN/q6bGvwh2zJyfONETLUU8Eemg== +uswds@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/uswds/-/uswds-2.9.0.tgz#002089d74582960099b0ee836f89f043cdf6d0bc" + integrity sha512-5IMVgMCUUlgWVFrB7Wf1qTvv5L3oDDlSsAgvJ02+/sV2uh4JzO9YPm3493RTaMuHTc+feRCuYyEIloXsEQY0Pg== dependencies: classlist-polyfill "^1.0.3" del "^5.1.0" From 646de4e3ce775770c6659267068c59a4841bd86d Mon Sep 17 00:00:00 2001 From: Brandon Lenz Date: Fri, 26 Mar 2021 09:43:10 -0400 Subject: [PATCH 02/12] Add accent style warm to Button component --- src/components/Button/Button.stories.tsx | 10 ++++++-- src/components/Button/Button.test.tsx | 32 ++++++++++++++++++++++++ src/components/Button/Button.tsx | 14 +++++++++-- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/components/Button/Button.stories.tsx b/src/components/Button/Button.stories.tsx index 1c0872821f..9193638511 100644 --- a/src/components/Button/Button.stories.tsx +++ b/src/components/Button/Button.stories.tsx @@ -27,8 +27,14 @@ export const secondary = (): React.ReactElement => ( ) -export const accent = (): React.ReactElement => ( - +) + +export const accentWarm = (): React.ReactElement => ( + ) diff --git a/src/components/Button/Button.test.tsx b/src/components/Button/Button.test.tsx index 4a38fa7477..8d20e2a1a8 100644 --- a/src/components/Button/Button.test.tsx +++ b/src/components/Button/Button.test.tsx @@ -53,6 +53,27 @@ describe('Button component', () => { expect(queryByTestId('button')).toHaveClass('usa-button--big') expect(deprecationWarning).toHaveBeenCalledTimes(0) }) + + it('renders uswds class for cool accent style', () => { + const { queryByTestId } = render( + + ) + expect(queryByTestId('button')).toHaveClass('usa-button--accent-cool') + expect(deprecationWarning).toHaveBeenCalledTimes(0) + }) + + it('renders uswds class for warm accent style', () => { + const { queryByTestId } = render( + + ) + expect(queryByTestId('button')).toHaveClass('usa-button--accent-warm') + expect(deprecationWarning).toHaveBeenCalledTimes(0) + }) + }) it('implements an onClick handler', () => { @@ -67,6 +88,17 @@ describe('Button component', () => { expect(onClickFn).toHaveBeenCalledTimes(1) }) + it('shows a deprecation warning for prop \'accent\'', () => { + const onClickFn = jest.fn() + const { getByText } = render( + + ) + + expect(deprecationWarning).toHaveBeenCalledTimes(1) + }) + it('accepts additional custom class names', () => { const { getByTestId } = render( + ) + expect(queryByTestId('button')).toHaveClass('usa-button--accent-cool') + expect(deprecationWarning).toHaveBeenCalledTimes(1) + }) + }) it('implements an onClick handler', () => { @@ -88,17 +98,6 @@ describe('Button component', () => { expect(onClickFn).toHaveBeenCalledTimes(1) }) - it('shows a deprecation warning for prop \'accent\'', () => { - const onClickFn = jest.fn() - const { getByText } = render( - - ) - - expect(deprecationWarning).toHaveBeenCalledTimes(1) - }) - it('accepts additional custom class names', () => { const { getByTestId } = render(