diff --git a/packages/material-ui/src/Backdrop/Backdrop.test.js b/packages/material-ui/src/Backdrop/Backdrop.test.js index a003a341df6b7b..6abd4f5d2cc293 100644 --- a/packages/material-ui/src/Backdrop/Backdrop.test.js +++ b/packages/material-ui/src/Backdrop/Backdrop.test.js @@ -1,6 +1,11 @@ import React from 'react'; import { assert } from 'chai'; -import { createMount, createShallow, getClasses, testRef } from '@material-ui/core/test-utils'; +import { + createMount, + createShallow, + describeConformance, + getClasses, +} from '@material-ui/core/test-utils'; import Backdrop from './Backdrop'; describe('', () => { @@ -18,13 +23,15 @@ describe('', () => { mount.cleanUp(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + it('should render a backdrop div', () => { const wrapper = shallow(); assert.strictEqual(wrapper.childAt(0).hasClass('woofBackdrop'), true); assert.strictEqual(wrapper.childAt(0).hasClass(classes.root), true); }); - - it('does forward refs', () => { - testRef(, mount); - }); }); diff --git a/packages/material-ui/src/Box/Box.test.js b/packages/material-ui/src/Box/Box.test.js index c675885fccc827..66bc21415cf059 100644 --- a/packages/material-ui/src/Box/Box.test.js +++ b/packages/material-ui/src/Box/Box.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { assert } from 'chai'; -import { createMount } from '@material-ui/core/test-utils'; +import { createMount, describeConformance } from '@material-ui/core/test-utils'; import Box from './Box'; describe('', () => { @@ -14,6 +14,12 @@ describe('', () => { mount.cleanUp(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + const testChildren =
Hello World
; it('renders children and box content', () => { diff --git a/packages/material-ui/src/FilledInput/FilledInput.test.js b/packages/material-ui/src/FilledInput/FilledInput.test.js index 867accc42e48b7..3a6e50e62ba474 100644 --- a/packages/material-ui/src/FilledInput/FilledInput.test.js +++ b/packages/material-ui/src/FilledInput/FilledInput.test.js @@ -1,6 +1,11 @@ import React from 'react'; import { assert } from 'chai'; -import { createMount, findOutermostIntrinsic, getClasses } from '@material-ui/core/test-utils'; +import { + createMount, + describeConformance, + findOutermostIntrinsic, + getClasses, +} from '@material-ui/core/test-utils'; import FilledInput from './FilledInput'; describe('', () => { @@ -16,6 +21,12 @@ describe('', () => { mount.cleanUp(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + it('should render a
', () => { const wrapper = mount(); const root = findOutermostIntrinsic(wrapper); diff --git a/packages/material-ui/src/Grid/Grid.test.js b/packages/material-ui/src/Grid/Grid.test.js index 36ecb20fb70e4a..902e11f6682712 100644 --- a/packages/material-ui/src/Grid/Grid.test.js +++ b/packages/material-ui/src/Grid/Grid.test.js @@ -1,17 +1,30 @@ import React from 'react'; import { assert } from 'chai'; -import { createShallow, getClasses } from '@material-ui/core/test-utils'; +import { + createMount, + createShallow, + describeConformance, + getClasses, +} from '@material-ui/core/test-utils'; import Grid from './Grid'; describe('', () => { + let mount; let shallow; let classes; before(() => { + mount = createMount(); shallow = createShallow({ dive: true }); classes = getClasses(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + it('should render', () => { const wrapper = shallow(); assert.strictEqual(wrapper.name(), 'div'); diff --git a/packages/material-ui/src/Input/Input.test.js b/packages/material-ui/src/Input/Input.test.js index a4fdddbc35f33a..5a2be386aeaca3 100644 --- a/packages/material-ui/src/Input/Input.test.js +++ b/packages/material-ui/src/Input/Input.test.js @@ -1,6 +1,10 @@ import React from 'react'; import { assert } from 'chai'; -import { createMount, findOutermostIntrinsic } from '@material-ui/core/test-utils'; +import { + createMount, + describeConformance, + findOutermostIntrinsic, +} from '@material-ui/core/test-utils'; import Input from './Input'; describe('', () => { @@ -14,6 +18,12 @@ describe('', () => { mount.cleanUp(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + it('should render a
', () => { const wrapper = mount(); assert.strictEqual(findOutermostIntrinsic(wrapper).type(), 'div'); diff --git a/packages/material-ui/src/Menu/Menu.test.js b/packages/material-ui/src/Menu/Menu.test.js index e5dfeea7a735c4..65ad22fedefee7 100644 --- a/packages/material-ui/src/Menu/Menu.test.js +++ b/packages/material-ui/src/Menu/Menu.test.js @@ -1,7 +1,7 @@ import React from 'react'; import { spy } from 'sinon'; import { assert } from 'chai'; -import { createMount, getClasses, testRef } from '@material-ui/core/test-utils'; +import { createMount, describeConformance, getClasses } from '@material-ui/core/test-utils'; import Popover from '../Popover'; import Menu from './Menu'; import MenuList from '../MenuList'; @@ -11,13 +11,12 @@ const MENU_LIST_HEIGHT = 100; describe('', () => { let classes; let mount; - let defaultProps; + const defaultProps = { + open: false, + anchorEl: () => document.createElement('div'), + }; before(() => { - defaultProps = { - open: false, - anchorEl: document.createElement('div'), - }; classes = getClasses(); mount = createMount(); }); @@ -26,9 +25,11 @@ describe('', () => { mount.cleanUp(); }); - it('does forward refs', () => { - testRef(, mount); - }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); it('should render a Popover', () => { const wrapper = mount(); diff --git a/packages/material-ui/src/MenuList/MenuList.test.js b/packages/material-ui/src/MenuList/MenuList.test.js index 529f4858fd966c..c355dc50e5e5f1 100644 --- a/packages/material-ui/src/MenuList/MenuList.test.js +++ b/packages/material-ui/src/MenuList/MenuList.test.js @@ -1,7 +1,7 @@ import React from 'react'; import { assert } from 'chai'; import { stub } from 'sinon'; -import { createMount, testRef } from '@material-ui/core/test-utils'; +import { createMount, describeConformance } from '@material-ui/core/test-utils'; import MenuList from './MenuList'; import getScrollbarSize from '../utils/getScrollbarSize'; @@ -26,9 +26,11 @@ describe('', () => { mount.cleanUp(); }); - it('does forward refs', () => { - testRef(, mount); - }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLUListElement, + })); describe('list node', () => { let wrapper; diff --git a/packages/material-ui/src/NativeSelect/NativeSelectInput.test.js b/packages/material-ui/src/NativeSelect/NativeSelectInput.test.js index b10253c8f0da26..725c8ca1dcaec0 100644 --- a/packages/material-ui/src/NativeSelect/NativeSelectInput.test.js +++ b/packages/material-ui/src/NativeSelect/NativeSelectInput.test.js @@ -1,8 +1,7 @@ import React from 'react'; import { assert } from 'chai'; import { spy } from 'sinon'; -import { createShallow, createMount } from '@material-ui/core/test-utils'; -import MenuItem from '../MenuItem'; +import { createShallow, createMount, describeConformance } from '@material-ui/core/test-utils'; import NativeSelectInput from './NativeSelectInput'; describe('', () => { @@ -13,15 +12,15 @@ describe('', () => { value: 10, IconComponent: 'div', children: [ - + , - + , + , - + , + , + , ], }; @@ -34,6 +33,12 @@ describe('', () => { mount.cleanUp(); }); + describeConformance( {}} />, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLSelectElement, + })); + it('should render a native select', () => { const wrapper = shallow( diff --git a/packages/material-ui/src/OutlinedInput/OutlinedInput.test.js b/packages/material-ui/src/OutlinedInput/OutlinedInput.test.js index a00f2ff3bf93c3..9ec17e1b7cdfae 100644 --- a/packages/material-ui/src/OutlinedInput/OutlinedInput.test.js +++ b/packages/material-ui/src/OutlinedInput/OutlinedInput.test.js @@ -1,6 +1,10 @@ import React from 'react'; import { assert } from 'chai'; -import { createMount, findOutermostIntrinsic } from '@material-ui/core/test-utils'; +import { + createMount, + describeConformance, + findOutermostIntrinsic, +} from '@material-ui/core/test-utils'; import OutlinedInput from './OutlinedInput'; import NotchedOutline from './NotchedOutline'; @@ -15,6 +19,12 @@ describe('', () => { mount.cleanUp(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + it('should render a
', () => { const wrapper = mount(); assert.strictEqual(findOutermostIntrinsic(wrapper).type(), 'div'); diff --git a/packages/material-ui/src/Popover/Popover.test.js b/packages/material-ui/src/Popover/Popover.test.js index 62194e28ef4d0d..70054c15404145 100644 --- a/packages/material-ui/src/Popover/Popover.test.js +++ b/packages/material-ui/src/Popover/Popover.test.js @@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; import { createShallow, createMount, + describeConformance, findOutermostIntrinsic, getClasses, } from '@material-ui/core/test-utils'; @@ -18,7 +19,10 @@ describe('', () => { let shallow; let mount; let classes; - let defaultProps; + const defaultProps = { + open: false, + anchorEl: () => document.createElement('div'), + }; before(() => { shallow = createShallow({ dive: true }); @@ -28,16 +32,18 @@ describe('', () => {
, ); - defaultProps = { - open: false, - anchorEl: document.createElement('div'), - }; }); after(() => { mount.cleanUp(); }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + describe('root node', () => { it('should render a Modal with an invisible backdrop as the root node', () => { const wrapper = mount( diff --git a/packages/material-ui/src/RadioGroup/RadioGroup.test.js b/packages/material-ui/src/RadioGroup/RadioGroup.test.js index 0e9818bc5fb0b3..7be00c2e405cc9 100644 --- a/packages/material-ui/src/RadioGroup/RadioGroup.test.js +++ b/packages/material-ui/src/RadioGroup/RadioGroup.test.js @@ -1,7 +1,11 @@ import React from 'react'; import { assert } from 'chai'; import { spy } from 'sinon'; -import { createMount, findOutermostIntrinsic, testRef } from '@material-ui/core/test-utils'; +import { + createMount, + describeConformance, + findOutermostIntrinsic, +} from '@material-ui/core/test-utils'; import FormGroup from '../FormGroup'; import Radio from '../Radio'; import RadioGroup from './RadioGroup'; @@ -22,9 +26,11 @@ describe('', () => { return wrapper.find(`input[value="${value}"]`).first(); } - it('does forward refs', () => { - testRef(, mount); - }); + describeConformance(, () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); it('should render a FormGroup with the radiogroup role', () => { const wrapper = mount(); diff --git a/packages/material-ui/src/Select/Select.test.js b/packages/material-ui/src/Select/Select.test.js index dbea6e46cd0584..cd6fd8390ddf40 100644 --- a/packages/material-ui/src/Select/Select.test.js +++ b/packages/material-ui/src/Select/Select.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { assert } from 'chai'; -import { getClasses, createMount } from '@material-ui/core/test-utils'; +import { getClasses, createMount, describeConformance } from '@material-ui/core/test-utils'; import MenuItem from '../MenuItem'; import Input from '../Input'; import Select from './Select'; @@ -31,6 +31,12 @@ describe(', () => ({ + mount, + only: ['refForwarding'], + refInstanceof: window.HTMLDivElement, + })); + it('should render a correct top element', () => { const wrapper = mount(