dist/ember-testing.js in ember-source-2.16.0 vs dist/ember-testing.js in ember-source-2.16.1

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2017 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.16.0 + * @version 2.16.1 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -188,16 +188,14 @@ enifed('ember-debug/deprecate', ['exports', 'ember-debug/error', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _error, _emberConsole, _emberEnvironment, _handlers) { 'use strict'; exports.missingOptionsUntilDeprecation = exports.missingOptionsIdDeprecation = exports.missingOptionsDeprecation = exports.registerHandler = undefined; - /** - @module ember - @submodule ember-debug + @module @ember/debug + @public */ - /** Allows for runtime registration of handler functions that override the default deprecation behavior. Deprecations are invoked by calls to [Ember.deprecate](https://emberjs.com/api/classes/Ember.html#method_deprecate). The following example demonstrates its usage by registering a handler that throws an error if the message contains the word "should", otherwise defers to the default handler. @@ -226,11 +224,11 @@ </ul> @public @static @method registerDeprecationHandler - @for Ember.Debug + @for @ember/debug @param handler {Function} A function to handle deprecation calls. @since 2.1.0 */ var registerHandler = function () {}; /*global __fail__*/ @@ -318,17 +316,21 @@ }); exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `Ember.deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.'; exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `Ember.deprecate` you must provide `id` in options.'; exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation = 'When calling `Ember.deprecate` you must provide `until` in options.'; - /** + @module @ember/application + @public + */ + /** Display a deprecation warning with the provided message and a stack trace (Chrome and Firefox only). * In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build. @method deprecate + @for @ember/application/deprecations @param {String} message A description of the deprecation. @param {Boolean} test A boolean. If falsy, the deprecation will be displayed. @param {Object} options @param {String} options.id A unique id for this deprecation. The id can be used by Ember debugging tools to change the behavior (raise, log or silence) @@ -336,11 +338,11 @@ "view.helper.select". @param {string} options.until The version of Ember when this deprecation warning will be removed. @param {String} [options.url] An optional url to the transition guide on the emberjs.com website. - @for Ember + @static @public @since 1.0.0 */ deprecate = function deprecate(message, test, options) { if (!options || !options.id && !options.until) { @@ -378,10 +380,13 @@ exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation; }); enifed("ember-debug/error", ["exports", "ember-babel"], function (exports, _emberBabel) { "use strict"; + /** + @module @ember/error + */ function ExtendBuiltin(klass) { function ExtendableBuiltin() { klass.apply(this, arguments); } @@ -391,12 +396,11 @@ } /** A subclass of the JavaScript Error object for use in Ember. - @class Error - @namespace Ember + @class EmberError @extends Error @constructor @public */ @@ -437,10 +441,14 @@ exports.default = isEnabled; var FEATURES = _features.FEATURES; /** + @module ember + */ + + /** The hash of enabled Canary features. Add to this, any canary features before creating your application. Alternatively (and recommended), you can also define `EmberENV.FEATURES` if you need to enable features flagged at runtime. @@ -624,31 +632,28 @@ } }; } /** - @module ember - @submodule ember-debug + @module @ember/debug */ - /** - @class Ember - @public - */ - if (true) { /** Define an assertion that will throw an exception if the condition is not met. * In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build. ```javascript - // Test for truthiness - Ember.assert('Must pass a valid object', obj); + import { assert } from '@ember/debug'; + // Test for truthiness + assert('Must pass a valid object', obj); // Fail unconditionally - Ember.assert('This code path should never be run'); + assert('This code path should never be run'); ``` @method assert + @static + @for @ember/debug @param {String} desc A description of the assertion. This will become the text of the Error thrown if the assertion fails. @param {Boolean} test Must be truthy for the assertion to pass. If falsy, an exception will be thrown. @public @@ -663,13 +668,16 @@ /** Display a debug notice. * In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build. ```javascript - Ember.debug('I\'m a debug notice!'); + import { debug } from '@ember/debug'; + debug('I\'m a debug notice!'); ``` @method debug + @for @ember/debug + @static @param {String} message A debug message to display. @public */ setDebugFunction('debug', function debug(message) { _emberConsole.default.debug('DEBUG: ' + message); @@ -685,18 +693,25 @@ setDebugFunction('info', function info() { _emberConsole.default.info.apply(undefined, arguments); }); /** + @module @ember/application + @public + */ + + /** Alias an old, deprecated method with its new counterpart. Display a deprecation warning with the provided message and a stack trace (Chrome and Firefox only) when the assigned method is called. * In a production build, this method is defined as an empty function (NOP). ```javascript Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod); ``` @method deprecateFunc + @static + @for @ember/application/deprecations @param {String} message A description of the deprecation. @param {Object} [options] The options object for Ember.deprecate. @param {Function} func The new function called to replace its deprecated counterpart. @return {Function} A new function that wraps the original function with a deprecation warning @private @@ -725,23 +740,31 @@ }; } }); /** + @module @ember/debug + @public + */ + /** Run a function meant for debugging. * In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build. ```javascript - Ember.runInDebug(() => { - Ember.Component.reopen({ + import Component from '@ember/component'; + import { runInDebug } from '@ember/debug'; + runInDebug(() => { + Component.reopen({ didInsertElement() { console.log("I'm happy"); } }); }); ``` @method runInDebug + @for @ember/debug + @static @param {Function} func The function to be executed. @since 1.5.0 @public */ setDebugFunction('runInDebug', function runInDebug(func) { @@ -763,11 +786,11 @@ var _warnIfUsingStrippedFeatureFlags = void 0; if (true && !(0, _testing.isTesting)()) { /** - Will call `Ember.warn()` if ENABLE_OPTIONAL_FEATURES or + Will call `warn()` if ENABLE_OPTIONAL_FEATURES or any specific FEATURES flag is truthy. This method is called automatically in debug canary builds. @private @method _warnIfUsingStrippedFeatureFlags @return {void} @@ -858,23 +881,23 @@ var warn = function () {}; var missingOptionsDeprecation = void 0, missingOptionsIdDeprecation = void 0; /** - @module ember - @submodule ember-debug + @module @ember/debug */ if (true) { /** Allows for runtime registration of handler functions that override the default warning behavior. - Warnings are invoked by calls made to [Ember.warn](https://emberjs.com/api/classes/Ember.html#method_warn). + Warnings are invoked by calls made to [warn](https://emberjs.com/api/classes/Ember.html#method_warn). The following example demonstrates its usage by registering a handler that does nothing overriding Ember's default warning behavior. ```javascript - // next is not called, so no warnings get the default behavior - Ember.Debug.registerWarnHandler(() => {}); + import { registerWarnHandler } from '@ember/debug'; + // next is not called, so no warnings get the default behavior + registerWarnHandler(() => {}); ``` The handler function takes the following arguments: <ul> <li> <code>message</code> - The message received from the warn call. </li> <li> <code>options</code> - An object passed in with the warn call containing additional information including:</li> @@ -884,11 +907,11 @@ <li> <code>next</code> - A function that calls into the previously registered handler.</li> </ul> @public @static @method registerWarnHandler - @for Ember.Debug + @for @ember/debug @param handler {Function} A function to handle warnings. @since 2.1.0 */ exports.registerHandler = registerHandler = function registerHandler(handler) { (0, _handlers.registerHandler)('warn', handler); @@ -899,26 +922,27 @@ if ('trace' in _emberConsole.default) { _emberConsole.default.trace(); } }); - exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `Ember.warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.'; - exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `Ember.warn` you must provide `id` in options.'; + exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.'; + exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `warn` you must provide `id` in options.'; /** Display a warning with the provided message. * In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build. @method warn + @for @ember/debug + @static @param {String} message A warning to display. @param {Boolean} test An optional boolean. If falsy, the warning will be displayed. @param {Object} options An object that can be used to pass a unique `id` for this warning. The `id` can be used by Ember debugging tools to change the behavior (raise, log, or silence) for that specific warning. The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped" - @for Ember @public @since 1.0.0 */ warn = function warn(message, test, options) { if (arguments.length === 2 && typeof test === 'object') { @@ -956,20 +980,18 @@ function K() { return this; } /** - @module ember - @submodule ember-testing + @module @ember/test */ /** The primary purpose of this class is to create hooks that can be implemented by an adapter for various test frameworks. @class Adapter - @namespace Ember.Test @public */ exports.default = _emberRuntime.Object.extend({ /** This callback will be called whenever an async operation is about to start. @@ -1311,14 +1333,10 @@ }); enifed("ember-testing/helpers/and_then", ["exports"], function (exports) { "use strict"; exports.default = andThen; - /** - @module ember - @submodule ember-testing - */ function andThen(app, callback) { return app.testHelpers.wait(callback(app)); } }); enifed('ember-testing/helpers/click', ['exports', 'ember-testing/events'], function (exports, _events) { @@ -1357,11 +1375,10 @@ (0, _events.fireEvent)(el, 'click'); return app.testHelpers.wait(); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/current_path', ['exports', 'ember-metal'], function (exports, _emberMetal) { 'use strict'; @@ -1389,11 +1406,10 @@ function currentPath(app) { var routingService = app.__container__.lookup('service:-routing'); return (0, _emberMetal.get)(routingService, 'currentPath'); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/current_route_name', ['exports', 'ember-metal'], function (exports, _emberMetal) { 'use strict'; @@ -1419,11 +1435,10 @@ function currentRouteName(app) { var routingService = app.__container__.lookup('service:-routing'); return (0, _emberMetal.get)(routingService, 'currentRouteName'); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/current_url', ['exports', 'ember-metal'], function (exports, _emberMetal) { 'use strict'; @@ -1451,11 +1466,10 @@ function currentURL(app) { var router = app.__container__.lookup('router:main'); return (0, _emberMetal.get)(router, 'location').getURL(); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/fill_in', ['exports', 'ember-testing/events'], function (exports, _events) { 'use strict'; @@ -1498,11 +1512,10 @@ (0, _events.fireEvent)(el, 'change'); return app.testHelpers.wait(); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/find', ['exports', 'ember-metal'], function (exports, _emberMetal) { 'use strict'; @@ -1537,20 +1550,18 @@ context = context || (0, _emberMetal.get)(app, 'rootElement'); $el = app.$(selector, context); return $el; } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/find_with_assert', ['exports'], function (exports) { 'use strict'; exports.default = findWithAssert; /** @module ember - @submodule ember-testing */ /** Like `find`, but throws an error if the element selector returns no results. Example: @@ -1586,11 +1597,10 @@ "use strict"; exports.default = keyEvent; /** @module ember - @submodule ember-testing */ /** Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode Example: ```javascript @@ -1638,11 +1648,10 @@ @return {void} @public */ /** @module ember - @submodule ember-testing */ function resumeTest() { (true && !(resume) && (0, _emberDebug.assert)('Testing has not been paused. There is nothing to resume.', resume)); resume(); @@ -1758,11 +1767,10 @@ (0, _events.fireEvent)(el, type, options); return app.testHelpers.wait(); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/visit', ['exports', 'ember-metal'], function (exports, _emberMetal) { 'use strict'; @@ -1808,11 +1816,10 @@ } return app.testHelpers.wait(); } /** @module ember - @submodule ember-testing */ }); enifed('ember-testing/helpers/wait', ['exports', 'ember-testing/test/waiters', 'ember-runtime', 'ember-metal', 'ember-testing/test/pending_requests'], function (exports, _waiters, _emberRuntime, _emberMetal, _pending_requests) { 'use strict'; @@ -1847,11 +1854,10 @@ @public @since 1.0.0 */ /** @module ember - @submodule ember-testing */ function wait(app, value) { return new _emberRuntime.RSVP.Promise(function (resolve) { var router = app.__container__.lookup('router:main'); @@ -1977,11 +1983,10 @@ enifed('ember-testing/support', ['ember-debug', 'ember-views', 'ember-environment'], function (_emberDebug, _emberViews, _emberEnvironment) { 'use strict'; /** @module ember - @submodule ember-testing */ var $ = _emberViews.jQuery; /** @@ -2082,11 +2087,10 @@ @type {Class} The adapter to be used. @default Ember.Test.QUnitAdapter */ /** @module ember - @submodule ember-testing */ Object.defineProperty(Test, 'adapter', { get: _adapter.getAdapter, set: _adapter.setAdapter }); @@ -2139,10 +2143,13 @@ exports.helpers = undefined; exports.registerHelper = registerHelper; exports.registerAsyncHelper = registerAsyncHelper; exports.unregisterHelper = unregisterHelper; var helpers = exports.helpers = {}; + /** + @module @ember/test + */ /** `registerHelper` is used to register a test helper that will be injected when `App.injectTestHelpers` is called. @@ -2165,11 +2172,12 @@ App.injectTestHelpers(); boot(); ``` @public - @for Ember.Test + @for @ember/test + @static @method registerHelper @param {String} name The name of the helper method to add. @param {Function} helperMethod @param options {Object} */ @@ -2213,11 +2221,11 @@ visit('/post/3'); deletePost(3); ``` @public - @for Ember.Test + @for @ember/test @method registerAsyncHelper @param {String} name The name of the helper method to add. @param {Function} helperMethod @since 1.2.0 */ @@ -2237,10 +2245,12 @@ Ember.Test.unregisterHelper('wait'); ``` @public @method unregisterHelper + @static + @for @ember/test @param {String} name The helper to remove. */ function unregisterHelper(name) { delete helpers[name]; delete _promise.default.prototype[name]; @@ -2444,10 +2454,13 @@ exports.registerWaiter = registerWaiter; exports.unregisterWaiter = unregisterWaiter; exports.checkWaiters = checkWaiters; + /** + @module @ember/test + */ var contexts = []; var callbacks = []; /** This allows ember-testing to play nicely with other asynchronous @@ -2472,11 +2485,12 @@ ```javascript Ember.Test.registerWaiter(MyDB, MyDB.hasPendingTransactions); ``` @public - @for Ember.Test + @for @ember/test + @static @method registerWaiter @param {Object} context (optional) @param {Function} callback @since 1.2.0 */ @@ -2495,11 +2509,12 @@ /** `unregisterWaiter` is used to unregister a callback that was registered with `registerWaiter`. @public - @for Ember.Test + @for @ember/test + @static @method unregisterWaiter @param {Object} context (optional) @param {Function} callback @since 1.2.0 */ @@ -2526,10 +2541,10 @@ This is generally used internally from the acceptance/integration test infrastructure. @public - @for Ember.Test + @for @ember/test @static @method checkWaiters */ function checkWaiters() { if (!callbacks.length) {