Skip to content

Commit

Permalink
Merge pull request #73 from palmetto/hotfix-svg-build
Browse files Browse the repository at this point in the history
fixing broken builds with svg
  • Loading branch information
juanfabrega authored Jul 10, 2020
2 parents 81ebf61 + 01b5e52 commit 3821558
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@storybook/addon-viewport": "^5.3.19",
"@storybook/addons": "^5.3.19",
"@storybook/react": "^5.3.19",
"@svgr/rollup": "^5.4.0",
"@svgr/webpack": "^5.4.0",
"@testing-library/jest-dom": "^5.5.0",
"@testing-library/react": "^10.0.2",
Expand Down
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import postcss from 'rollup-plugin-postcss';
import copy from 'rollup-plugin-copy';
import cleaner from 'rollup-plugin-cleaner';
import svg from 'rollup-plugin-svg';
import svgr from '@svgr/rollup';

const packageJson = require('./package.json');

Expand Down Expand Up @@ -55,5 +56,6 @@ export default {
],
}),
svg(),
svgr(),
],
};
12 changes: 10 additions & 2 deletions src/components/TextInput/TextInput.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,28 @@ describe('TextInput', () => {
*/
test('Throws error if required prop "value" is not supplied to component', () => {
console.error = jest.fn(); // eslint-disable-line no-console
render(<TextInput onChange={() => null} />);
render(<TextInput onChange={() => null} id="myId" />);
expect(console.error).toHaveBeenCalledTimes(1); // eslint-disable-line no-console
expect(console.error.mock.calls[0][0]) // eslint-disable-line no-console
.toContain('Failed prop type: The prop `value`');
});

test('Throws error if required prop "onChange" is not supplied to component', () => {
console.error = jest.fn(); // eslint-disable-line no-console
render(<TextInput value="hello" />);
render(<TextInput value="hello" id="myId" />);
expect(console.error).toHaveBeenCalledTimes(1); // eslint-disable-line no-console
expect(console.error.mock.calls[0][0]) // eslint-disable-line no-console
.toContain('Failed prop type: The prop `onChange`');
});

test('Throws error if required prop "id" is not supplied to component', () => {
console.error = jest.fn(); // eslint-disable-line no-console
render(<TextInput value="hello" onChange={() => null} />);
expect(console.error).toHaveBeenCalledTimes(1); // eslint-disable-line no-console
expect(console.error.mock.calls[0][0]) // eslint-disable-line no-console
.toContain('Failed prop type: The prop `id`');
});

test('Throws an error if "type" prop is anything other than allowed values', () => {
console.error = jest.fn(); // eslint-disable-line no-console
render(<TextInput onChange={() => null} value="hello" type="notOnTheList" />);
Expand Down
16 changes: 15 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"

"@babel/plugin-transform-react-constant-elements@^7.0.0", "@babel/plugin-transform-react-constant-elements@^7.2.0", "@babel/plugin-transform-react-constant-elements@^7.6.3", "@babel/plugin-transform-react-constant-elements@^7.9.0":
"@babel/plugin-transform-react-constant-elements@^7.0.0", "@babel/plugin-transform-react-constant-elements@^7.2.0", "@babel/plugin-transform-react-constant-elements@^7.6.3", "@babel/plugin-transform-react-constant-elements@^7.7.4", "@babel/plugin-transform-react-constant-elements@^7.9.0":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.10.4.tgz#0f485260bf1c29012bb973e7e404749eaac12c9e"
integrity sha512-cYmQBW1pXrqBte1raMkAulXmi7rjg3VI6ZLg9QIic8Hq7BtYXaWuZSxsr2siOMI6SWwpxjWfnwhTUrd7JlAV7g==
Expand Down Expand Up @@ -3331,6 +3331,20 @@
merge-deep "^3.0.2"
svgo "^1.2.2"

"@svgr/rollup@^5.4.0":
version "5.4.0"
resolved "https://registry.yarnpkg.com/@svgr/rollup/-/rollup-5.4.0.tgz#b1946c8d2c13870397af014a105d40945b7371e5"
integrity sha512-hwYjrTddW6mFU9vwqRr1TULNvxiIxGdIbqrD5J7vtoATSfWazq/2JSnT4BmiH+/4kFXLEtjKuSKoDUotkOIAkg==
dependencies:
"@babel/core" "^7.7.5"
"@babel/plugin-transform-react-constant-elements" "^7.7.4"
"@babel/preset-env" "^7.9.5"
"@babel/preset-react" "^7.9.4"
"@svgr/core" "^5.4.0"
"@svgr/plugin-jsx" "^5.4.0"
"@svgr/plugin-svgo" "^5.4.0"
rollup-pluginutils "^2.8.2"

"@svgr/webpack@^4.0.3":
version "4.3.3"
resolved "https://registry.yarnpkg.com/@svgr/webpack/-/webpack-4.3.3.tgz#13cc2423bf3dff2d494f16b17eb7eacb86895017"
Expand Down

0 comments on commit 3821558

Please sign in to comment.