dist/ember-testing.js in ember-source-2.7.0.beta.1 vs dist/ember-testing.js in ember-source-2.7.0.beta.2

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2016 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.7.0-beta.1 + * @version 2.7.0-beta.2 */ var enifed, requireModule, require, Ember; var mainContext = this; @@ -483,10 +483,14 @@ if (!_emberMetalTesting.isTesting()) { // Complain if they're using FEATURE flags in builds other than canary _emberMetalFeatures.FEATURES['features-stripped-test'] = true; var featuresWereStripped = true; + if (false) { + exports.featuresWereStripped = featuresWereStripped = false; + } + delete _emberMetalFeatures.FEATURES['features-stripped-test']; _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberMetalFeatures.DEFAULT_FEATURES, featuresWereStripped); // Inform the developer about the Ember Inspector if not installed. var isFirefox = _emberEnvironment.environment.isFirefox; @@ -1173,17 +1177,16 @@ } return app.testHelpers.triggerEvent(selector, context, type, { keyCode: keyCode, which: keyCode }); } }); -enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime/ext/rsvp', 'ember-testing/test'], function (exports, _emberRuntimeExtRsvp, _emberTestingTest) { +enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime/ext/rsvp'], function (exports, _emberRuntimeExtRsvp) { 'use strict'; exports.default = pauseTest; function pauseTest() { - _emberTestingTest.default.adapter.asyncStart(); return new _emberRuntimeExtRsvp.default.Promise(function () {}, 'TestAdapter paused promise'); } }); enifed('ember-testing/helpers/trigger_event', ['exports', 'ember-metal/run_loop', 'ember-testing/events'], function (exports, _emberMetalRun_loop, _emberTestingEvents) { 'use strict'; @@ -1523,11 +1526,11 @@ @since 1.9.0 @method pauseTest @return {Object} A promise that will never resolve @public */ - _emberTestingTestHelpers.registerHelper('pauseTest', _emberTestingHelpersPause_test.default); + _emberTestingTestHelpers.registerAsyncHelper('pauseTest', _emberTestingHelpersPause_test.default); /** Triggers the given DOM event on the element identified by the provided selector. Example: @@ -2043,16 +2046,18 @@ } else { return fn(); } } }); -enifed("ember-testing/test/waiters", ["exports"], function (exports) { - "use strict"; +enifed('ember-testing/test/waiters', ['exports', 'ember-metal/features', 'ember-metal/debug'], function (exports, _emberMetalFeatures, _emberMetalDebug) { + 'use strict'; exports.registerWaiter = registerWaiter; exports.unregisterWaiter = unregisterWaiter; exports.checkWaiters = checkWaiters; + exports.generateDeprecatedWaitersArray = generateDeprecatedWaitersArray; + var contexts = []; var callbacks = []; /** This allows ember-testing to play nicely with other asynchronous @@ -2121,10 +2126,24 @@ } contexts.splice(i, 1); callbacks.splice(i, 1); } + /** + Iterates through each registered test waiter, and invokes + its callback. If any waiter returns false, this method will return + true indicating that the waiters have not settled yet. + + This is generally used internally from the acceptance/integration test + infrastructure. + + @public + @for Ember.Test + @static + @method checkWaiters + */ + function checkWaiters() { if (!callbacks.length) { return false; } for (var i = 0; i < callbacks.length; i++) { @@ -2143,12 +2162,26 @@ return i; } } return -1; } + + function generateDeprecatedWaitersArray() { + _emberMetalDebug.deprecate('Usage of `Ember.Test.waiters` is deprecated. Please refactor to `Ember.Test.checkWaiters`.', !false, { until: '2.8.0', id: 'ember-testing.test-waiters' }); + + var array = new Array(callbacks.length); + for (var i = 0; i < callbacks.length; i++) { + var context = contexts[i]; + var callback = callbacks[i]; + + array[i] = [context, callback]; + } + + return array; + } }); -enifed('ember-testing/test', ['exports', 'ember-testing/test/helpers', 'ember-testing/test/on_inject_helpers', 'ember-testing/test/promise', 'ember-testing/test/waiters', 'ember-testing/test/adapter'], function (exports, _emberTestingTestHelpers, _emberTestingTestOn_inject_helpers, _emberTestingTestPromise, _emberTestingTestWaiters, _emberTestingTestAdapter) { +enifed('ember-testing/test', ['exports', 'ember-testing/test/helpers', 'ember-testing/test/on_inject_helpers', 'ember-testing/test/promise', 'ember-testing/test/waiters', 'ember-testing/test/adapter', 'ember-metal/features'], function (exports, _emberTestingTestHelpers, _emberTestingTestOn_inject_helpers, _emberTestingTestPromise, _emberTestingTestWaiters, _emberTestingTestAdapter, _emberMetalFeatures) { /** @module ember @submodule ember-testing */ 'use strict'; @@ -2183,10 +2216,14 @@ resolve: _emberTestingTestPromise.resolve, registerWaiter: _emberTestingTestWaiters.registerWaiter, unregisterWaiter: _emberTestingTestWaiters.unregisterWaiter }; + if (false) { + Test.checkWaiters = _emberTestingTestWaiters.checkWaiters; + } + /** Used to allow ember-testing to communicate with a specific testing framework. You can manually set it before calling `App.setupForTesting()`. @@ -2206,9 +2243,13 @@ @default Ember.Test.QUnitAdapter */ Object.defineProperty(Test, 'adapter', { get: _emberTestingTestAdapter.getAdapter, set: _emberTestingTestAdapter.setAdapter + }); + + Object.defineProperty(Test, 'waiters', { + get: _emberTestingTestWaiters.generateDeprecatedWaitersArray }); exports.default = Test; }); requireModule("ember-testing");