ember-source 1.13.0.beta.2 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

@@ -5,7 +5,7 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 1.13.0-beta.2
8
+ * @version 1.13.0
9
9
  */
10
10
 
11
11
  (function() {
@@ -13,8 +13,12 @@ var enifed, requireModule, eriuqer, requirejs, Ember;
13
13
  var mainContext = this;
14
14
 
15
15
  (function() {
16
+ var isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
17
+
18
+ if (!isNode) {
19
+ Ember = this.Ember = this.Ember || {};
20
+ }
16
21
 
17
- Ember = this.Ember = this.Ember || {};
18
22
  if (typeof Ember === 'undefined') { Ember = {}; };
19
23
 
20
24
  if (typeof Ember.__loader === 'undefined') {
@@ -110,11 +114,18 @@ var mainContext = this;
110
114
  }
111
115
  })();
112
116
 
113
- enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/logger', 'ember-metal/environment'], function (exports, Ember, EmberError, Logger, environment) {
117
+ enifed("ember-debug", ["exports", "ember-metal/core", "ember-metal/error", "ember-metal/logger", "ember-debug/deprecation-manager", "ember-metal/environment"], function (exports, _emberMetalCore, _emberMetalError, _emberMetalLogger, _emberDebugDeprecationManager, _emberMetalEnvironment) {
118
+ exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
114
119
 
115
- 'use strict';
120
+ /**
121
+ @module ember
122
+ @submodule ember-debug
123
+ */
116
124
 
117
- exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
125
+ /**
126
+ @class Ember
127
+ @public
128
+ */
118
129
 
119
130
  function isPlainFunction(test) {
120
131
  return typeof test === "function" && test.PrototypeMixin === undefined;
@@ -124,23 +135,24 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
124
135
  Define an assertion that will throw an exception if the condition is not
125
136
  met. Ember build tools will remove any calls to `Ember.assert()` when
126
137
  doing a production build. Example:
127
-
138
+
128
139
  ```javascript
129
140
  // Test for truthiness
130
141
  Ember.assert('Must pass a valid object', obj);
131
-
142
+
132
143
  // Fail unconditionally
133
144
  Ember.assert('This code path should never be run');
134
145
  ```
135
-
146
+
136
147
  @method assert
137
148
  @param {String} desc A description of the assertion. This will become
138
149
  the text of the Error thrown if the assertion fails.
139
150
  @param {Boolean|Function} test Must be truthy for the assertion to pass. If
140
151
  falsy, an exception will be thrown. If this is a function, it will be executed and
141
152
  its return value will be used as condition.
153
+ @public
142
154
  */
143
- Ember['default'].assert = function (desc, test) {
155
+ _emberMetalCore.default.assert = function (desc, test) {
144
156
  var throwAssertion;
145
157
 
146
158
  if (isPlainFunction(test)) {
@@ -150,24 +162,25 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
150
162
  }
151
163
 
152
164
  if (throwAssertion) {
153
- throw new EmberError['default']("Assertion Failed: " + desc);
165
+ throw new _emberMetalError.default("Assertion Failed: " + desc);
154
166
  }
155
167
  };
156
168
 
157
169
  /**
158
170
  Display a warning with the provided message. Ember build tools will
159
171
  remove any calls to `Ember.warn()` when doing a production build.
160
-
172
+
161
173
  @method warn
162
174
  @param {String} message A warning to display.
163
175
  @param {Boolean} test An optional boolean. If falsy, the warning
164
176
  will be displayed.
177
+ @public
165
178
  */
166
- Ember['default'].warn = function (message, test) {
179
+ _emberMetalCore.default.warn = function (message, test) {
167
180
  if (!test) {
168
- Logger['default'].warn("WARNING: " + message);
169
- if ("trace" in Logger['default']) {
170
- Logger['default'].trace();
181
+ _emberMetalLogger.default.warn("WARNING: " + message);
182
+ if ("trace" in _emberMetalLogger.default) {
183
+ _emberMetalLogger.default.trace();
171
184
  }
172
185
  }
173
186
  };
@@ -175,32 +188,44 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
175
188
  /**
176
189
  Display a debug notice. Ember build tools will remove any calls to
177
190
  `Ember.debug()` when doing a production build.
178
-
191
+
179
192
  ```javascript
180
193
  Ember.debug('I\'m a debug notice!');
181
194
  ```
182
-
195
+
183
196
  @method debug
184
197
  @param {String} message A debug message to display.
198
+ @public
185
199
  */
186
- Ember['default'].debug = function (message) {
187
- Logger['default'].debug("DEBUG: " + message);
200
+ _emberMetalCore.default.debug = function (message) {
201
+ _emberMetalLogger.default.debug("DEBUG: " + message);
188
202
  };
189
203
 
190
204
  /**
191
205
  Display a deprecation warning with the provided message and a stack trace
192
206
  (Chrome and Firefox only). Ember build tools will remove any calls to
193
207
  `Ember.deprecate()` when doing a production build.
194
-
208
+
195
209
  @method deprecate
196
210
  @param {String} message A description of the deprecation.
197
211
  @param {Boolean|Function} test An optional boolean. If falsy, the deprecation
198
212
  will be displayed. If this is a function, it will be executed and its return
199
213
  value will be used as condition.
200
214
  @param {Object} options An optional object that can be used to pass
201
- in a `url` to the transition guide on the emberjs.com website.
215
+ in a `url` to the transition guide on the emberjs.com website, and a unique
216
+ `id` for this deprecation. The `id` can be used by Ember debugging tools
217
+ to change the behavior (raise, log or silence) for that specific deprecation.
218
+ The `id` should be namespaced by dots, e.g. "view.helper.select".
219
+ @public
202
220
  */
203
- Ember['default'].deprecate = function (message, test, options) {
221
+ _emberMetalCore.default.deprecate = function (message, test, options) {
222
+ if (_emberMetalCore.default.ENV.RAISE_ON_DEPRECATION) {
223
+ _emberDebugDeprecationManager.default.setDefaultLevel(_emberDebugDeprecationManager.deprecationLevels.RAISE);
224
+ }
225
+ if (_emberDebugDeprecationManager.default.getLevel(options && options.id) === _emberDebugDeprecationManager.deprecationLevels.SILENCE) {
226
+ return;
227
+ }
228
+
204
229
  var noDeprecation;
205
230
 
206
231
  if (isPlainFunction(test)) {
@@ -213,8 +238,12 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
213
238
  return;
214
239
  }
215
240
 
216
- if (Ember['default'].ENV.RAISE_ON_DEPRECATION) {
217
- throw new EmberError['default'](message);
241
+ if (options && options.id) {
242
+ message = message + (" [deprecation id: " + options.id + "]");
243
+ }
244
+
245
+ if (_emberDebugDeprecationManager.default.getLevel(options && options.id) === _emberDebugDeprecationManager.deprecationLevels.RAISE) {
246
+ throw new _emberMetalError.default(message);
218
247
  }
219
248
 
220
249
  var error;
@@ -227,13 +256,13 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
227
256
  }
228
257
 
229
258
  if (arguments.length === 3) {
230
- Ember['default'].assert("options argument to Ember.deprecate should be an object", options && typeof options === "object");
259
+ _emberMetalCore.default.assert("options argument to Ember.deprecate should be an object", options && typeof options === "object");
231
260
  if (options.url) {
232
261
  message += " See " + options.url + " for more details.";
233
262
  }
234
263
  }
235
264
 
236
- if (Ember['default'].LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
265
+ if (_emberMetalCore.default.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
237
266
  var stack;
238
267
  var stackStr = "";
239
268
 
@@ -250,30 +279,31 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
250
279
  message = message + stackStr;
251
280
  }
252
281
 
253
- Logger['default'].warn("DEPRECATION: " + message);
282
+ _emberMetalLogger.default.warn("DEPRECATION: " + message);
254
283
  };
255
284
 
256
285
  /**
257
286
  Alias an old, deprecated method with its new counterpart.
258
-
287
+
259
288
  Display a deprecation warning with the provided message and a stack trace
260
289
  (Chrome and Firefox only) when the assigned method is called.
261
-
290
+
262
291
  Ember build tools will not remove calls to `Ember.deprecateFunc()`, though
263
292
  no warnings will be shown in production.
264
-
293
+
265
294
  ```javascript
266
295
  Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod);
267
296
  ```
268
-
297
+
269
298
  @method deprecateFunc
270
299
  @param {String} message A description of the deprecation.
271
300
  @param {Function} func The new function called to replace its deprecated counterpart.
272
301
  @return {Function} a new function that wrapped the original function with a deprecation warning
302
+ @private
273
303
  */
274
- Ember['default'].deprecateFunc = function (message, func) {
304
+ _emberMetalCore.default.deprecateFunc = function (message, func) {
275
305
  return function () {
276
- Ember['default'].deprecate(message);
306
+ _emberMetalCore.default.deprecate(message);
277
307
  return func.apply(this, arguments);
278
308
  };
279
309
  };
@@ -281,7 +311,7 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
281
311
  /**
282
312
  Run a function meant for debugging. Ember build tools will remove any calls to
283
313
  `Ember.runInDebug()` when doing a production build.
284
-
314
+
285
315
  ```javascript
286
316
  Ember.runInDebug(function() {
287
317
  Ember.Handlebars.EachView.reopen({
@@ -291,50 +321,55 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
291
321
  });
292
322
  });
293
323
  ```
294
-
324
+
295
325
  @method runInDebug
296
326
  @param {Function} func The function to be executed.
297
327
  @since 1.5.0
328
+ @public
298
329
  */
299
- Ember['default'].runInDebug = function (func) {
330
+ _emberMetalCore.default.runInDebug = function (func) {
300
331
  func();
301
332
  };
302
333
 
303
334
  /**
304
335
  Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
305
336
  any specific FEATURES flag is truthy.
306
-
337
+
307
338
  This method is called automatically in debug canary builds.
308
-
339
+
309
340
  @private
310
341
  @method _warnIfUsingStrippedFeatureFlags
311
342
  @return {void}
312
343
  */
344
+
313
345
  function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
314
346
  if (featuresWereStripped) {
315
- Ember['default'].warn("Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.", !Ember['default'].ENV.ENABLE_ALL_FEATURES);
316
- Ember['default'].warn("Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.", !Ember['default'].ENV.ENABLE_OPTIONAL_FEATURES);
347
+ _emberMetalCore.default.warn("Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.", !_emberMetalCore.default.ENV.ENABLE_ALL_FEATURES);
348
+ _emberMetalCore.default.warn("Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.", !_emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES);
317
349
 
318
350
  for (var key in FEATURES) {
319
351
  if (FEATURES.hasOwnProperty(key) && key !== "isEnabled") {
320
- Ember['default'].warn("FEATURE[\"" + key + "\"] is set as enabled, but FEATURE flags are only available in canary builds.", !FEATURES[key]);
352
+ _emberMetalCore.default.warn("FEATURE[\"" + key + "\"] is set as enabled, but FEATURE flags are only available in canary builds.", !FEATURES[key]);
321
353
  }
322
354
  }
323
355
  }
324
356
  }
325
357
 
326
- if (!Ember['default'].testing) {
358
+ if (!_emberMetalCore.default.testing) {
327
359
  // Complain if they're using FEATURE flags in builds other than canary
328
- Ember['default'].FEATURES["features-stripped-test"] = true;
360
+ _emberMetalCore.default.FEATURES["features-stripped-test"] = true;
329
361
  var featuresWereStripped = true;
330
362
 
331
-
332
- delete Ember['default'].FEATURES["features-stripped-test"];
333
- _warnIfUsingStrippedFeatureFlags(Ember['default'].ENV.FEATURES, featuresWereStripped);
363
+ if (_emberMetalCore.default.FEATURES.isEnabled("features-stripped-test")) {
364
+ featuresWereStripped = false;
365
+ }
366
+
367
+ delete _emberMetalCore.default.FEATURES["features-stripped-test"];
368
+ _warnIfUsingStrippedFeatureFlags(_emberMetalCore.default.ENV.FEATURES, featuresWereStripped);
334
369
 
335
370
  // Inform the developer about the Ember Inspector if not installed.
336
- var isFirefox = environment['default'].isFirefox;
337
- var isChrome = environment['default'].isChrome;
371
+ var isFirefox = _emberMetalEnvironment.default.isFirefox;
372
+ var isChrome = _emberMetalEnvironment.default.isChrome;
338
373
 
339
374
  if (typeof window !== "undefined" && (isFirefox || isChrome) && window.addEventListener) {
340
375
  window.addEventListener("load", function () {
@@ -347,41 +382,76 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
347
382
  downloadURL = "https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/";
348
383
  }
349
384
 
350
- Ember['default'].debug("For more advanced debugging, install the Ember Inspector from " + downloadURL);
385
+ _emberMetalCore.default.debug("For more advanced debugging, install the Ember Inspector from " + downloadURL);
351
386
  }
352
387
  }, false);
353
388
  }
354
389
  }
355
390
 
391
+ _emberMetalCore.default.Debug = {
392
+ _addDeprecationLevel: function (id, level) {
393
+ _emberDebugDeprecationManager.default.setLevel(id, level);
394
+ },
395
+ _deprecationLevels: _emberDebugDeprecationManager.deprecationLevels
396
+ };
397
+
356
398
  /*
357
399
  We are transitioning away from `ember.js` to `ember.debug.js` to make
358
400
  it much clearer that it is only for local development purposes.
359
-
401
+
360
402
  This flag value is changed by the tooling (by a simple string replacement)
361
403
  so that if `ember.js` (which must be output for backwards compat reasons) is
362
404
  used a nice helpful warning message will be printed out.
363
405
  */
364
406
  var runningNonEmberDebugJS = false;
407
+ exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
365
408
  if (runningNonEmberDebugJS) {
366
- Ember['default'].warn("Please use `ember.debug.js` instead of `ember.js` for development and debugging.");
409
+ _emberMetalCore.default.warn("Please use `ember.debug.js` instead of `ember.js` for development and debugging.");
367
410
  }
368
-
369
- exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
370
-
371
411
  });
372
- enifed('ember-testing', ['ember-metal/core', 'ember-testing/initializers', 'ember-testing/support', 'ember-testing/setup_for_testing', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit', 'ember-testing/helpers'], function (Ember, __dep1__, __dep2__, setupForTesting, Test, Adapter, QUnitAdapter) {
412
+ /*global __fail__*/
413
+ enifed('ember-debug/deprecation-manager', ['exports', 'ember-metal/dictionary', 'ember-metal/utils'], function (exports, _emberMetalDictionary, _emberMetalUtils) {
414
+ var deprecationLevels = {
415
+ RAISE: (0, _emberMetalUtils.symbol)('RAISE'),
416
+ LOG: (0, _emberMetalUtils.symbol)('LOG'),
417
+ SILENCE: (0, _emberMetalUtils.symbol)('SILENCE')
418
+ };
373
419
 
374
- 'use strict';
420
+ exports.deprecationLevels = deprecationLevels;
421
+ exports.default = {
422
+ defaultLevel: deprecationLevels.LOG,
423
+ individualLevels: (0, _emberMetalDictionary.default)(null),
424
+ setDefaultLevel: function (level) {
425
+ this.defaultLevel = level;
426
+ },
427
+ setLevel: function (id, level) {
428
+ this.individualLevels[id] = level;
429
+ },
430
+ getLevel: function (id) {
431
+ var level = this.individualLevels[id];
432
+ if (!level) {
433
+ level = this.defaultLevel;
434
+ }
435
+ return level;
436
+ }
437
+ };
438
+ });
439
+ enifed("ember-testing", ["exports", "ember-metal/core", "ember-testing/initializers", "ember-testing/support", "ember-testing/setup_for_testing", "ember-testing/test", "ember-testing/adapters/adapter", "ember-testing/adapters/qunit", "ember-testing/helpers"], function (exports, _emberMetalCore, _emberTestingInitializers, _emberTestingSupport, _emberTestingSetup_for_testing, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit, _emberTestingHelpers) {
440
+ // adds helpers to helpers object in Test
375
441
 
376
- Ember['default'].Test = Test['default'];
377
- Ember['default'].Test.Adapter = Adapter['default'];
378
- Ember['default'].Test.QUnitAdapter = QUnitAdapter['default'];
379
- Ember['default'].setupForTesting = setupForTesting['default'];
442
+ /**
443
+ @module ember
444
+ @submodule ember-testing
445
+ */
380
446
 
447
+ _emberMetalCore.default.Test = _emberTestingTest.default;
448
+ _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default;
449
+ _emberMetalCore.default.Test.QUnitAdapter = _emberTestingAdaptersQunit.default;
450
+ _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default;
381
451
  });
382
- enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/object'], function (exports, EmberObject) {
383
-
384
- 'use strict';
452
+ // to setup initializer
453
+ // to handle various edge cases
454
+ enifed("ember-testing/adapters/adapter", ["exports", "ember-runtime/system/object"], function (exports, _emberRuntimeSystemObject) {
385
455
 
386
456
  function K() {
387
457
  return this;
@@ -395,11 +465,12 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
395
465
  /**
396
466
  The primary purpose of this class is to create hooks that can be implemented
397
467
  by an adapter for various test frameworks.
398
-
468
+
399
469
  @class Adapter
400
470
  @namespace Ember.Test
471
+ @public
401
472
  */
402
- var Adapter = EmberObject['default'].extend({
473
+ var Adapter = _emberRuntimeSystemObject.default.extend({
403
474
  /**
404
475
  This callback will be called whenever an async operation is about to start.
405
476
  Override this to call your framework's methods that handle async
@@ -435,14 +506,20 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
435
506
  }
436
507
  });
437
508
 
438
- exports['default'] = Adapter;
439
-
509
+ exports.default = Adapter;
440
510
  });
441
- enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapter', 'ember-metal/utils'], function (exports, Adapter, utils) {
511
+ enifed("ember-testing/adapters/qunit", ["exports", "ember-testing/adapters/adapter", "ember-metal/utils"], function (exports, _emberTestingAdaptersAdapter, _emberMetalUtils) {
442
512
 
443
- 'use strict';
444
-
445
- exports['default'] = Adapter['default'].extend({
513
+ /**
514
+ This class implements the methods defined by Ember.Test.Adapter for the
515
+ QUnit testing framework.
516
+
517
+ @class QUnitAdapter
518
+ @namespace Ember.Test
519
+ @extends Ember.Test.Adapter
520
+ @public
521
+ */
522
+ exports.default = _emberTestingAdaptersAdapter.default.extend({
446
523
  asyncStart: function () {
447
524
  QUnit.stop();
448
525
  },
@@ -450,46 +527,48 @@ enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapt
450
527
  QUnit.start();
451
528
  },
452
529
  exception: function (error) {
453
- ok(false, utils.inspect(error));
530
+ ok(false, (0, _emberMetalUtils.inspect)(error));
454
531
  }
455
532
  });
456
-
457
533
  });
458
- enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/run_loop', 'ember-views/system/jquery', 'ember-testing/test', 'ember-runtime/ext/rsvp'], function (Ember, property_get, EmberError, run, jQuery, Test, RSVP) {
534
+ enifed("ember-testing/helpers", ["exports", "ember-metal/core", "ember-metal/property_get", "ember-metal/error", "ember-metal/run_loop", "ember-views/system/jquery", "ember-testing/test", "ember-runtime/ext/rsvp"], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalError, _emberMetalRun_loop, _emberViewsSystemJquery, _emberTestingTest, _emberRuntimeExtRsvp) {
459
535
 
460
- 'use strict';
536
+ /**
537
+ @module ember
538
+ @submodule ember-testing
539
+ */
461
540
 
462
- var helper = Test['default'].registerHelper;
463
- var asyncHelper = Test['default'].registerAsyncHelper;
541
+ var helper = _emberTestingTest.default.registerHelper;
542
+ var asyncHelper = _emberTestingTest.default.registerAsyncHelper;
464
543
 
465
544
  function currentRouteName(app) {
466
545
  var appController = app.__container__.lookup("controller:application");
467
546
 
468
- return property_get.get(appController, "currentRouteName");
547
+ return (0, _emberMetalProperty_get.get)(appController, "currentRouteName");
469
548
  }
470
549
 
471
550
  function currentPath(app) {
472
551
  var appController = app.__container__.lookup("controller:application");
473
552
 
474
- return property_get.get(appController, "currentPath");
553
+ return (0, _emberMetalProperty_get.get)(appController, "currentPath");
475
554
  }
476
555
 
477
556
  function currentURL(app) {
478
557
  var router = app.__container__.lookup("router:main");
479
558
 
480
- return property_get.get(router, "location").getURL();
559
+ return (0, _emberMetalProperty_get.get)(router, "location").getURL();
481
560
  }
482
561
 
483
562
  function pauseTest() {
484
- Test['default'].adapter.asyncStart();
485
- return new Ember['default'].RSVP.Promise(function () {}, "TestAdapter paused promise");
563
+ _emberTestingTest.default.adapter.asyncStart();
564
+ return new _emberMetalCore.default.RSVP.Promise(function () {}, "TestAdapter paused promise");
486
565
  }
487
566
 
488
567
  function focus(el) {
489
568
  if (el && el.is(":input, [contenteditable=true]")) {
490
569
  var type = el.prop("type");
491
570
  if (type !== "checkbox" && type !== "radio" && type !== "hidden") {
492
- run['default'](el, function () {
571
+ (0, _emberMetalRun_loop.default)(el, function () {
493
572
  // Firefox does not trigger the `focusin` event if the window
494
573
  // does not have focus. If the document doesn't have focus just
495
574
  // use trigger('focusin') instead.
@@ -511,10 +590,10 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
511
590
 
512
591
  if (app._readinessDeferrals > 0) {
513
592
  router["initialURL"] = url;
514
- run['default'](app, "advanceReadiness");
593
+ (0, _emberMetalRun_loop.default)(app, "advanceReadiness");
515
594
  delete router["initialURL"];
516
595
  } else {
517
- run['default'](app.__deprecatedInstance__, "handleURL", url);
596
+ (0, _emberMetalRun_loop.default)(app.__deprecatedInstance__, "handleURL", url);
518
597
  }
519
598
 
520
599
  return app.testHelpers.wait();
@@ -522,12 +601,12 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
522
601
 
523
602
  function click(app, selector, context) {
524
603
  var $el = app.testHelpers.findWithAssert(selector, context);
525
- run['default']($el, "mousedown");
604
+ (0, _emberMetalRun_loop.default)($el, "mousedown");
526
605
 
527
606
  focus($el);
528
607
 
529
- run['default']($el, "mouseup");
530
- run['default']($el, "click");
608
+ (0, _emberMetalRun_loop.default)($el, "mouseup");
609
+ (0, _emberMetalRun_loop.default)($el, "click");
531
610
 
532
611
  return app.testHelpers.wait();
533
612
  }
@@ -536,7 +615,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
536
615
  var $el = app.testHelpers.findWithAssert(selector, context);
537
616
  var type = $el.prop("type");
538
617
 
539
- Ember['default'].assert("To check '" + selector + "', the input must be a checkbox", type === "checkbox");
618
+ _emberMetalCore.default.assert("To check '" + selector + "', the input must be a checkbox", type === "checkbox");
540
619
 
541
620
  if (!$el.prop("checked")) {
542
621
  app.testHelpers.click(selector, context);
@@ -549,7 +628,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
549
628
  var $el = app.testHelpers.findWithAssert(selector, context);
550
629
  var type = $el.prop("type");
551
630
 
552
- Ember['default'].assert("To uncheck '" + selector + "', the input must be a checkbox", type === "checkbox");
631
+ _emberMetalCore.default.assert("To uncheck '" + selector + "', the input must be a checkbox", type === "checkbox");
553
632
 
554
633
  if ($el.prop("checked")) {
555
634
  app.testHelpers.click(selector, context);
@@ -591,9 +670,9 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
591
670
 
592
671
  var $el = app.testHelpers.findWithAssert(selector, context);
593
672
 
594
- var event = jQuery['default'].Event(type, options);
673
+ var event = _emberViewsSystemJquery.default.Event(type, options);
595
674
 
596
- run['default']($el, "trigger", event);
675
+ (0, _emberMetalRun_loop.default)($el, "trigger", event);
597
676
 
598
677
  return app.testHelpers.wait();
599
678
  }
@@ -622,7 +701,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
622
701
  }
623
702
  $el = app.testHelpers.findWithAssert(selector, context);
624
703
  focus($el);
625
- run['default'](function () {
704
+ (0, _emberMetalRun_loop.default)(function () {
626
705
  $el.val(text).change();
627
706
  });
628
707
  return app.testHelpers.wait();
@@ -631,14 +710,14 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
631
710
  function findWithAssert(app, selector, context) {
632
711
  var $el = app.testHelpers.find(selector, context);
633
712
  if ($el.length === 0) {
634
- throw new EmberError['default']("Element " + selector + " not found.");
713
+ throw new _emberMetalError.default("Element " + selector + " not found.");
635
714
  }
636
715
  return $el;
637
716
  }
638
717
 
639
718
  function find(app, selector, context) {
640
719
  var $el;
641
- context = context || property_get.get(app, "rootElement");
720
+ context = context || (0, _emberMetalProperty_get.get)(app, "rootElement");
642
721
  $el = app.$(selector, context);
643
722
 
644
723
  return $el;
@@ -649,7 +728,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
649
728
  }
650
729
 
651
730
  function wait(app, value) {
652
- return new RSVP['default'].Promise(function (resolve) {
731
+ return new _emberRuntimeExtRsvp.default.Promise(function (resolve) {
653
732
  // Every 10ms, poll for the async thing to have finished
654
733
  var watcher = setInterval(function () {
655
734
  var router = app.__container__.lookup("router:main");
@@ -661,15 +740,15 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
661
740
  }
662
741
 
663
742
  // 2. If there are pending Ajax requests, keep polling
664
- if (Test['default'].pendingAjaxRequests) {
743
+ if (_emberTestingTest.default.pendingAjaxRequests) {
665
744
  return;
666
745
  }
667
746
 
668
747
  // 3. If there are scheduled timers or we are inside of a run loop, keep polling
669
- if (run['default'].hasScheduledTimers() || run['default'].currentRunLoop) {
748
+ if (_emberMetalRun_loop.default.hasScheduledTimers() || _emberMetalRun_loop.default.currentRunLoop) {
670
749
  return;
671
750
  }
672
- if (Test['default'].waiters && Test['default'].waiters.any(function (waiter) {
751
+ if (_emberTestingTest.default.waiters && _emberTestingTest.default.waiters.any(function (waiter) {
673
752
  var context = waiter[0];
674
753
  var callback = waiter[1];
675
754
  return !callback.call(context);
@@ -680,237 +759,281 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
680
759
  clearInterval(watcher);
681
760
 
682
761
  // Synchronously resolve the promise
683
- run['default'](null, resolve, value);
762
+ (0, _emberMetalRun_loop.default)(null, resolve, value);
684
763
  }, 10);
685
764
  });
686
765
  }
687
766
 
688
767
  /**
689
- * Loads a route, sets up any controllers, and renders any templates associated
690
- * with the route as though a real user had triggered the route change while
691
- * using your app.
692
- *
693
- * Example:
694
- *
695
- * ```javascript
696
- * visit('posts/index').then(function() {
697
- * // assert something
698
- * });
699
- * ```
700
- *
701
- * @method visit
702
- * @param {String} url the name of the route
703
- * @return {RSVP.Promise}
768
+ Loads a route, sets up any controllers, and renders any templates associated
769
+ with the route as though a real user had triggered the route change while
770
+ using your app.
771
+
772
+ Example:
773
+
774
+ ```javascript
775
+ visit('posts/index').then(function() {
776
+ // assert something
777
+ });
778
+ ```
779
+
780
+ @method visit
781
+ @param {String} url the name of the route
782
+ @return {RSVP.Promise}
783
+ @public
704
784
  */
705
785
  asyncHelper("visit", visit);
706
786
 
707
787
  /**
708
- * Clicks an element and triggers any actions triggered by the element's `click`
709
- * event.
710
- *
711
- * Example:
712
- *
713
- * ```javascript
714
- * click('.some-jQuery-selector').then(function() {
715
- * // assert something
716
- * });
717
- * ```
718
- *
719
- * @method click
720
- * @param {String} selector jQuery selector for finding element on the DOM
721
- * @return {RSVP.Promise}
788
+ Clicks an element and triggers any actions triggered by the element's `click`
789
+ event.
790
+
791
+ Example:
792
+
793
+ ```javascript
794
+ click('.some-jQuery-selector').then(function() {
795
+ // assert something
796
+ });
797
+ ```
798
+
799
+ @method click
800
+ @param {String} selector jQuery selector for finding element on the DOM
801
+ @return {RSVP.Promise}
802
+ @public
722
803
  */
723
804
  asyncHelper("click", click);
724
805
 
806
+ if (_emberMetalCore.default.FEATURES.isEnabled("ember-testing-checkbox-helpers")) {
725
807
  /**
726
- * Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
727
- *
728
- * Example:
729
- *
730
- * ```javascript
731
- * keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
732
- * // assert something
733
- * });
734
- * ```
735
- *
736
- * @method keyEvent
737
- * @param {String} selector jQuery selector for finding element on the DOM
738
- * @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
739
- * @param {Number} keyCode the keyCode of the simulated key event
740
- * @return {RSVP.Promise}
741
- * @since 1.5.0
808
+ Checks a checkbox. Ensures the presence of the `checked` attribute
809
+ Example:
810
+ ```javascript
811
+ check('#remember-me').then(function() {
812
+ // assert something
813
+ });
814
+ ```
815
+ @method check
816
+ @param {String} selector jQuery selector finding an `input[type="checkbox"]`
817
+ element on the DOM to check
818
+ @return {RSVP.Promise}
819
+ @private
820
+ */
821
+ asyncHelper("check", check);
822
+
823
+ /**
824
+ Unchecks a checkbox. Ensures the absence of the `checked` attribute
825
+ Example:
826
+ ```javascript
827
+ uncheck('#remember-me').then(function() {
828
+ // assert something
829
+ });
830
+ ```
831
+ @method check
832
+ @param {String} selector jQuery selector finding an `input[type="checkbox"]`
833
+ element on the DOM to uncheck
834
+ @return {RSVP.Promise}
835
+ @private
836
+ */
837
+ asyncHelper("uncheck", uncheck);
838
+ }
839
+ /**
840
+ Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
841
+
842
+ Example:
843
+
844
+ ```javascript
845
+ keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
846
+ // assert something
847
+ });
848
+ ```
849
+
850
+ @method keyEvent
851
+ @param {String} selector jQuery selector for finding element on the DOM
852
+ @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
853
+ @param {Number} keyCode the keyCode of the simulated key event
854
+ @return {RSVP.Promise}
855
+ @since 1.5.0
856
+ @public
742
857
  */
743
858
  asyncHelper("keyEvent", keyEvent);
744
859
 
745
860
  /**
746
- * Fills in an input element with some text.
747
- *
748
- * Example:
749
- *
750
- * ```javascript
751
- * fillIn('#email', 'you@example.com').then(function() {
752
- * // assert something
753
- * });
754
- * ```
755
- *
756
- * @method fillIn
757
- * @param {String} selector jQuery selector finding an input element on the DOM
758
- * to fill text with
759
- * @param {String} text text to place inside the input element
760
- * @return {RSVP.Promise}
861
+ Fills in an input element with some text.
862
+
863
+ Example:
864
+
865
+ ```javascript
866
+ fillIn('#email', 'you@example.com').then(function() {
867
+ // assert something
868
+ });
869
+ ```
870
+
871
+ @method fillIn
872
+ @param {String} selector jQuery selector finding an input element on the DOM
873
+ to fill text with
874
+ @param {String} text text to place inside the input element
875
+ @return {RSVP.Promise}
876
+ @public
761
877
  */
762
878
  asyncHelper("fillIn", fillIn);
763
879
 
764
880
  /**
765
- * Finds an element in the context of the app's container element. A simple alias
766
- * for `app.$(selector)`.
767
- *
768
- * Example:
769
- *
770
- * ```javascript
771
- * var $el = find('.my-selector');
772
- * ```
773
- *
774
- * @method find
775
- * @param {String} selector jQuery string selector for element lookup
776
- * @return {Object} jQuery object representing the results of the query
881
+ Finds an element in the context of the app's container element. A simple alias
882
+ for `app.$(selector)`.
883
+
884
+ Example:
885
+
886
+ ```javascript
887
+ var $el = find('.my-selector');
888
+ ```
889
+
890
+ @method find
891
+ @param {String} selector jQuery string selector for element lookup
892
+ @return {Object} jQuery object representing the results of the query
893
+ @public
777
894
  */
778
895
  helper("find", find);
779
896
 
780
897
  /**
781
- * Like `find`, but throws an error if the element selector returns no results.
782
- *
783
- * Example:
784
- *
785
- * ```javascript
786
- * var $el = findWithAssert('.doesnt-exist'); // throws error
787
- * ```
788
- *
789
- * @method findWithAssert
790
- * @param {String} selector jQuery selector string for finding an element within
791
- * the DOM
792
- * @return {Object} jQuery object representing the results of the query
793
- * @throws {Error} throws error if jQuery object returned has a length of 0
898
+ Like `find`, but throws an error if the element selector returns no results.
899
+
900
+ Example:
901
+
902
+ ```javascript
903
+ var $el = findWithAssert('.doesnt-exist'); // throws error
904
+ ```
905
+
906
+ @method findWithAssert
907
+ @param {String} selector jQuery selector string for finding an element within
908
+ the DOM
909
+ @return {Object} jQuery object representing the results of the query
910
+ @throws {Error} throws error if jQuery object returned has a length of 0
911
+ @private
794
912
  */
795
913
  helper("findWithAssert", findWithAssert);
796
914
 
797
915
  /**
798
916
  Causes the run loop to process any pending events. This is used to ensure that
799
917
  any async operations from other helpers (or your assertions) have been processed.
800
-
918
+
801
919
  This is most often used as the return value for the helper functions (see 'click',
802
920
  'fillIn','visit',etc).
803
-
921
+
804
922
  Example:
805
-
923
+
806
924
  ```javascript
807
925
  Ember.Test.registerAsyncHelper('loginUser', function(app, username, password) {
808
926
  visit('secured/path/here')
809
927
  .fillIn('#username', username)
810
928
  .fillIn('#password', password)
811
929
  .click('.submit')
812
-
930
+
813
931
  return app.testHelpers.wait();
814
932
  });
815
-
933
+
816
934
  @method wait
817
935
  @param {Object} value The value to be returned.
818
936
  @return {RSVP.Promise}
937
+ @public
819
938
  */
820
939
  asyncHelper("wait", wait);
821
940
  asyncHelper("andThen", andThen);
822
941
 
823
942
  /**
824
943
  Returns the currently active route name.
825
-
944
+
826
945
  Example:
827
-
946
+
828
947
  ```javascript
829
948
  function validateRouteName() {
830
949
  equal(currentRouteName(), 'some.path', "correct route was transitioned into.");
831
950
  }
832
-
951
+
833
952
  visit('/some/path').then(validateRouteName)
834
953
  ```
835
-
954
+
836
955
  @method currentRouteName
837
956
  @return {Object} The name of the currently active route.
838
957
  @since 1.5.0
958
+ @public
839
959
  */
840
960
  helper("currentRouteName", currentRouteName);
841
961
 
842
962
  /**
843
963
  Returns the current path.
844
-
964
+
845
965
  Example:
846
-
966
+
847
967
  ```javascript
848
968
  function validateURL() {
849
969
  equal(currentPath(), 'some.path.index', "correct path was transitioned into.");
850
970
  }
851
-
971
+
852
972
  click('#some-link-id').then(validateURL);
853
973
  ```
854
-
974
+
855
975
  @method currentPath
856
976
  @return {Object} The currently active path.
857
977
  @since 1.5.0
978
+ @public
858
979
  */
859
980
  helper("currentPath", currentPath);
860
981
 
861
982
  /**
862
983
  Returns the current URL.
863
-
984
+
864
985
  Example:
865
-
986
+
866
987
  ```javascript
867
988
  function validateURL() {
868
989
  equal(currentURL(), '/some/path', "correct URL was transitioned into.");
869
990
  }
870
-
991
+
871
992
  click('#some-link-id').then(validateURL);
872
993
  ```
873
-
994
+
874
995
  @method currentURL
875
996
  @return {Object} The currently active URL.
876
997
  @since 1.5.0
998
+ @public
877
999
  */
878
1000
  helper("currentURL", currentURL);
879
1001
 
880
1002
  /**
881
1003
  Pauses the current test - this is useful for debugging while testing or for test-driving.
882
1004
  It allows you to inspect the state of your application at any point.
883
-
1005
+
884
1006
  Example (The test will pause before clicking the button):
885
-
1007
+
886
1008
  ```javascript
887
1009
  visit('/')
888
1010
  return pauseTest();
889
-
1011
+
890
1012
  click('.btn');
891
1013
  ```
892
-
1014
+
893
1015
  @since 1.9.0
894
1016
  @method pauseTest
895
1017
  @return {Object} A promise that will never resolve
896
- */
1018
+ @public
1019
+ */
897
1020
  helper("pauseTest", pauseTest);
898
1021
 
899
1022
  /**
900
1023
  Triggers the given DOM event on the element identified by the provided selector.
901
-
1024
+
902
1025
  Example:
903
-
1026
+
904
1027
  ```javascript
905
1028
  triggerEvent('#some-elem-id', 'blur');
906
1029
  ```
907
-
1030
+
908
1031
  This is actually used internally by the `keyEvent` helper like so:
909
-
1032
+
910
1033
  ```javascript
911
1034
  triggerEvent('#some-elem-id', 'keypress', { keyCode: 13 });
912
1035
  ```
913
-
1036
+
914
1037
  @method triggerEvent
915
1038
  @param {String} selector jQuery selector for finding element on the DOM
916
1039
  @param {String} [context] jQuery selector that will limit the selector
@@ -919,17 +1042,15 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
919
1042
  @param {Object} [options] The options to be passed to jQuery.Event.
920
1043
  @return {RSVP.Promise}
921
1044
  @since 1.5.0
1045
+ @public
922
1046
  */
923
1047
  asyncHelper("triggerEvent", triggerEvent);
924
-
925
1048
  });
926
- enifed('ember-testing/initializers', ['ember-runtime/system/lazy_load'], function (lazy_load) {
927
-
928
- 'use strict';
1049
+ enifed('ember-testing/initializers', ['exports', 'ember-runtime/system/lazy_load'], function (exports, _emberRuntimeSystemLazy_load) {
929
1050
 
930
1051
  var name = 'deferReadiness in `testing` mode';
931
1052
 
932
- lazy_load.onLoad('Ember.Application', function (Application) {
1053
+ (0, _emberRuntimeSystemLazy_load.onLoad)('Ember.Application', function (Application) {
933
1054
  if (!Application.initializers[name]) {
934
1055
  Application.initializer({
935
1056
  name: name,
@@ -942,14 +1063,10 @@ enifed('ember-testing/initializers', ['ember-runtime/system/lazy_load'], functio
942
1063
  });
943
1064
  }
944
1065
  });
945
-
946
1066
  });
947
- enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/core', 'ember-testing/adapters/qunit', 'ember-views/system/jquery'], function (exports, Ember, QUnitAdapter, jQuery) {
948
-
949
- 'use strict';
1067
+ enifed("ember-testing/setup_for_testing", ["exports", "ember-metal/core", "ember-testing/adapters/qunit", "ember-views/system/jquery"], function (exports, _emberMetalCore, _emberTestingAdaptersQunit, _emberViewsSystemJquery) {
1068
+ exports.default = setupForTesting;
950
1069
 
951
-
952
- exports['default'] = setupForTesting;
953
1070
  var Test, requests;
954
1071
 
955
1072
  function incrementAjaxPendingRequests(_, xhr) {
@@ -969,47 +1086,53 @@ enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/core', 'ember
969
1086
  /**
970
1087
  Sets Ember up for testing. This is useful to perform
971
1088
  basic setup steps in order to unit test.
972
-
1089
+
973
1090
  Use `App.setupForTesting` to perform integration tests (full
974
1091
  application testing).
975
-
1092
+
976
1093
  @method setupForTesting
977
1094
  @namespace Ember
978
1095
  @since 1.5.0
1096
+ @private
979
1097
  */
1098
+
980
1099
  function setupForTesting() {
981
1100
  if (!Test) {
982
1101
  Test = requireModule("ember-testing/test")["default"];
983
1102
  }
984
1103
 
985
- Ember['default'].testing = true;
1104
+ _emberMetalCore.default.testing = true;
986
1105
 
987
1106
  // if adapter is not manually set default to QUnit
988
1107
  if (!Test.adapter) {
989
- Test.adapter = QUnitAdapter['default'].create();
1108
+ Test.adapter = _emberTestingAdaptersQunit.default.create();
990
1109
  }
991
1110
 
992
1111
  requests = [];
993
1112
  Test.pendingAjaxRequests = requests.length;
994
1113
 
995
- jQuery['default'](document).off("ajaxSend", incrementAjaxPendingRequests);
996
- jQuery['default'](document).off("ajaxComplete", decrementAjaxPendingRequests);
997
- jQuery['default'](document).on("ajaxSend", incrementAjaxPendingRequests);
998
- jQuery['default'](document).on("ajaxComplete", decrementAjaxPendingRequests);
1114
+ (0, _emberViewsSystemJquery.default)(document).off("ajaxSend", incrementAjaxPendingRequests);
1115
+ (0, _emberViewsSystemJquery.default)(document).off("ajaxComplete", decrementAjaxPendingRequests);
1116
+ (0, _emberViewsSystemJquery.default)(document).on("ajaxSend", incrementAjaxPendingRequests);
1117
+ (0, _emberViewsSystemJquery.default)(document).on("ajaxComplete", decrementAjaxPendingRequests);
999
1118
  }
1000
-
1001
1119
  });
1002
- enifed('ember-testing/support', ['ember-metal/core', 'ember-views/system/jquery', 'ember-metal/environment'], function (Ember, jQuery, environment) {
1003
1120
 
1004
- 'use strict';
1121
+ // import Test from "ember-testing/test"; // ES6TODO: fix when cycles are supported
1122
+ enifed("ember-testing/support", ["exports", "ember-metal/core", "ember-views/system/jquery", "ember-metal/environment"], function (exports, _emberMetalCore, _emberViewsSystemJquery, _emberMetalEnvironment) {
1123
+
1124
+ /**
1125
+ @module ember
1126
+ @submodule ember-testing
1127
+ */
1005
1128
 
1006
- var $ = jQuery['default'];
1129
+ var $ = _emberViewsSystemJquery.default;
1007
1130
 
1008
1131
  /**
1009
1132
  This method creates a checkbox and triggers the click event to fire the
1010
1133
  passed in handler. It is used to correct for a bug in older versions
1011
1134
  of jQuery (e.g 1.8.3).
1012
-
1135
+
1013
1136
  @private
1014
1137
  @method testCheckboxClick
1015
1138
  */
@@ -1017,7 +1140,7 @@ enifed('ember-testing/support', ['ember-metal/core', 'ember-views/system/jquery'
1017
1140
  $("<input type=\"checkbox\">").css({ position: "absolute", left: "-1000px", top: "-1000px" }).appendTo("body").on("click", handler).trigger("click").remove();
1018
1141
  }
1019
1142
 
1020
- if (environment['default'].hasDOM) {
1143
+ if (_emberMetalEnvironment.default.hasDOM) {
1021
1144
  $(function () {
1022
1145
  /*
1023
1146
  Determine whether a checkbox checked using jQuery's "click" method will have
@@ -1042,29 +1165,31 @@ enifed('ember-testing/support', ['ember-metal/core', 'ember-views/system/jquery'
1042
1165
 
1043
1166
  // Try again to verify that the patch took effect or blow up.
1044
1167
  testCheckboxClick(function () {
1045
- Ember['default'].warn("clicked checkboxes should be checked! the jQuery patch didn't work", this.checked);
1168
+ _emberMetalCore.default.warn("clicked checkboxes should be checked! the jQuery patch didn't work", this.checked);
1046
1169
  });
1047
1170
  });
1048
1171
  }
1049
-
1050
1172
  });
1051
- enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-metal/platform/create', 'ember-runtime/ext/rsvp', 'ember-testing/setup_for_testing', 'ember-application/system/application'], function (exports, Ember, emberRun, create, RSVP, setupForTesting, EmberApplication) {
1052
-
1053
- 'use strict';
1173
+ enifed("ember-testing/test", ["exports", "ember-metal/core", "ember-metal/run_loop", "ember-metal/platform/create", "ember-runtime/ext/rsvp", "ember-testing/setup_for_testing", "ember-application/system/application"], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberMetalPlatformCreate, _emberRuntimeExtRsvp, _emberTestingSetup_for_testing, _emberApplicationSystemApplication) {
1054
1174
 
1175
+ /**
1176
+ @module ember
1177
+ @submodule ember-testing
1178
+ */
1055
1179
  var helpers = {};
1056
1180
  var injectHelpersCallbacks = [];
1057
1181
 
1058
1182
  /**
1059
1183
  This is a container for an assortment of testing related functionality:
1060
-
1184
+
1061
1185
  * Choose your default test adapter (for your framework of choice).
1062
1186
  * Register/Unregister additional test helpers.
1063
1187
  * Setup callbacks to be fired when the test helpers are injected into
1064
1188
  your application.
1065
-
1189
+
1066
1190
  @class Test
1067
1191
  @namespace Ember
1192
+ @public
1068
1193
  */
1069
1194
  var Test = {
1070
1195
  /**
@@ -1256,7 +1381,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1256
1381
  context = null;
1257
1382
  }
1258
1383
  if (!this.waiters) {
1259
- this.waiters = Ember['default'].A();
1384
+ this.waiters = _emberMetalCore.default.A();
1260
1385
  }
1261
1386
  this.waiters.push([context, callback]);
1262
1387
  },
@@ -1277,7 +1402,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1277
1402
  callback = context;
1278
1403
  context = null;
1279
1404
  }
1280
- this.waiters = Ember['default'].A(this.waiters.filter(function (elt) {
1405
+ this.waiters = _emberMetalCore.default.A(this.waiters.filter(function (elt) {
1281
1406
  return !(elt[0] === context && elt[1] === callback);
1282
1407
  }));
1283
1408
  }
@@ -1314,21 +1439,21 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1314
1439
  Test.adapter.asyncStart();
1315
1440
  return lastPromise.then(function () {
1316
1441
  return fn.apply(app, args);
1317
- })["finally"](function () {
1442
+ }).finally(function () {
1318
1443
  Test.adapter.asyncEnd();
1319
1444
  });
1320
1445
  };
1321
1446
  }
1322
1447
 
1323
1448
  function run(fn) {
1324
- if (!emberRun['default'].currentRunLoop) {
1325
- return emberRun['default'](fn);
1449
+ if (!_emberMetalRun_loop.default.currentRunLoop) {
1450
+ return (0, _emberMetalRun_loop.default)(fn);
1326
1451
  } else {
1327
1452
  return fn();
1328
1453
  }
1329
1454
  }
1330
1455
 
1331
- EmberApplication['default'].reopen({
1456
+ _emberApplicationSystemApplication.default.reopen({
1332
1457
  /**
1333
1458
  This property contains the testing helpers for the current application. These
1334
1459
  are created once you call `injectTestHelpers` on your `Ember.Application`
@@ -1337,6 +1462,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1337
1462
  @property testHelpers
1338
1463
  @type {Object}
1339
1464
  @default {}
1465
+ @public
1340
1466
  */
1341
1467
  testHelpers: {},
1342
1468
 
@@ -1361,23 +1487,25 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1361
1487
  @type {Boolean}
1362
1488
  @default false
1363
1489
  @since 1.3.0
1490
+ @public
1364
1491
  */
1365
1492
  testing: false,
1366
1493
 
1367
1494
  /**
1368
- This hook defers the readiness of the application, so that you can start
1369
- the app when your tests are ready to run. It also sets the router's
1370
- location to 'none', so that the window's location will not be modified
1371
- (preventing both accidental leaking of state between tests and interference
1372
- with your testing framework).
1373
- Example:
1374
- ```
1375
- App.setupForTesting();
1376
- ```
1495
+ This hook defers the readiness of the application, so that you can start
1496
+ the app when your tests are ready to run. It also sets the router's
1497
+ location to 'none', so that the window's location will not be modified
1498
+ (preventing both accidental leaking of state between tests and interference
1499
+ with your testing framework).
1500
+ Example:
1501
+ ```
1502
+ App.setupForTesting();
1503
+ ```
1377
1504
  @method setupForTesting
1505
+ @public
1378
1506
  */
1379
1507
  setupForTesting: function () {
1380
- setupForTesting['default']();
1508
+ (0, _emberTestingSetup_for_testing.default)();
1381
1509
 
1382
1510
  this.testing = true;
1383
1511
 
@@ -1393,6 +1521,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1393
1521
  @type {Object} The object to be used for test helpers.
1394
1522
  @default window
1395
1523
  @since 1.2.0
1524
+ @private
1396
1525
  */
1397
1526
  helperContainer: null,
1398
1527
 
@@ -1402,13 +1531,14 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1402
1531
  to `window`. If a function of the same name has already been defined it will be cached
1403
1532
  (so that it can be reset if the helper is removed with `unregisterHelper` or
1404
1533
  `removeTestHelpers`).
1405
- Any callbacks registered with `onInjectHelpers` will be called once the
1406
- helpers have been injected.
1407
- Example:
1408
- ```
1409
- App.injectTestHelpers();
1410
- ```
1534
+ Any callbacks registered with `onInjectHelpers` will be called once the
1535
+ helpers have been injected.
1536
+ Example:
1537
+ ```
1538
+ App.injectTestHelpers();
1539
+ ```
1411
1540
  @method injectTestHelpers
1541
+ @public
1412
1542
  */
1413
1543
  injectTestHelpers: function (helperContainer) {
1414
1544
  if (helperContainer) {
@@ -1472,17 +1602,17 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1472
1602
  }
1473
1603
 
1474
1604
  Test.Promise = function () {
1475
- RSVP['default'].Promise.apply(this, arguments);
1605
+ _emberRuntimeExtRsvp.default.Promise.apply(this, arguments);
1476
1606
  Test.lastPromise = this;
1477
1607
  };
1478
1608
 
1479
- Test.Promise.prototype = create['default'](RSVP['default'].Promise.prototype);
1609
+ Test.Promise.prototype = (0, _emberMetalPlatformCreate.default)(_emberRuntimeExtRsvp.default.Promise.prototype);
1480
1610
  Test.Promise.prototype.constructor = Test.Promise;
1481
1611
  Test.Promise.resolve = Test.resolve;
1482
1612
 
1483
1613
  // Patch `then` to isolate async methods
1484
1614
  // specifically `Ember.Test.lastPromise`
1485
- var originalThen = RSVP['default'].Promise.prototype.then;
1615
+ var originalThen = _emberRuntimeExtRsvp.default.Promise.prototype.then;
1486
1616
  Test.Promise.prototype.then = function (onSuccess, onFailure) {
1487
1617
  return originalThen.call(this, function (val) {
1488
1618
  return isolate(onSuccess, val);
@@ -1520,8 +1650,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
1520
1650
  }
1521
1651
  }
1522
1652
 
1523
- exports['default'] = Test;
1524
-
1653
+ exports.default = Test;
1525
1654
  });
1526
1655
  requireModule("ember-testing");
1527
1656