Skip to content

Commit

Permalink
reduce test LOC
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrookes committed Aug 15, 2020
1 parent b1e9732 commit 9d64fe3
Showing 1 changed file with 91 additions and 134 deletions.
225 changes: 91 additions & 134 deletions packages/material-ui/src/Popover/Popover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ describe('<Popover />', () => {
});
});

describe('prop: onEnter', () => {
describe('deprecated transition callback props', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
stub(console, 'error');
Expand All @@ -887,155 +887,112 @@ describe('<Popover />', () => {
console.error.restore();
});

it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onEnter: () => [],
},
'prop',
'Popover',
);

expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onEnter` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});

describe('prop: onEntering', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
stub(console, 'error');
});

afterEach(() => {
console.error.restore();
});

it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onEntering: () => [],
},
'prop',
'Popover',
);

expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onEntering` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});

describe('prop: onEntered', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
stub(console, 'error');
});

afterEach(() => {
console.error.restore();
});

it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onEntered: () => [],
},
'prop',
'Popover',
);

expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onEntered` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});

describe('prop: onExit', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
stub(console, 'error');
});
describe('prop: onEnter', () => {
it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onEnter: () => [],
},
'prop',
'Popover',
);

afterEach(() => {
console.error.restore();
expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onEnter` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});

it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onExit: () => [],
},
'prop',
'Popover',
);
describe('prop: onEntering', () => {
it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onEntering: () => [],
},
'prop',
'Popover',
);

expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onExit` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onEntering` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});
});

describe('prop: onExiting', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
stub(console, 'error');
});
describe('prop: onEntered', () => {
it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onEntered: () => [],
},
'prop',
'Popover',
);

afterEach(() => {
console.error.restore();
expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onEntered` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});

it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onExiting: () => [],
},
'prop',
'Popover',
);
describe('prop: onExit', () => {
it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onExit: () => [],
},
'prop',
'Popover',
);

expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onExiting` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onExit` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});
});

describe('prop: onExited', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
stub(console, 'error');
});
describe('prop: onExiting', () => {
it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onExiting: () => [],
},
'prop',
'Popover',
);

afterEach(() => {
console.error.restore();
expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onExiting` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});

it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onExited: () => [],
},
'prop',
'Popover',
);
describe('prop: onExited', () => {
it('issues a warning', () => {
PropTypes.checkPropTypes(
Popover.Naked.propTypes,
{
onExited: () => [],
},
'prop',
'Popover',
);

expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onExited` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
expect(console.error.callCount).to.equal(2);
expect(console.error.firstCall.args[0]).to.equal(
'Warning: Failed prop type: The prop `onExited` of `Popover` is deprecated. Use the `TransitionProps` prop instead.',
);
});
});
});
});

0 comments on commit 9d64fe3

Please sign in to comment.