Skip to content

Commit

Permalink
[BUGFIX beta] Ensure pauseTest runs after other async helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
trentmwillis committed Jun 11, 2016
1 parent 2bb7890 commit 3481856
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/ember-testing/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ helper('currentURL', currentURL);
@return {Object} A promise that will never resolve
@public
*/
helper('pauseTest', pauseTest);
asyncHelper('pauseTest', pauseTest);

/**
Triggers the given DOM event on the element identified by the provided selector.
Expand Down
2 changes: 0 additions & 2 deletions packages/ember-testing/lib/helpers/pause_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import RSVP from 'ember-runtime/ext/rsvp';
import Test from '../test';

export default function pauseTest() {
Test.adapter.asyncStart();
return new RSVP.Promise(function() { }, 'TestAdapter paused promise');
}
7 changes: 5 additions & 2 deletions packages/ember-testing/tests/helpers_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,11 +772,14 @@ QUnit.module('ember-testing debugging helpers', {

QUnit.test('pauseTest pauses', function() {
expect(1);

function fakeAdapterAsyncStart() {
ok(true, 'Async start should be called');
ok(true, 'Async start should be called after waiting for other helpers');
}

Test.adapter.asyncStart = fakeAdapterAsyncStart;
App.testHelpers.andThen(() => {
Test.adapter.asyncStart = fakeAdapterAsyncStart;
});

App.testHelpers.pauseTest();
});
Expand Down

0 comments on commit 3481856

Please sign in to comment.