From 348185618dc49e102b8ad2a86a6cd8e6915fee5e Mon Sep 17 00:00:00 2001 From: Trent Willis Date: Sat, 4 Jun 2016 16:56:04 -0700 Subject: [PATCH] [BUGFIX beta] Ensure pauseTest runs after other async helpers --- packages/ember-testing/lib/helpers.js | 2 +- packages/ember-testing/lib/helpers/pause_test.js | 2 -- packages/ember-testing/tests/helpers_test.js | 7 +++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/ember-testing/lib/helpers.js b/packages/ember-testing/lib/helpers.js index 3d6790e72f6..465bdd1d2fd 100644 --- a/packages/ember-testing/lib/helpers.js +++ b/packages/ember-testing/lib/helpers.js @@ -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. diff --git a/packages/ember-testing/lib/helpers/pause_test.js b/packages/ember-testing/lib/helpers/pause_test.js index f0ce59124a6..b367fe0f3e4 100644 --- a/packages/ember-testing/lib/helpers/pause_test.js +++ b/packages/ember-testing/lib/helpers/pause_test.js @@ -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'); } diff --git a/packages/ember-testing/tests/helpers_test.js b/packages/ember-testing/tests/helpers_test.js index c8a68445ecc..2a4be336a28 100644 --- a/packages/ember-testing/tests/helpers_test.js +++ b/packages/ember-testing/tests/helpers_test.js @@ -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(); });