diff --git a/packages/material-ui-lab/src/ToggleButton/ToggleButton.test.js b/packages/material-ui-lab/src/ToggleButton/ToggleButton.test.js index 07a1e2ec07dce9..0312756c0e38fa 100644 --- a/packages/material-ui-lab/src/ToggleButton/ToggleButton.test.js +++ b/packages/material-ui-lab/src/ToggleButton/ToggleButton.test.js @@ -22,6 +22,10 @@ describe('', () => { classes = getClasses(Hello World); }); + after(() => { + mount.cleanUp(); + }); + it('does forward refs', () => { testRef(Hello World, mount); }); diff --git a/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.test.js b/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.test.js index 2ea1e6cf896576..c45be141e16b85 100644 --- a/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.test.js +++ b/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.test.js @@ -23,6 +23,10 @@ describe('', () => { ); }); + after(() => { + mount.cleanUp(); + }); + function findToggleButton(wrapper, value) { return wrapper .find(ToggleButton) diff --git a/packages/material-ui/src/AppBar/AppBar.test.js b/packages/material-ui/src/AppBar/AppBar.test.js index 14aeed85046ea2..d131f4268b2e1a 100644 --- a/packages/material-ui/src/AppBar/AppBar.test.js +++ b/packages/material-ui/src/AppBar/AppBar.test.js @@ -1,22 +1,37 @@ 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 AppBar from './AppBar'; +import Paper from '../Paper'; describe('', () => { + let mount; let shallow; let classes; before(() => { + mount = createMount(); shallow = createShallow({ dive: true }); classes = getClasses(Hello World); }); - it('should render a Paper component', () => { - const wrapper = shallow(Hello World); - assert.strictEqual(wrapper.props().elevation, 4); + after(() => { + mount.cleanUp(); }); + describeConformance(Conformance?, () => ({ + classes, + inheritComponent: Paper, + mount, + refInstanceof: window.HTMLElement, + testComponentPropWith: false, + })); + it('should render with the root class and primary', () => { const wrapper = shallow(Hello World); assert.strictEqual(wrapper.hasClass(classes.root), true); @@ -24,13 +39,6 @@ describe('', () => { assert.strictEqual(wrapper.hasClass(classes.colorSecondary), false); }); - it('should render the custom className and the appBar class', () => { - const wrapper = shallow(Hello World); - assert.strictEqual(wrapper.is('.test-class-name'), true); - assert.strictEqual(wrapper.hasClass(classes.root), true); - assert.strictEqual(wrapper.hasClass(classes.colorPrimary), true); - }); - it('should render a primary app bar', () => { const wrapper = shallow(Hello World); assert.strictEqual(wrapper.hasClass(classes.root), true); diff --git a/packages/material-ui/src/Avatar/Avatar.test.js b/packages/material-ui/src/Avatar/Avatar.test.js index 8bc00d9866b51f..2b83725f73f737 100644 --- a/packages/material-ui/src/Avatar/Avatar.test.js +++ b/packages/material-ui/src/Avatar/Avatar.test.js @@ -1,18 +1,37 @@ import React from 'react'; import { assert } from 'chai'; import CancelIcon from '../internal/svg-icons/Cancel'; -import { createShallow, getClasses } from '@material-ui/core/test-utils'; +import { + createMount, + createShallow, + describeConformance, + getClasses, +} from '@material-ui/core/test-utils'; import Avatar from './Avatar'; describe('', () => { + let mount; let shallow; let classes; before(() => { + mount = createMount(); shallow = createShallow({ dive: true }); classes = getClasses(); }); + after(() => { + mount.cleanUp(); + }); + + describeConformance(, () => ({ + classes, + inheritComponent: 'div', + mount, + refInstanceof: window.HTMLDivElement, + testComponentPropWith: 'span', + })); + describe('image avatar', () => { it('should render a div containing an img', () => { const wrapper = shallow( diff --git a/packages/material-ui/src/Badge/Badge.test.js b/packages/material-ui/src/Badge/Badge.test.js index 89ed1ef2d2bd24..895ec9cf79c503 100644 --- a/packages/material-ui/src/Badge/Badge.test.js +++ b/packages/material-ui/src/Badge/Badge.test.js @@ -1,17 +1,41 @@ 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 Badge from './Badge'; describe('', () => { + let mount; let shallow; let classes; before(() => { + mount = createMount(); shallow = createShallow({ dive: true }); classes = getClasses(Hello World); }); + after(() => { + mount.cleanUp(); + }); + + describeConformance( + +
+ , + () => ({ + classes, + inheritComponent: 'span', + mount, + refInstanceof: window.HTMLSpanElement, + testComponentPropWith: 'div', + }), + ); + const testChildren =
Hello World
; it('renders children and badgeContent', () => { diff --git a/packages/material-ui/src/BottomNavigation/BottomNavigation.test.js b/packages/material-ui/src/BottomNavigation/BottomNavigation.test.js index 53a7b06c1ba974..129ed50ba8de51 100755 --- a/packages/material-ui/src/BottomNavigation/BottomNavigation.test.js +++ b/packages/material-ui/src/BottomNavigation/BottomNavigation.test.js @@ -1,7 +1,12 @@ import React from 'react'; import { assert } from 'chai'; import { spy } from 'sinon'; -import { createShallow, createMount, getClasses } from '@material-ui/core/test-utils'; +import { + createShallow, + createMount, + describeConformance, + getClasses, +} from '@material-ui/core/test-utils'; import BottomNavigationAction from '../BottomNavigationAction'; import Icon from '../Icon'; import BottomNavigation from './BottomNavigation'; @@ -26,6 +31,19 @@ describe('', () => { mount.cleanUp(); }); + describeConformance( + + + , + () => ({ + classes, + inheritComponent: 'div', + mount, + refInstanceof: window.HTMLDivElement, + testComponentPropWith: 'span', + }), + ); + it('renders with a null child', () => { const wrapper = shallow( @@ -37,26 +55,6 @@ describe('', () => { assert.strictEqual(wrapper.find(BottomNavigationAction).length, 2); }); - it('should render with the root class', () => { - const wrapper = shallow( - - - , - ); - assert.strictEqual(wrapper.name(), 'div'); - assert.strictEqual(wrapper.hasClass(classes.root), true); - }); - - it('should render with the user and root classes', () => { - const wrapper = shallow( - - - , - ); - assert.strictEqual(wrapper.hasClass('woofBottomNavigation'), true); - assert.strictEqual(wrapper.hasClass(classes.root), true); - }); - it('should pass selected prop to children', () => { const wrapper = shallow( diff --git a/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.test.js b/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.test.js index f78228b7e271ac..f02989e9b39263 100644 --- a/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.test.js +++ b/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.test.js @@ -1,7 +1,12 @@ import React from 'react'; import { assert } from 'chai'; import { spy } from 'sinon'; -import { createMount, findOutermostIntrinsic, getClasses } from '@material-ui/core/test-utils'; +import { + createMount, + describeConformance, + findOutermostIntrinsic, + getClasses, +} from '@material-ui/core/test-utils'; import ButtonBase from '../ButtonBase'; import Icon from '../Icon'; import BottomNavigationAction from './BottomNavigationAction'; @@ -16,21 +21,17 @@ describe('', () => { classes = getClasses(); }); - it('should render a ButtonBase', () => { - const wrapper = mount(); - const root = wrapper.find(`.${classes.root}`).first(); - assert.strictEqual(root.exists(), true); - assert.strictEqual(root.type(), ButtonBase); + after(() => { + mount.cleanUp(); }); - it('should render with the user and root classes', () => { - const wrapper = mount( - , - ); - const root = wrapper.find(`.${classes.root}.woofBottomNavigationAction`).first(); - assert.strictEqual(root.exists(), true); - assert.strictEqual(root.hasClass('woofBottomNavigationAction'), true); - }); + describeConformance(, () => ({ + classes, + inheritComponent: ButtonBase, + mount, + refInstanceof: window.HTMLButtonElement, + testComponentPropWith: false, + })); it('should render with the selected and root classes', () => { const wrapper = mount(); diff --git a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js index b6ba59bc365e50..45cd9310bfe852 100644 --- a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js +++ b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { assert } from 'chai'; -import { createMount, getClasses, findOutermostIntrinsic } from '@material-ui/core/test-utils'; +import { createMount, describeConformance, getClasses } from '@material-ui/core/test-utils'; import Breadcrumbs from './Breadcrumbs'; import BreadcrumbSeparator from './BreadcrumbSeparator'; import BreadcrumbCollapsed from './BreadcrumbCollapsed'; @@ -23,33 +23,13 @@ describe('', () => { mount.cleanUp(); }); - it('should render a