Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps: Update Jest to 22 #20943

Merged
merged 5 commits into from
Dec 20, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/components/drop-zone/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,13 @@ describe( 'index', () => {
} );

test( 'should not call onFilesDrop if onVerifyValidTransfer returns false', () => {
const spyDrop = sandbox.spy(),
dropEvent = new window.MouseEvent( 'drop' );
const spyDrop = sandbox.spy();
const dropEvent = new window.MouseEvent( 'drop' );

ReactDom.render(
React.createElement( DropZone, {
...requiredProps,
fullScreen: true, // bypass a Node.contains check on the drop event
onFilesDrop: spyDrop,
onVerifyValidTransfer: function() {
return false;
Expand Down
16 changes: 4 additions & 12 deletions client/lib/accept/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ describe( '#accept()', () => {
} );

test( 'should render a dialog to the document body', () => {
var message = 'Are you sure?',
dialog;
const message = 'Are you sure?';

accept( message, function() {} );

dialog = document.querySelector( '.accept-dialog' );
const dialog = document.querySelector( '.accept-dialog' );
expect( dialog ).to.be.an.instanceof( window.Element );
expect( dialog.textContent ).to.equal( message );
} );
Expand All @@ -48,15 +47,8 @@ describe( '#accept()', () => {
} );

test( 'should clean up after itself once the prompt is closed', () => {
accept( 'Are you sure?', function() {
jest.useFakeTimers();
process.nextTick( function() {
expect( document.querySelector( '.accept-dialog' ) ).to.be.null;
} );
jest.runAllTimers();
jest.useRealTimers();
} );

accept( 'Are you sure?', () => {} );
document.querySelector( '.button.is-primary' ).click();
expect( document.querySelector( '.accept-dialog' ) ).to.be.null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was surprisingly difficult to come to this simple solution this test fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, should work as expected when you compare with one of the previous tests :)

} );
} );
Loading