dist/ember-testing.js in ember-source-2.9.0 vs dist/ember-testing.js in ember-source-2.9.1
- 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.9.0
+ * @version 2.10.0-beta.2
*/
var enifed, requireModule, require, Ember;
var mainContext = this;
@@ -110,16 +110,89 @@
enifed = Ember.__loader.define;
require = requireModule = Ember.__loader.require;
}
})();
-enifed('ember-debug/deprecate', ['exports', 'ember-metal/error', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _emberMetalError, _emberConsole, _emberEnvironment, _emberDebugHandlers) {
+var babelHelpers;
+
+function classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError('Cannot call a class as a function');
+ }
+}
+
+function inherits(subClass, superClass) {
+ if (typeof superClass !== 'function' && superClass !== null) {
+ throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
+ }
+
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
+ constructor: {
+ value: subClass,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : defaults(subClass, superClass);
+}
+
+function taggedTemplateLiteralLoose(strings, raw) {
+ strings.raw = raw;
+ return strings;
+}
+
+function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ('value' in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+}
+
+function createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+}
+
+function interopExportWildcard(obj, defaults) {
+ var newObj = defaults({}, obj);
+ delete newObj['default'];
+ return newObj;
+}
+
+function defaults(obj, defaults) {
+ var keys = Object.getOwnPropertyNames(defaults);
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ var value = Object.getOwnPropertyDescriptor(defaults, key);
+ if (value && value.configurable && obj[key] === undefined) {
+ Object.defineProperty(obj, key, value);
+ }
+ }
+ return obj;
+}
+
+babelHelpers = {
+ classCallCheck: classCallCheck,
+ inherits: inherits,
+ taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,
+ slice: Array.prototype.slice,
+ createClass: createClass,
+ interopExportWildcard: interopExportWildcard,
+ defaults: defaults
+};
+
+enifed('ember-debug/deprecate', ['exports', 'ember-metal', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _emberMetal, _emberConsole, _emberEnvironment, _emberDebugHandlers) {
/*global __fail__*/
'use strict';
- var _slice = Array.prototype.slice;
exports.registerHandler = registerHandler;
exports.default = deprecate;
function registerHandler(handler) {
_emberDebugHandlers.registerHandler('deprecate', handler);
@@ -190,11 +263,11 @@
registerHandler(function raiseOnDeprecation(message, options, next) {
if (_emberEnvironment.ENV.RAISE_ON_DEPRECATION) {
var updatedMessage = formatMessage(message);
- throw new _emberMetalError.default(updatedMessage);
+ throw new _emberMetal.Error(updatedMessage);
} else {
next.apply(undefined, arguments);
}
});
@@ -256,11 +329,11 @@
until: '3.0.0',
url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
- _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(_slice.call(arguments)));
+ _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(babelHelpers.slice.call(arguments)));
}
});
enifed("ember-debug/handlers", ["exports"], function (exports) {
"use strict";
@@ -292,11 +365,11 @@
if (handlerForType) {
handlerForType(message, options);
}
}
});
-enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment', 'ember-metal/testing', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/error', 'ember-console', 'ember-debug/deprecate', 'ember-debug/warn'], function (exports, _emberMetalCore, _emberEnvironment, _emberMetalTesting, _emberMetalDebug, _emberMetalFeatures, _emberMetalError, _emberConsole, _emberDebugDeprecate, _emberDebugWarn) {
+enifed('ember-debug/index', ['exports', 'ember-metal', 'ember-environment', 'ember-console', 'ember-debug/deprecate', 'ember-debug/warn'], function (exports, _emberMetal, _emberEnvironment, _emberConsole, _emberDebugDeprecate, _emberDebugWarn) {
'use strict';
exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
/**
@@ -328,13 +401,13 @@
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
*/
- _emberMetalDebug.setDebugFunction('assert', function assert(desc, test) {
+ _emberMetal.setDebugFunction('assert', function assert(desc, test) {
if (!test) {
- throw new _emberMetalError.default('Assertion Failed: ' + desc);
+ throw new _emberMetal.Error('Assertion Failed: ' + desc);
}
});
/**
Display a debug notice.
@@ -348,11 +421,11 @@
@method debug
@param {String} message A debug message to display.
@public
*/
- _emberMetalDebug.setDebugFunction('debug', function debug(message) {
+ _emberMetal.setDebugFunction('debug', function debug(message) {
_emberConsole.default.debug('DEBUG: ' + message);
});
/**
Display an info notice.
@@ -361,11 +434,11 @@
Uses of this method in Ember itself are stripped from the ember.prod.js build.
@method info
@private
*/
- _emberMetalDebug.setDebugFunction('info', function info() {
+ _emberMetal.setDebugFunction('info', function info() {
_emberConsole.default.info.apply(undefined, arguments);
});
/**
Alias an old, deprecated method with its new counterpart.
@@ -384,11 +457,11 @@
@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
*/
- _emberMetalDebug.setDebugFunction('deprecateFunc', function deprecateFunc() {
+ _emberMetal.setDebugFunction('deprecateFunc', function deprecateFunc() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 3) {
@@ -397,11 +470,11 @@
var options = args[1];
var func = args[2];
return {
v: function () {
- _emberMetalDebug.deprecate(message, false, options);
+ _emberMetal.deprecate(message, false, options);
return func.apply(this, arguments);
}
};
})();
@@ -411,11 +484,11 @@
var message = args[0];
var func = args[1];
return {
v: function () {
- _emberMetalDebug.deprecate(message);
+ _emberMetal.deprecate(message);
return func.apply(this, arguments);
}
};
})();
@@ -442,22 +515,26 @@
@method runInDebug
@param {Function} func The function to be executed.
@since 1.5.0
@public
*/
- _emberMetalDebug.setDebugFunction('runInDebug', function runInDebug(func) {
+ _emberMetal.setDebugFunction('runInDebug', function runInDebug(func) {
func();
});
- _emberMetalDebug.setDebugFunction('debugSeal', function debugSeal(obj) {
+ _emberMetal.setDebugFunction('debugSeal', function debugSeal(obj) {
Object.seal(obj);
});
- _emberMetalDebug.setDebugFunction('deprecate', _emberDebugDeprecate.default);
+ _emberMetal.setDebugFunction('debugFreeze', function debugFreeze(obj) {
+ Object.freeze(obj);
+ });
- _emberMetalDebug.setDebugFunction('warn', _emberDebugWarn.default);
+ _emberMetal.setDebugFunction('deprecate', _emberDebugDeprecate.default);
+ _emberMetal.setDebugFunction('warn', _emberDebugWarn.default);
+
/**
Will call `Ember.warn()` if ENABLE_OPTIONAL_FEATURES or
any specific FEATURES flag is truthy.
This method is called automatically in debug canary builds.
@@ -467,36 +544,36 @@
@return {void}
*/
function _warnIfUsingStrippedFeatureFlags(FEATURES, knownFeatures, featuresWereStripped) {
if (featuresWereStripped) {
- _emberMetalDebug.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
+ _emberMetal.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
var keys = Object.keys(FEATURES || {});
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key === 'isEnabled' || !(key in knownFeatures)) {
continue;
}
- _emberMetalDebug.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' });
+ _emberMetal.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' });
}
}
}
- if (!_emberMetalTesting.isTesting()) {
+ if (!_emberMetal.isTesting()) {
(function () {
// Complain if they're using FEATURE flags in builds other than canary
- _emberMetalFeatures.FEATURES['features-stripped-test'] = true;
+ _emberMetal.FEATURES['features-stripped-test'] = true;
var featuresWereStripped = true;
if (false) {
featuresWereStripped = false;
}
- delete _emberMetalFeatures.FEATURES['features-stripped-test'];
- _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberMetalFeatures.DEFAULT_FEATURES, featuresWereStripped);
+ delete _emberMetal.FEATURES['features-stripped-test'];
+ _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberMetal.DEFAULT_FEATURES, featuresWereStripped);
// Inform the developer about the Ember Inspector if not installed.
var isFirefox = _emberEnvironment.environment.isFirefox;
var isChrome = _emberEnvironment.environment.isChrome;
@@ -509,21 +586,21 @@
downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';
} else if (isFirefox) {
downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
}
- _emberMetalDebug.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
+ _emberMetal.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
}
}, false);
}
})();
}
/**
@public
@class Ember.Debug
*/
- _emberMetalCore.default.Debug = {};
+ _emberMetal.default.Debug = {};
/**
Allows for runtime registration of handler functions that override the default deprecation behavior.
Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate).
The following example demonstrates its usage by registering a handler that throws an error if the
@@ -535,11 +612,11 @@
throw new Error(`Deprecation message with should: ${message}`);
} else {
// defer to whatever handler was registered before this one
next(message, options);
}
- }
+ });
```
The handler function takes the following arguments:
<ul>
@@ -556,11 +633,11 @@
@static
@method registerDeprecationHandler
@param handler {Function} A function to handle deprecation calls.
@since 2.1.0
*/
- _emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
+ _emberMetal.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
/**
Allows for runtime registration of handler functions that override the default warning behavior.
Warnings are invoked by calls made to [Ember.warn](http://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.
@@ -585,11 +662,11 @@
@static
@method registerWarnHandler
@param handler {Function} A function to handle warnings.
@since 2.1.0
*/
- _emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
+ _emberMetal.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
/*
We are transitioning away from `ember.js` to `ember.debug.js` to make
it much clearer that it is only for local development purposes.
@@ -598,18 +675,17 @@
used a nice helpful warning message will be printed out.
*/
var runningNonEmberDebugJS = false;
exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
if (runningNonEmberDebugJS) {
- _emberMetalDebug.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
+ _emberMetal.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
}
});
// reexports
-enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal/debug', 'ember-debug/handlers'], function (exports, _emberConsole, _emberMetalDebug, _emberDebugHandlers) {
+enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal', 'ember-debug/handlers'], function (exports, _emberConsole, _emberMetal, _emberDebugHandlers) {
'use strict';
- var _slice = Array.prototype.slice;
exports.registerHandler = registerHandler;
exports.default = warn;
function registerHandler(handler) {
_emberDebugHandlers.registerHandler('warn', handler);
@@ -650,29 +726,29 @@
@public
*/
function warn(message, test, options) {
if (!options) {
- _emberMetalDebug.deprecate(missingOptionsDeprecation, false, {
+ _emberMetal.deprecate(missingOptionsDeprecation, false, {
id: 'ember-debug.warn-options-missing',
until: '3.0.0',
url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
if (options && !options.id) {
- _emberMetalDebug.deprecate(missingOptionsIdDeprecation, false, {
+ _emberMetal.deprecate(missingOptionsIdDeprecation, false, {
id: 'ember-debug.warn-id-missing',
until: '3.0.0',
url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
- _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
+ _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(babelHelpers.slice.call(arguments)));
}
});
-enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/object'], function (exports, _emberRuntimeSystemObject) {
+enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime'], function (exports, _emberRuntime) {
'use strict';
function K() {
return this;
}
@@ -688,11 +764,11 @@
@class Adapter
@namespace Ember.Test
@public
*/
- exports.default = _emberRuntimeSystemObject.default.extend({
+ exports.default = _emberRuntime.Object.extend({
/**
This callback will be called whenever an async operation is about to start.
Override this to call your framework's methods that handle async
operations.
@public
@@ -724,11 +800,11 @@
exception: function (error) {
throw error;
}
});
});
-enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapter', 'ember-metal/utils'], function (exports, _emberTestingAdaptersAdapter, _emberMetalUtils) {
+enifed('ember-testing/adapters/qunit', ['exports', 'ember-utils', 'ember-testing/adapters/adapter'], function (exports, _emberUtils, _emberTestingAdaptersAdapter) {
'use strict';
/**
This class implements the methods defined by Ember.Test.Adapter for the
QUnit testing framework.
@@ -744,15 +820,15 @@
},
asyncEnd: function () {
QUnit.start();
},
exception: function (error) {
- ok(false, _emberMetalUtils.inspect(error));
+ ok(false, _emberUtils.inspect(error));
}
});
});
-enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-metal/run_loop'], function (exports, _emberViewsSystemJquery, _emberMetalRun_loop) {
+enifed('ember-testing/events', ['exports', 'ember-views', 'ember-metal'], function (exports, _emberViews, _emberMetal) {
'use strict';
exports.focus = focus;
exports.fireEvent = fireEvent;
@@ -762,15 +838,15 @@
function focus(el) {
if (!el) {
return;
}
- var $el = _emberViewsSystemJquery.default(el);
+ var $el = _emberViews.jQuery(el);
if ($el.is(':input, [contenteditable=true]')) {
var type = $el.prop('type');
if (type !== 'checkbox' && type !== 'radio' && type !== 'hidden') {
- _emberMetalRun_loop.default(null, function () {
+ _emberMetal.run(null, function () {
// Firefox does not trigger the `focusin` event if the window
// does not have focus. If the document doesn't have focus just
// use trigger('focusin') instead.
if (!document.hasFocus || document.hasFocus()) {
@@ -800,11 +876,11 @@
screenX: x + 5,
screenY: y + 95,
clientX: x,
clientY: y
};
- event = buildMouseEvent(type, _emberViewsSystemJquery.default.extend(simulatedCoordinates, options));
+ event = buildMouseEvent(type, _emberViews.jQuery.extend(simulatedCoordinates, options));
} else {
event = buildBasicEvent(type, options);
}
element.dispatchEvent(event);
}
@@ -812,21 +888,21 @@
function buildBasicEvent(type) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var event = document.createEvent('Events');
event.initEvent(type, true, true);
- _emberViewsSystemJquery.default.extend(event, options);
+ _emberViews.jQuery.extend(event, options);
return event;
}
function buildMouseEvent(type) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var event = undefined;
try {
event = document.createEvent('MouseEvents');
- var eventOpts = _emberViewsSystemJquery.default.extend({}, DEFAULT_EVENT_OPTIONS, options);
+ var eventOpts = _emberViews.jQuery.extend({}, DEFAULT_EVENT_OPTIONS, options);
event.initMouseEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.detail, eventOpts.screenX, eventOpts.screenY, eventOpts.clientX, eventOpts.clientY, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.button, eventOpts.relatedTarget);
} catch (e) {
event = buildBasicEvent(type, options);
}
return event;
@@ -836,22 +912,22 @@
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var event = undefined;
try {
event = document.createEvent('KeyEvents');
- var eventOpts = _emberViewsSystemJquery.default.extend({}, DEFAULT_EVENT_OPTIONS, options);
+ var eventOpts = _emberViews.jQuery.extend({}, DEFAULT_EVENT_OPTIONS, options);
event.initKeyEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.keyCode, eventOpts.charCode);
} catch (e) {
event = buildBasicEvent(type, options);
}
return event;
}
});
-enifed('ember-testing/ext/application', ['exports', 'ember-application/system/application', 'ember-testing/setup_for_testing', 'ember-testing/test/helpers', 'ember-testing/test/promise', 'ember-testing/test/run', 'ember-testing/test/on_inject_helpers', 'ember-testing/test/adapter'], function (exports, _emberApplicationSystemApplication, _emberTestingSetup_for_testing, _emberTestingTestHelpers, _emberTestingTestPromise, _emberTestingTestRun, _emberTestingTestOn_inject_helpers, _emberTestingTestAdapter) {
+enifed('ember-testing/ext/application', ['exports', 'ember-application', 'ember-testing/setup_for_testing', 'ember-testing/test/helpers', 'ember-testing/test/promise', 'ember-testing/test/run', 'ember-testing/test/on_inject_helpers', 'ember-testing/test/adapter'], function (exports, _emberApplication, _emberTestingSetup_for_testing, _emberTestingTestHelpers, _emberTestingTestPromise, _emberTestingTestRun, _emberTestingTestOn_inject_helpers, _emberTestingTestAdapter) {
'use strict';
- _emberApplicationSystemApplication.default.reopen({
+ _emberApplication.Application.reopen({
/**
This property contains the testing helpers for the current application. These
are created once you call `injectTestHelpers` on your `Ember.Application`
instance. The included helpers are also available on the `window` object by
default, but can be used from this object on the individual application also.
@@ -1034,58 +1110,74 @@
return fn.apply(app, [app].concat(args));
}).finally(_emberTestingTestAdapter.asyncEnd);
};
}
});
-enifed('ember-testing/ext/rsvp', ['exports', 'ember-runtime/ext/rsvp', 'ember-metal/run_loop', 'ember-metal/testing', 'ember-testing/test/adapter'], function (exports, _emberRuntimeExtRsvp, _emberMetalRun_loop, _emberMetalTesting, _emberTestingTestAdapter) {
+enifed('ember-testing/ext/rsvp', ['exports', 'ember-runtime', 'ember-metal', 'ember-testing/test/adapter'], function (exports, _emberRuntime, _emberMetal, _emberTestingTestAdapter) {
'use strict';
- _emberRuntimeExtRsvp.default.configure('async', function (callback, promise) {
+ _emberRuntime.RSVP.configure('async', function (callback, promise) {
// if schedule will cause autorun, we need to inform adapter
- if (_emberMetalTesting.isTesting() && !_emberMetalRun_loop.default.backburner.currentInstance) {
+ if (_emberMetal.isTesting() && !_emberMetal.run.backburner.currentInstance) {
_emberTestingTestAdapter.asyncStart();
- _emberMetalRun_loop.default.backburner.schedule('actions', function () {
+ _emberMetal.run.backburner.schedule('actions', function () {
_emberTestingTestAdapter.asyncEnd();
callback(promise);
});
} else {
- _emberMetalRun_loop.default.backburner.schedule('actions', function () {
+ _emberMetal.run.backburner.schedule('actions', function () {
return callback(promise);
});
}
});
- exports.default = _emberRuntimeExtRsvp.default;
+ exports.default = _emberRuntime.RSVP;
});
-enifed('ember-testing/helpers', ['exports', 'ember-testing/test/helpers', 'ember-testing/helpers/and_then', 'ember-testing/helpers/click', 'ember-testing/helpers/current_path', 'ember-testing/helpers/current_route_name', 'ember-testing/helpers/current_url', 'ember-testing/helpers/fill_in', 'ember-testing/helpers/find', 'ember-testing/helpers/find_with_assert', 'ember-testing/helpers/key_event', 'ember-testing/helpers/pause_test', 'ember-testing/helpers/trigger_event', 'ember-testing/helpers/visit', 'ember-testing/helpers/wait'], function (exports, _emberTestingTestHelpers, _emberTestingHelpersAnd_then, _emberTestingHelpersClick, _emberTestingHelpersCurrent_path, _emberTestingHelpersCurrent_route_name, _emberTestingHelpersCurrent_url, _emberTestingHelpersFill_in, _emberTestingHelpersFind, _emberTestingHelpersFind_with_assert, _emberTestingHelpersKey_event, _emberTestingHelpersPause_test, _emberTestingHelpersTrigger_event, _emberTestingHelpersVisit, _emberTestingHelpersWait) {
+enifed('ember-testing/helpers', ['exports', 'ember-metal', 'ember-testing/test/helpers', 'ember-testing/helpers/and_then', 'ember-testing/helpers/click', 'ember-testing/helpers/current_path', 'ember-testing/helpers/current_route_name', 'ember-testing/helpers/current_url', 'ember-testing/helpers/fill_in', 'ember-testing/helpers/find', 'ember-testing/helpers/find_with_assert', 'ember-testing/helpers/key_event', 'ember-testing/helpers/pause_test', 'ember-testing/helpers/trigger_event', 'ember-testing/helpers/visit', 'ember-testing/helpers/wait'], function (exports, _emberMetal, _emberTestingTestHelpers, _emberTestingHelpersAnd_then, _emberTestingHelpersClick, _emberTestingHelpersCurrent_path, _emberTestingHelpersCurrent_route_name, _emberTestingHelpersCurrent_url, _emberTestingHelpersFill_in, _emberTestingHelpersFind, _emberTestingHelpersFind_with_assert, _emberTestingHelpersKey_event, _emberTestingHelpersPause_test, _emberTestingHelpersTrigger_event, _emberTestingHelpersVisit, _emberTestingHelpersWait) {
'use strict';
+ _emberTestingTestHelpers.registerAsyncHelper('visit', _emberTestingHelpersVisit.default);
+ _emberTestingTestHelpers.registerAsyncHelper('click', _emberTestingHelpersClick.default);
+ _emberTestingTestHelpers.registerAsyncHelper('keyEvent', _emberTestingHelpersKey_event.default);
+ _emberTestingTestHelpers.registerAsyncHelper('fillIn', _emberTestingHelpersFill_in.default);
+ _emberTestingTestHelpers.registerAsyncHelper('wait', _emberTestingHelpersWait.default);
+ _emberTestingTestHelpers.registerAsyncHelper('andThen', _emberTestingHelpersAnd_then.default);
+ _emberTestingTestHelpers.registerAsyncHelper('pauseTest', _emberTestingHelpersPause_test.pauseTest);
+ _emberTestingTestHelpers.registerAsyncHelper('triggerEvent', _emberTestingHelpersTrigger_event.default);
+
+ _emberTestingTestHelpers.registerHelper('find', _emberTestingHelpersFind.default);
+ _emberTestingTestHelpers.registerHelper('findWithAssert', _emberTestingHelpersFind_with_assert.default);
+ _emberTestingTestHelpers.registerHelper('currentRouteName', _emberTestingHelpersCurrent_route_name.default);
+ _emberTestingTestHelpers.registerHelper('currentPath', _emberTestingHelpersCurrent_path.default);
+ _emberTestingTestHelpers.registerHelper('currentURL', _emberTestingHelpersCurrent_url.default);
+
+ if (false) {
+ _emberTestingTestHelpers.registerHelper('resumeTest', _emberTestingHelpersPause_test.resumeTest);
+ }
+});
+enifed("ember-testing/helpers/and_then", ["exports"], function (exports) {
/**
@module ember
@submodule ember-testing
*/
+ "use strict";
+ exports.default = andThen;
+
+ function andThen(app, callback) {
+ return app.testHelpers.wait(callback(app));
+ }
+});
+enifed('ember-testing/helpers/click', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
/**
- Loads a route, sets up any controllers, and renders any templates associated
- with the route as though a real user had triggered the route change while
- using your app.
-
- Example:
-
- ```javascript
- visit('posts/index').then(function() {
- // assert something
- });
- ```
-
- @method visit
- @param {String} url the name of the route
- @return {RSVP.Promise}
- @public
+ @module ember
+ @submodule ember-testing
*/
- _emberTestingTestHelpers.registerAsyncHelper('visit', _emberTestingHelpersVisit.default);
+ 'use strict';
+ exports.default = click;
+
/**
Clicks an element and triggers any actions triggered by the element's `click`
event.
Example:
@@ -1100,116 +1192,35 @@
@param {String} selector jQuery selector for finding element on the DOM
@param {Object} context A DOM Element, Document, or jQuery to use as context
@return {RSVP.Promise}
@public
*/
- _emberTestingTestHelpers.registerAsyncHelper('click', _emberTestingHelpersClick.default);
- /**
- Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
-
- Example:
-
- ```javascript
- keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
- // assert something
- });
- ```
-
- @method keyEvent
- @param {String} selector jQuery selector for finding element on the DOM
- @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
- @param {Number} keyCode the keyCode of the simulated key event
- @return {RSVP.Promise}
- @since 1.5.0
- @public
- */
- _emberTestingTestHelpers.registerAsyncHelper('keyEvent', _emberTestingHelpersKey_event.default);
+ function click(app, selector, context) {
+ var $el = app.testHelpers.findWithAssert(selector, context);
+ var el = $el[0];
- /**
- Fills in an input element with some text.
-
- Example:
-
- ```javascript
- fillIn('#email', 'you@example.com').then(function() {
- // assert something
- });
- ```
-
- @method fillIn
- @param {String} selector jQuery selector finding an input element on the DOM
- to fill text with
- @param {String} text text to place inside the input element
- @return {RSVP.Promise}
- @public
- */
- _emberTestingTestHelpers.registerAsyncHelper('fillIn', _emberTestingHelpersFill_in.default);
+ _emberTestingEvents.fireEvent(el, 'mousedown');
- /**
- Finds an element in the context of the app's container element. A simple alias
- for `app.$(selector)`.
-
- Example:
-
- ```javascript
- var $el = find('.my-selector');
- ```
-
- @method find
- @param {String} selector jQuery string selector for element lookup
- @return {Object} jQuery object representing the results of the query
- @public
- */
- _emberTestingTestHelpers.registerHelper('find', _emberTestingHelpersFind.default);
+ _emberTestingEvents.focus(el);
+ _emberTestingEvents.fireEvent(el, 'mouseup');
+ _emberTestingEvents.fireEvent(el, 'click');
+
+ return app.testHelpers.wait();
+ }
+});
+enifed('ember-testing/helpers/current_path', ['exports', 'ember-metal'], function (exports, _emberMetal) {
/**
- Like `find`, but throws an error if the element selector returns no results.
-
- Example:
-
- ```javascript
- var $el = findWithAssert('.doesnt-exist'); // throws error
- ```
-
- @method findWithAssert
- @param {String} selector jQuery selector string for finding an element within
- the DOM
- @return {Object} jQuery object representing the results of the query
- @throws {Error} throws error if jQuery object returned has a length of 0
- @public
+ @module ember
+ @submodule ember-testing
*/
- _emberTestingTestHelpers.registerHelper('findWithAssert', _emberTestingHelpersFind_with_assert.default);
+ 'use strict';
+ exports.default = currentPath;
+
/**
- Causes the run loop to process any pending events. This is used to ensure that
- any async operations from other helpers (or your assertions) have been processed.
-
- This is most often used as the return value for the helper functions (see 'click',
- 'fillIn','visit',etc).
-
- Example:
-
- ```javascript
- Ember.Test.registerAsyncHelper('loginUser', function(app, username, password) {
- visit('secured/path/here')
- .fillIn('#username', username)
- .fillIn('#password', password)
- .click('.submit')
-
- return app.testHelpers.wait();
- });
-
- @method wait
- @param {Object} value The value to be returned.
- @return {RSVP.Promise}
- @public
- */
- _emberTestingTestHelpers.registerAsyncHelper('wait', _emberTestingHelpersWait.default);
- _emberTestingTestHelpers.registerAsyncHelper('andThen', _emberTestingHelpersAnd_then.default);
- _emberTestingTestHelpers.registerHelper('currentRouteName', _emberTestingHelpersCurrent_route_name.default);
- /**
Returns the current path.
Example:
```javascript
@@ -1223,73 +1234,17 @@
@method currentPath
@return {Object} The currently active path.
@since 1.5.0
@public
*/
- _emberTestingTestHelpers.registerHelper('currentPath', _emberTestingHelpersCurrent_path.default);
- /**
- Returns the current URL.
-
- Example:
-
- ```javascript
- function validateURL() {
- equal(currentURL(), '/some/path', "correct URL was transitioned into.");
- }
-
- click('#some-link-id').then(validateURL);
- ```
-
- @method currentURL
- @return {Object} The currently active URL.
- @since 1.5.0
- @public
- */
- _emberTestingTestHelpers.registerHelper('currentURL', _emberTestingHelpersCurrent_url.default);
- _emberTestingTestHelpers.registerAsyncHelper('pauseTest', _emberTestingHelpersPause_test.default);
- _emberTestingTestHelpers.registerAsyncHelper('triggerEvent', _emberTestingHelpersTrigger_event.default);
-});
-enifed("ember-testing/helpers/and_then", ["exports"], function (exports) {
- "use strict";
-
- exports.default = andThen;
-
- function andThen(app, callback) {
- return app.testHelpers.wait(callback(app));
- }
-});
-enifed('ember-testing/helpers/click', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
- 'use strict';
-
- exports.default = click;
-
- function click(app, selector, context) {
- var $el = app.testHelpers.findWithAssert(selector, context);
- var el = $el[0];
-
- _emberTestingEvents.fireEvent(el, 'mousedown');
-
- _emberTestingEvents.focus(el);
-
- _emberTestingEvents.fireEvent(el, 'mouseup');
- _emberTestingEvents.fireEvent(el, 'click');
-
- return app.testHelpers.wait();
- }
-});
-enifed('ember-testing/helpers/current_path', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
- 'use strict';
-
- exports.default = currentPath;
-
function currentPath(app) {
var routingService = app.__container__.lookup('service:-routing');
- return _emberMetalProperty_get.get(routingService, 'currentPath');
+ return _emberMetal.get(routingService, 'currentPath');
}
});
-enifed('ember-testing/helpers/current_route_name', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
+enifed('ember-testing/helpers/current_route_name', ['exports', 'ember-metal'], function (exports, _emberMetal) {
/**
@module ember
@submodule ember-testing
*/
'use strict';
@@ -1311,28 +1266,74 @@
@public
*/
function currentRouteName(app) {
var routingService = app.__container__.lookup('service:-routing');
- return _emberMetalProperty_get.get(routingService, 'currentRouteName');
+ return _emberMetal.get(routingService, 'currentRouteName');
}
});
-enifed('ember-testing/helpers/current_url', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
+enifed('ember-testing/helpers/current_url', ['exports', 'ember-metal'], function (exports, _emberMetal) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
'use strict';
exports.default = currentURL;
+ /**
+ Returns the current URL.
+
+ Example:
+
+ ```javascript
+ function validateURL() {
+ equal(currentURL(), '/some/path', "correct URL was transitioned into.");
+ }
+
+ click('#some-link-id').then(validateURL);
+ ```
+
+ @method currentURL
+ @return {Object} The currently active URL.
+ @since 1.5.0
+ @public
+ */
+
function currentURL(app) {
var router = app.__container__.lookup('router:main');
- return _emberMetalProperty_get.get(router, 'location').getURL();
+ return _emberMetal.get(router, 'location').getURL();
}
});
enifed('ember-testing/helpers/fill_in', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
'use strict';
exports.default = fillIn;
+ /**
+ Fills in an input element with some text.
+
+ Example:
+
+ ```javascript
+ fillIn('#email', 'you@example.com').then(function() {
+ // assert something
+ });
+ ```
+
+ @method fillIn
+ @param {String} selector jQuery selector finding an input element on the DOM
+ to fill text with
+ @param {String} text text to place inside the input element
+ @return {RSVP.Promise}
+ @public
+ */
+
function fillIn(app, selector, contextOrText, text) {
var $el = undefined,
el = undefined,
context = undefined;
if (typeof text === 'undefined') {
@@ -1349,23 +1350,79 @@
_emberTestingEvents.fireEvent(el, 'change');
return app.testHelpers.wait();
}
});
-enifed('ember-testing/helpers/find', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
+enifed('ember-testing/helpers/find', ['exports', 'ember-metal'], function (exports, _emberMetal) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
'use strict';
exports.default = find;
+ /**
+ Finds an element in the context of the app's container element. A simple alias
+ for `app.$(selector)`.
+
+ Example:
+
+ ```javascript
+ var $el = find('.my-selector');
+ ```
+
+ With the `context` param:
+
+ ```javascript
+ var $el = find('.my-selector', '.parent-element-class');
+ ```
+
+ @method find
+ @param {String} selector jQuery string selector for element lookup
+ @param {String} [context] (optional) jQuery selector that will limit the selector
+ argument to find only within the context's children
+ @return {Object} jQuery object representing the results of the query
+ @public
+ */
+
function find(app, selector, context) {
var $el = undefined;
- context = context || _emberMetalProperty_get.get(app, 'rootElement');
+ context = context || _emberMetal.get(app, 'rootElement');
$el = app.$(selector, context);
return $el;
}
});
enifed('ember-testing/helpers/find_with_assert', ['exports'], function (exports) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
+ /**
+ Like `find`, but throws an error if the element selector returns no results.
+
+ Example:
+
+ ```javascript
+ var $el = findWithAssert('.doesnt-exist'); // throws error
+ ```
+
+ With the `context` param:
+
+ ```javascript
+ var $el = findWithAssert('.selector-id', '.parent-element-class'); // assert will pass
+ ```
+
+ @method findWithAssert
+ @param {String} selector jQuery selector string for finding an element within
+ the DOM
+ @param {String} [context] (optional) jQuery selector that will limit the
+ selector argument to find only within the context's children
+ @return {Object} jQuery object representing the results of the query
+ @throws {Error} throws error if jQuery object returned has a length of 0
+ @public
+ */
'use strict';
exports.default = findWithAssert;
function findWithAssert(app, selector, context) {
@@ -1375,10 +1432,30 @@
}
return $el;
}
});
enifed('ember-testing/helpers/key_event', ['exports'], function (exports) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
+ /**
+ Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
+ Example:
+ ```javascript
+ keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
+ // assert something
+ });
+ ```
+ @method keyEvent
+ @param {String} selector jQuery selector for finding element on the DOM
+ @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
+ @param {Number} keyCode the keyCode of the simulated key event
+ @return {RSVP.Promise}
+ @since 1.5.0
+ @public
+ */
'use strict';
exports.default = keyEvent;
function keyEvent(app, selector, contextOrType, typeOrKeyCode, keyCode) {
@@ -1395,23 +1472,41 @@
}
return app.testHelpers.triggerEvent(selector, context, type, { keyCode: keyCode, which: keyCode });
}
});
-enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime/ext/rsvp'], function (exports, _emberRuntimeExtRsvp) {
+enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime', 'ember-console', 'ember-metal'], function (exports, _emberRuntime, _emberConsole, _emberMetal) {
/**
@module ember
@submodule ember-testing
*/
'use strict';
- exports.default = pauseTest;
+ exports.resumeTest = resumeTest;
+ exports.pauseTest = pauseTest;
+ var resume = undefined;
+
/**
+ Resumes a test paused by `pauseTest`.
+
+ @method resumeTest
+ @return {void}
+ @public
+ */
+
+ function resumeTest() {
+ _emberMetal.assert('Testing has not been paused. There is nothing to resume.', resume);
+ resume();
+ resume = undefined;
+ }
+
+ /**
Pauses the current test - this is useful for debugging while testing or for test-driving.
It allows you to inspect the state of your application at any point.
Example (The test will pause before clicking the button):
+
```javascript
visit('/')
return pauseTest();
click('.btn');
```
@@ -1420,11 +1515,19 @@
@return {Object} A promise that will never resolve
@public
*/
function pauseTest() {
- return new _emberRuntimeExtRsvp.default.Promise(function () {}, 'TestAdapter paused promise');
+ if (false) {
+ _emberConsole.default.info('Testing paused. Use `resumeTest()` to continue.');
+ }
+
+ return new _emberRuntime.RSVP.Promise(function (resolve) {
+ if (false) {
+ resume = resolve;
+ }
+ }, 'TestAdapter paused promise');
}
});
enifed('ember-testing/helpers/trigger_event', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
/**
@module ember
@@ -1494,45 +1597,97 @@
_emberTestingEvents.fireEvent(el, type, options);
return app.testHelpers.wait();
}
});
-enifed('ember-testing/helpers/visit', ['exports', 'ember-metal/run_loop'], function (exports, _emberMetalRun_loop) {
+enifed('ember-testing/helpers/visit', ['exports', 'ember-metal'], function (exports, _emberMetal) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
'use strict';
exports.default = visit;
+ /**
+ Loads a route, sets up any controllers, and renders any templates associated
+ with the route as though a real user had triggered the route change while
+ using your app.
+
+ Example:
+
+ ```javascript
+ visit('posts/index').then(function() {
+ // assert something
+ });
+ ```
+
+ @method visit
+ @param {String} url the name of the route
+ @return {RSVP.Promise}
+ @public
+ */
+
function visit(app, url) {
var router = app.__container__.lookup('router:main');
var shouldHandleURL = false;
app.boot().then(function () {
router.location.setURL(url);
if (shouldHandleURL) {
- _emberMetalRun_loop.default(app.__deprecatedInstance__, 'handleURL', url);
+ _emberMetal.run(app.__deprecatedInstance__, 'handleURL', url);
}
});
if (app._readinessDeferrals > 0) {
router['initialURL'] = url;
- _emberMetalRun_loop.default(app, 'advanceReadiness');
+ _emberMetal.run(app, 'advanceReadiness');
delete router['initialURL'];
} else {
shouldHandleURL = true;
}
return app.testHelpers.wait();
}
});
-enifed('ember-testing/helpers/wait', ['exports', 'ember-testing/test/waiters', 'ember-runtime/ext/rsvp', 'ember-metal/run_loop', 'ember-testing/test/pending_requests'], function (exports, _emberTestingTestWaiters, _emberRuntimeExtRsvp, _emberMetalRun_loop, _emberTestingTestPending_requests) {
+enifed('ember-testing/helpers/wait', ['exports', 'ember-testing/test/waiters', 'ember-runtime', 'ember-metal', 'ember-testing/test/pending_requests'], function (exports, _emberTestingTestWaiters, _emberRuntime, _emberMetal, _emberTestingTestPending_requests) {
+ /**
+ @module ember
+ @submodule ember-testing
+ */
'use strict';
exports.default = wait;
+ /**
+ Causes the run loop to process any pending events. This is used to ensure that
+ any async operations from other helpers (or your assertions) have been processed.
+
+ This is most often used as the return value for the helper functions (see 'click',
+ 'fillIn','visit',etc).
+
+ Example:
+
+ ```javascript
+ Ember.Test.registerAsyncHelper('loginUser', function(app, username, password) {
+ visit('secured/path/here')
+ .fillIn('#username', username)
+ .fillIn('#password', password)
+ .click('.submit')
+
+ return app.testHelpers.wait();
+ });
+
+ @method wait
+ @param {Object} value The value to be returned.
+ @return {RSVP.Promise}
+ @public
+ */
+
function wait(app, value) {
- return new _emberRuntimeExtRsvp.default.Promise(function (resolve) {
+ return new _emberRuntime.RSVP.Promise(function (resolve) {
var router = app.__container__.lookup('router:main');
// Every 10ms, poll for the async thing to have finished
var watcher = setInterval(function () {
// 1. If the router is loading, keep polling
@@ -1545,11 +1700,11 @@
if (_emberTestingTestPending_requests.pendingRequests()) {
return;
}
// 3. If there are scheduled timers or we are inside of a run loop, keep polling
- if (_emberMetalRun_loop.default.hasScheduledTimers() || _emberMetalRun_loop.default.currentRunLoop) {
+ if (_emberMetal.run.hasScheduledTimers() || _emberMetal.run.currentRunLoop) {
return;
}
if (_emberTestingTestWaiters.checkWaiters()) {
return;
@@ -1557,43 +1712,38 @@
// Stop polling
clearInterval(watcher);
// Synchronously resolve the promise
- _emberMetalRun_loop.default(null, resolve, value);
+ _emberMetal.run(null, resolve, value);
}, 10);
});
}
});
-enifed('ember-testing/index', ['exports', 'ember-metal/core', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/setup_for_testing', 'require', 'ember-testing/support', 'ember-testing/ext/application', 'ember-testing/ext/rsvp', 'ember-testing/helpers', 'ember-testing/initializers'], function (exports, _emberMetalCore, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingSetup_for_testing, _require, _emberTestingSupport, _emberTestingExtApplication, _emberTestingExtRsvp, _emberTestingHelpers, _emberTestingInitializers) {
+enifed('ember-testing/index', ['exports', 'ember-testing/support', 'ember-testing/ext/application', 'ember-testing/ext/rsvp', 'ember-testing/helpers', 'ember-testing/initializers', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/setup_for_testing', 'ember-testing/adapters/qunit'], function (exports, _emberTestingSupport, _emberTestingExtApplication, _emberTestingExtRsvp, _emberTestingHelpers, _emberTestingInitializers, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingSetup_for_testing, _emberTestingAdaptersQunit) {
'use strict';
- // to setup initializer
-
- /**
- @module ember
- @submodule ember-testing
- */
-
- _emberMetalCore.default.Test = _emberTestingTest.default;
- _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default;
- _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default;
- Object.defineProperty(_emberTestingTest.default, 'QUnitAdapter', {
- get: function () {
- return _require.default('ember-testing/adapters/qunit').default;
- }
- });
+ exports.Test = _emberTestingTest.default;
+ exports.Adapter = _emberTestingAdaptersAdapter.default;
+ exports.setupForTesting = _emberTestingSetup_for_testing.default;
+ exports.QUnitAdapter = _emberTestingAdaptersQunit.default;
});
-// reexports
// to handle various edge cases
+// setup RSVP + run loop integration
// adds helpers to helpers object in Test
-enifed('ember-testing/initializers', ['exports', 'ember-runtime/system/lazy_load'], function (exports, _emberRuntimeSystemLazy_load) {
+// to setup initializer
+
+/**
+ @module ember
+ @submodule ember-testing
+*/
+enifed('ember-testing/initializers', ['exports', 'ember-runtime'], function (exports, _emberRuntime) {
'use strict';
var name = 'deferReadiness in `testing` mode';
- _emberRuntimeSystemLazy_load.onLoad('Ember.Application', function (Application) {
+ _emberRuntime.onLoad('Ember.Application', function (Application) {
if (!Application.initializers[name]) {
Application.initializer({
name: name,
initialize: function (application) {
@@ -1603,11 +1753,11 @@
}
});
}
});
});
-enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/testing', 'ember-views/system/jquery', 'ember-testing/test/adapter', 'ember-testing/test/pending_requests', 'require'], function (exports, _emberMetalTesting, _emberViewsSystemJquery, _emberTestingTestAdapter, _emberTestingTestPending_requests, _require) {
+enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal', 'ember-views', 'ember-testing/test/adapter', 'ember-testing/test/pending_requests', 'ember-testing/adapters/qunit'], function (exports, _emberMetal, _emberViews, _emberTestingTestAdapter, _emberTestingTestPending_requests, _emberTestingAdaptersQunit) {
'use strict';
exports.default = setupForTesting;
/**
@@ -1622,51 +1772,51 @@
@since 1.5.0
@private
*/
function setupForTesting() {
- _emberMetalTesting.setTesting(true);
+ _emberMetal.setTesting(true);
var adapter = _emberTestingTestAdapter.getAdapter();
// if adapter is not manually set default to QUnit
if (!adapter) {
- var QUnitAdapter = _require.default('ember-testing/adapters/qunit').default;
- _emberTestingTestAdapter.setAdapter(new QUnitAdapter());
+ _emberTestingTestAdapter.setAdapter(new _emberTestingAdaptersQunit.default());
}
- _emberViewsSystemJquery.default(document).off('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
- _emberViewsSystemJquery.default(document).off('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
+ _emberViews.jQuery(document).off('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
+ _emberViews.jQuery(document).off('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
_emberTestingTestPending_requests.clearPendingRequests();
- _emberViewsSystemJquery.default(document).on('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
- _emberViewsSystemJquery.default(document).on('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
+ _emberViews.jQuery(document).on('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
+ _emberViews.jQuery(document).on('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
}
});
-enifed('ember-testing/support', ['exports', 'ember-metal/debug', 'ember-views/system/jquery', 'ember-environment'], function (exports, _emberMetalDebug, _emberViewsSystemJquery, _emberEnvironment) {
+enifed('ember-testing/support', ['exports', 'ember-metal', 'ember-views', 'ember-environment'], function (exports, _emberMetal, _emberViews, _emberEnvironment) {
'use strict';
/**
@module ember
@submodule ember-testing
*/
- var $ = _emberViewsSystemJquery.default;
+ var $ = _emberViews.jQuery;
/**
This method creates a checkbox and triggers the click event to fire the
passed in handler. It is used to correct for a bug in older versions
of jQuery (e.g 1.8.3).
@private
@method testCheckboxClick
*/
function testCheckboxClick(handler) {
- $('<input type="checkbox">').css({ position: 'absolute', left: '-1000px', top: '-1000px' }).appendTo('body').on('click', handler).trigger('click').remove();
+ var input = document.createElement('input');
+ $(input).attr('type', 'checkbox').css({ position: 'absolute', left: '-1000px', top: '-1000px' }).appendTo('body').on('click', handler).trigger('click').remove();
}
- if (_emberEnvironment.environment.hasDOM) {
+ if (_emberEnvironment.environment.hasDOM && typeof $ === 'function') {
$(function () {
/*
Determine whether a checkbox checked using jQuery's "click" method will have
the correct value for its checked property.
If we determine that the current jQuery version exhibits this behavior,
@@ -1687,16 +1837,16 @@
}
});
// Try again to verify that the patch took effect or blow up.
testCheckboxClick(function () {
- _emberMetalDebug.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' });
+ _emberMetal.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' });
});
});
}
});
-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) {
+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'], function (exports, _emberTestingTestHelpers, _emberTestingTestOn_inject_helpers, _emberTestingTestPromise, _emberTestingTestWaiters, _emberTestingTestAdapter, _emberMetal) {
/**
@module ember
@submodule ember-testing
*/
'use strict';
@@ -1766,11 +1916,11 @@
get: _emberTestingTestWaiters.generateDeprecatedWaitersArray
});
exports.default = Test;
});
-enifed('ember-testing/test/adapter', ['exports', 'ember-console', 'ember-metal/error_handler'], function (exports, _emberConsole, _emberMetalError_handler) {
+enifed('ember-testing/test/adapter', ['exports', 'ember-console', 'ember-metal'], function (exports, _emberConsole, _emberMetal) {
'use strict';
exports.getAdapter = getAdapter;
exports.setAdapter = setAdapter;
exports.asyncStart = asyncStart;
@@ -1783,13 +1933,13 @@
}
function setAdapter(value) {
adapter = value;
if (value) {
- _emberMetalError_handler.setDispatchOverride(adapterDispatch);
+ _emberMetal.setDispatchOverride(adapterDispatch);
} else {
- _emberMetalError_handler.setDispatchOverride(null);
+ _emberMetal.setDispatchOverride(null);
}
}
function asyncStart() {
if (adapter) {
@@ -1996,30 +2146,24 @@
break;
}
}
}
});
-enifed('ember-testing/test/promise', ['exports', 'ember-runtime/ext/rsvp', 'ember-testing/test/run'], function (exports, _emberRuntimeExtRsvp, _emberTestingTestRun) {
+enifed('ember-testing/test/promise', ['exports', 'ember-runtime', 'ember-testing/test/run'], function (exports, _emberRuntime, _emberTestingTestRun) {
'use strict';
exports.promise = promise;
exports.resolve = resolve;
exports.getLastPromise = getLastPromise;
- function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
-
- function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
-
var lastPromise = undefined;
var TestPromise = (function (_RSVP$Promise) {
- _inherits(TestPromise, _RSVP$Promise);
+ babelHelpers.inherits(TestPromise, _RSVP$Promise);
function TestPromise() {
- _classCallCheck(this, TestPromise);
+ babelHelpers.classCallCheck(this, TestPromise);
_RSVP$Promise.apply(this, arguments);
lastPromise = this;
}
@@ -2035,16 +2179,10 @@
@method promise
@param {Function} resolver The function used to resolve the promise.
@param {String} label An optional string for identifying the promise.
*/
- TestPromise.resolve = function resolve(val) {
- return new TestPromise(function (resolve) {
- return resolve(val);
- });
- };
-
TestPromise.prototype.then = function then(onFulfillment) {
var _RSVP$Promise$prototype$then;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
@@ -2054,11 +2192,11 @@
return isolate(onFulfillment, result);
}].concat(args));
};
return TestPromise;
- })(_emberRuntimeExtRsvp.default.Promise);
+ })(_emberRuntime.RSVP.Promise);
exports.default = TestPromise;
function promise(resolver, label) {
var fullLabel = 'Ember.Test.promise: ' + (label || '<Unknown Promise>');
@@ -2075,14 +2213,12 @@
@method resolve
@param {Mixed} The value to resolve
@since 1.2.0
*/
- function resolve(result) {
- return new TestPromise(function (resolve) {
- return resolve(result);
- });
+ function resolve(result, label) {
+ return TestPromise.resolve(result, label);
}
function getLastPromise() {
return lastPromise;
}
@@ -2114,24 +2250,24 @@
});
});
}
}
});
-enifed('ember-testing/test/run', ['exports', 'ember-metal/run_loop'], function (exports, _emberMetalRun_loop) {
+enifed('ember-testing/test/run', ['exports', 'ember-metal'], function (exports, _emberMetal) {
'use strict';
exports.default = run;
function run(fn) {
- if (!_emberMetalRun_loop.default.currentRunLoop) {
- return _emberMetalRun_loop.default(fn);
+ if (!_emberMetal.run.currentRunLoop) {
+ return _emberMetal.run(fn);
} else {
return fn();
}
}
});
-enifed('ember-testing/test/waiters', ['exports', 'ember-metal/features', 'ember-metal/debug'], function (exports, _emberMetalFeatures, _emberMetalDebug) {
+enifed('ember-testing/test/waiters', ['exports', 'ember-metal'], function (exports, _emberMetal) {
'use strict';
exports.registerWaiter = registerWaiter;
exports.unregisterWaiter = unregisterWaiter;
exports.checkWaiters = checkWaiters;
@@ -2141,11 +2277,14 @@
var callbacks = [];
/**
This allows ember-testing to play nicely with other asynchronous
events, such as an application that is waiting for a CSS3
- transition or an IndexDB transaction.
+ transition or an IndexDB transaction. The waiter runs periodically
+ after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
+ until the returning result is truthy. After the waiters finish, the next async helper
+ is executed and the process repeats.
For example:
```javascript
Ember.Test.registerWaiter(function() {
@@ -2245,10 +2384,10 @@
}
return -1;
}
function generateDeprecatedWaitersArray() {
- _emberMetalDebug.deprecate('Usage of `Ember.Test.waiters` is deprecated. Please refactor to `Ember.Test.checkWaiters`.', !true, { until: '2.8.0', id: 'ember-testing.test-waiters' });
+ _emberMetal.deprecate('Usage of `Ember.Test.waiters` is deprecated. Please refactor to `Ember.Test.checkWaiters`.', !true, { 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];