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 f8686dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
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 f8686dd

Please sign in to comment.