Skip to content

Commit

Permalink
green tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 10, 2018
1 parent 69da392 commit eeb6bff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
8 changes: 5 additions & 3 deletions packages/material-ui/src/Hidden/HiddenJs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('<HiddenJs />', () => {
let shallow;

before(() => {
shallow = createShallow({ untilSelector: 'HiddenJs' });
shallow = createShallow({ dive: true });
});

function resolvePropName(upDownOnly, breakpoint) {
Expand All @@ -29,11 +29,12 @@ describe('<HiddenJs />', () => {
const props = { [prop]: upDownOnly === 'only' ? breakpoint : true };

it(descriptions[upDownOnly], () => {
const wrapper = shallow(
let wrapper = shallow(
<HiddenJs width={width} {...props}>
<div>foo</div>
</HiddenJs>,
);
wrapper = wrapper.find('HiddenJs').shallow()
assert.strictEqual(wrapper.type(), null, 'should render null');
});
});
Expand All @@ -50,11 +51,12 @@ describe('<HiddenJs />', () => {
const props = { [prop]: upDownOnly === 'only' ? breakpoint : true };

it(descriptions[upDownOnly], () => {
const wrapper = shallow(
let wrapper = shallow(
<HiddenJs width={width} {...props}>
<div>foo</div>
</HiddenJs>,
);
wrapper = wrapper.find('HiddenJs').shallow()
assert.isNotNull(wrapper.type(), 'should render');
assert.strictEqual(wrapper.name(), 'div');
assert.strictEqual(wrapper.first().text(), 'foo', 'should render children');
Expand Down
23 changes: 16 additions & 7 deletions packages/material-ui/src/withMobileDialog/withMobileDialog.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses } from '../test-utils';
import Paper from '../Paper';
import { createShallow } from '../test-utils';
import Dialog from '../Dialog';
import withMobileDialog from './withMobileDialog';

describe('withMobileDialog', () => {
let shallow;
let classes;
const defaultProps = {
open: false,
};

before(() => {
shallow = createShallow({ untilSelector: 'Dialog' });
classes = getClasses(<Dialog {...defaultProps}>foo</Dialog>);
shallow = createShallow({ dive: true });
});

function isFullScreen(breakpoints, width) {
Expand All @@ -26,7 +23,13 @@ describe('withMobileDialog', () => {
foo
</ResponsiveDialog>,
);
assert.strictEqual(wrapper.find(Paper).hasClass(classes.paperFullScreen), true);
assert.strictEqual(
wrapper
.find('WithMobileDialog')
.shallow()
.props().fullScreen,
true,
);
});
});
}
Expand All @@ -40,7 +43,13 @@ describe('withMobileDialog', () => {
foo
</ResponsiveDialog>,
);
assert.strictEqual(wrapper.find(Paper).hasClass(classes.paperFullScreen), false);
assert.strictEqual(
wrapper
.find('WithMobileDialog')
.shallow()
.props().fullScreen,
false,
);
});
});
}
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui/src/withWidth/withWidth.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { assert } from 'chai';
import { useFakeTimers, spy } from 'sinon';
import EventListener from 'react-event-listener';
import { createMount, createShallow } from '../test-utils';
import withWidth, { isWidthDown, isWidthUp } from './withWidth';
import createBreakpoints from '../styles/createBreakpoints';
Expand Down Expand Up @@ -118,7 +119,7 @@ describe('withWidth', () => {
it('should handle resize event', () => {
const wrapper = shallow(<EmptyWithWidth width="sm" />);
assert.strictEqual(wrapper.state().width, undefined);
wrapper.simulate('resize');
wrapper.find(EventListener).simulate('resize');
clock.tick(166);
assert.strictEqual(wrapper.state().width, TEST_ENV_WIDTH);
});
Expand Down

0 comments on commit eeb6bff

Please sign in to comment.