Skip to content

Commit

Permalink
FIX a broken test, but using react-testing-library over enzyme & chan…
Browse files Browse the repository at this point in the history
…ging the propType of tabs
  • Loading branch information
ndelangen committed Jan 30, 2019
1 parent 899729e commit 4981740
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/components/src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const Tabs = React.memo(
Tabs.displayName = 'Tabs';
Tabs.propTypes = {
id: PropTypes.string,
children: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.func])),
children: PropTypes.node,
tools: PropTypes.node,
selected: PropTypes.string,
actions: PropTypes.shape({
Expand All @@ -154,7 +154,7 @@ Tabs.propTypes = {
};
Tabs.defaultProps = {
id: null,
children: [],
children: null,
tools: null,
selected: null,
absolute: false,
Expand Down
8 changes: 5 additions & 3 deletions lib/ui/src/settings/shortcuts.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import { shallow } from 'enzyme';
import { render } from 'react-testing-library';

import { ThemeProvider, themes } from '@storybook/theming';
import ShortcutsScreen from './shortcuts';

Expand Down Expand Up @@ -31,12 +33,12 @@ describe('ShortcutsScreen', () => {
});

it('handles a full mount', () => {
const comp = mount(
const comp = render(
<ThemeProvider theme={themes.light}>
<ShortcutsScreen shortcutKeys={shortcutKeys} {...makeActions()} />
</ThemeProvider>
);
expect(comp).toExist();
expect(comp).toBeDefined();
comp.unmount();
});

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"dependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"babel-plugin-add-react-displayname": "^0.0.5",
"eslint-plugin-html": "^5.0.0"
"eslint-plugin-html": "^5.0.0",
"react-testing-library": "^5.4.4"
},
"devDependencies": {
"@angular/common": "^7.2.1",
Expand Down
34 changes: 34 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,13 @@
dependencies:
regenerator-runtime "^0.12.0"

"@babel/runtime@^7.1.5":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.3.1.tgz#574b03e8e8a9898eaf4a872a92ea20b7846f6f2a"
integrity sha512-7jGW8ppV0ant637pIqAcFfQDDH1orEPGJb8aXfUozuCU3QqX7rX4DA8iwrbPrR1hcH0FTTHz47yQnk+bl5xHQA==
dependencies:
regenerator-runtime "^0.12.0"

"@babel/template@^7.1.0", "@babel/template@^7.1.2", "@babel/template@^7.2.2":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907"
Expand Down Expand Up @@ -1919,6 +1926,11 @@
semver "5.5.1"
semver-intersect "1.4.0"

"@sheerun/mutationobserver-shim@^0.3.2":
version "0.3.2"
resolved "https://registry.yarnpkg.com/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz#8013f2af54a2b7d735f71560ff360d3a8176a87b"
integrity sha512-vTCdPp/T/Q3oSqwHmZ5Kpa9oI7iLtGl3RQaA/NyLHikvcrPxACkkKVr/XzkSPJWXHRhKGzVvb0urJsbMlRxi1Q==

"@svgr/babel-plugin-add-jsx-attribute@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.0.0.tgz#5acf239cd2747b1a36ec7e708de05d914cb9b948"
Expand Down Expand Up @@ -7338,6 +7350,16 @@ dom-serializer@0, dom-serializer@~0.1.0:
domelementtype "~1.1.1"
entities "~1.1.1"

dom-testing-library@^3.13.1:
version "3.16.5"
resolved "https://registry.yarnpkg.com/dom-testing-library/-/dom-testing-library-3.16.5.tgz#8c71f127c6b4ee48115660798040291b59dfc894"
integrity sha512-t3OaTcDdsAqtAZNeZ13KnOJmt+2HaDJqYWyf0iBRzbG6GwrNtpF0122Ygu/qkerIwcnHMX1ihwZVx/DhaLpmTw==
dependencies:
"@babel/runtime" "^7.1.5"
"@sheerun/mutationobserver-shim" "^0.3.2"
pretty-format "^24.0.0"
wait-for-expect "^1.1.0"

dom-walk@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
Expand Down Expand Up @@ -17185,6 +17207,13 @@ react-test-renderer@^16.0.0-0, react-test-renderer@^16.7.0:
react-is "^16.7.0"
scheduler "^0.12.0"

react-testing-library@^5.4.4:
version "5.4.4"
resolved "https://registry.yarnpkg.com/react-testing-library/-/react-testing-library-5.4.4.tgz#3fa787999492be94b228e4540a7211556bf4fd94"
integrity sha512-/TiERZ+URSNhZQfjrUXh0VLsiLSmhqP1WP+2e2wWqWqrRIWpcAxrfuBxzlT75LYMDNmicEikaXJqRDi/pqCEDg==
dependencies:
dom-testing-library "^3.13.1"

react-textarea-autosize@^7.0.4:
version "7.1.0"
resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-7.1.0.tgz#3132cb77e65d94417558d37c0bfe415a5afd3445"
Expand Down Expand Up @@ -20961,6 +20990,11 @@ w3c-xmlserializer@^1.0.1:
webidl-conversions "^4.0.2"
xml-name-validator "^3.0.0"

wait-for-expect@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-1.1.0.tgz#6607375c3f79d32add35cd2c87ce13f351a3d453"
integrity sha512-vQDokqxyMyknfX3luCDn16bSaRcOyH6gGuUXMIbxBLeTo6nWuEWYqMTT9a+44FmW8c2m6TRWBdNvBBjA1hwEKg==

walk-sync@^0.2.5:
version "0.2.7"
resolved "https://registry.yarnpkg.com/walk-sync/-/walk-sync-0.2.7.tgz#b49be4ee6867657aeb736978b56a29d10fa39969"
Expand Down

0 comments on commit 4981740

Please sign in to comment.