ember-source 2.9.1.1 → 2.10.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 2.9.1
9
+ * @version 2.10.0-beta.1
10
10
  */
11
11
 
12
12
  var enifed, requireModule, require, Ember;
@@ -112,12 +112,85 @@ var mainContext = this;
112
112
  }
113
113
  })();
114
114
 
115
- enifed('ember-debug/deprecate', ['exports', 'ember-metal/error', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _emberMetalError, _emberConsole, _emberEnvironment, _emberDebugHandlers) {
115
+ var babelHelpers;
116
+
117
+ function classCallCheck(instance, Constructor) {
118
+ if (!(instance instanceof Constructor)) {
119
+ throw new TypeError('Cannot call a class as a function');
120
+ }
121
+ }
122
+
123
+ function inherits(subClass, superClass) {
124
+ if (typeof superClass !== 'function' && superClass !== null) {
125
+ throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
126
+ }
127
+
128
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
129
+ constructor: {
130
+ value: subClass,
131
+ enumerable: false,
132
+ writable: true,
133
+ configurable: true
134
+ }
135
+ });
136
+
137
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : defaults(subClass, superClass);
138
+ }
139
+
140
+ function taggedTemplateLiteralLoose(strings, raw) {
141
+ strings.raw = raw;
142
+ return strings;
143
+ }
144
+
145
+ function defineProperties(target, props) {
146
+ for (var i = 0; i < props.length; i++) {
147
+ var descriptor = props[i];
148
+ descriptor.enumerable = descriptor.enumerable || false;
149
+ descriptor.configurable = true;
150
+ if ('value' in descriptor) descriptor.writable = true;
151
+ Object.defineProperty(target, descriptor.key, descriptor);
152
+ }
153
+ }
154
+
155
+ function createClass(Constructor, protoProps, staticProps) {
156
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
157
+ if (staticProps) defineProperties(Constructor, staticProps);
158
+ return Constructor;
159
+ }
160
+
161
+ function interopExportWildcard(obj, defaults) {
162
+ var newObj = defaults({}, obj);
163
+ delete newObj['default'];
164
+ return newObj;
165
+ }
166
+
167
+ function defaults(obj, defaults) {
168
+ var keys = Object.getOwnPropertyNames(defaults);
169
+ for (var i = 0; i < keys.length; i++) {
170
+ var key = keys[i];
171
+ var value = Object.getOwnPropertyDescriptor(defaults, key);
172
+ if (value && value.configurable && obj[key] === undefined) {
173
+ Object.defineProperty(obj, key, value);
174
+ }
175
+ }
176
+ return obj;
177
+ }
178
+
179
+ babelHelpers = {
180
+ classCallCheck: classCallCheck,
181
+ inherits: inherits,
182
+ taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,
183
+ slice: Array.prototype.slice,
184
+ createClass: createClass,
185
+ interopExportWildcard: interopExportWildcard,
186
+ defaults: defaults
187
+ };
188
+
189
+ enifed('ember-debug/deprecate', ['exports', 'ember-metal', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _emberMetal, _emberConsole, _emberEnvironment, _emberDebugHandlers) {
116
190
  /*global __fail__*/
117
191
 
118
192
  'use strict';
119
193
 
120
- var _slice = Array.prototype.slice;
121
194
  exports.registerHandler = registerHandler;
122
195
  exports.default = deprecate;
123
196
 
@@ -192,7 +265,7 @@ enifed('ember-debug/deprecate', ['exports', 'ember-metal/error', 'ember-console'
192
265
  if (_emberEnvironment.ENV.RAISE_ON_DEPRECATION) {
193
266
  var updatedMessage = formatMessage(message);
194
267
 
195
- throw new _emberMetalError.default(updatedMessage);
268
+ throw new _emberMetal.Error(updatedMessage);
196
269
  } else {
197
270
  next.apply(undefined, arguments);
198
271
  }
@@ -258,7 +331,7 @@ enifed('ember-debug/deprecate', ['exports', 'ember-metal/error', 'ember-console'
258
331
  });
259
332
  }
260
333
 
261
- _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(_slice.call(arguments)));
334
+ _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(babelHelpers.slice.call(arguments)));
262
335
  }
263
336
  });
264
337
  enifed("ember-debug/handlers", ["exports"], function (exports) {
@@ -294,7 +367,7 @@ enifed("ember-debug/handlers", ["exports"], function (exports) {
294
367
  }
295
368
  }
296
369
  });
297
- 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) {
370
+ enifed('ember-debug/index', ['exports', 'ember-metal', 'ember-environment', 'ember-console', 'ember-debug/deprecate', 'ember-debug/warn'], function (exports, _emberMetal, _emberEnvironment, _emberConsole, _emberDebugDeprecate, _emberDebugWarn) {
298
371
  'use strict';
299
372
 
300
373
  exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
@@ -330,9 +403,9 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
330
403
  falsy, an exception will be thrown.
331
404
  @public
332
405
  */
333
- _emberMetalDebug.setDebugFunction('assert', function assert(desc, test) {
406
+ _emberMetal.setDebugFunction('assert', function assert(desc, test) {
334
407
  if (!test) {
335
- throw new _emberMetalError.default('Assertion Failed: ' + desc);
408
+ throw new _emberMetal.Error('Assertion Failed: ' + desc);
336
409
  }
337
410
  });
338
411
 
@@ -350,7 +423,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
350
423
  @param {String} message A debug message to display.
351
424
  @public
352
425
  */
353
- _emberMetalDebug.setDebugFunction('debug', function debug(message) {
426
+ _emberMetal.setDebugFunction('debug', function debug(message) {
354
427
  _emberConsole.default.debug('DEBUG: ' + message);
355
428
  });
356
429
 
@@ -363,7 +436,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
363
436
  @method info
364
437
  @private
365
438
  */
366
- _emberMetalDebug.setDebugFunction('info', function info() {
439
+ _emberMetal.setDebugFunction('info', function info() {
367
440
  _emberConsole.default.info.apply(undefined, arguments);
368
441
  });
369
442
 
@@ -386,7 +459,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
386
459
  @return {Function} A new function that wraps the original function with a deprecation warning
387
460
  @private
388
461
  */
389
- _emberMetalDebug.setDebugFunction('deprecateFunc', function deprecateFunc() {
462
+ _emberMetal.setDebugFunction('deprecateFunc', function deprecateFunc() {
390
463
  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
391
464
  args[_key] = arguments[_key];
392
465
  }
@@ -399,7 +472,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
399
472
 
400
473
  return {
401
474
  v: function () {
402
- _emberMetalDebug.deprecate(message, false, options);
475
+ _emberMetal.deprecate(message, false, options);
403
476
  return func.apply(this, arguments);
404
477
  }
405
478
  };
@@ -413,7 +486,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
413
486
 
414
487
  return {
415
488
  v: function () {
416
- _emberMetalDebug.deprecate(message);
489
+ _emberMetal.deprecate(message);
417
490
  return func.apply(this, arguments);
418
491
  }
419
492
  };
@@ -444,17 +517,21 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
444
517
  @since 1.5.0
445
518
  @public
446
519
  */
447
- _emberMetalDebug.setDebugFunction('runInDebug', function runInDebug(func) {
520
+ _emberMetal.setDebugFunction('runInDebug', function runInDebug(func) {
448
521
  func();
449
522
  });
450
523
 
451
- _emberMetalDebug.setDebugFunction('debugSeal', function debugSeal(obj) {
524
+ _emberMetal.setDebugFunction('debugSeal', function debugSeal(obj) {
452
525
  Object.seal(obj);
453
526
  });
454
527
 
455
- _emberMetalDebug.setDebugFunction('deprecate', _emberDebugDeprecate.default);
528
+ _emberMetal.setDebugFunction('debugFreeze', function debugFreeze(obj) {
529
+ Object.freeze(obj);
530
+ });
531
+
532
+ _emberMetal.setDebugFunction('deprecate', _emberDebugDeprecate.default);
456
533
 
457
- _emberMetalDebug.setDebugFunction('warn', _emberDebugWarn.default);
534
+ _emberMetal.setDebugFunction('warn', _emberDebugWarn.default);
458
535
 
459
536
  /**
460
537
  Will call `Ember.warn()` if ENABLE_OPTIONAL_FEATURES or
@@ -469,7 +546,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
469
546
 
470
547
  function _warnIfUsingStrippedFeatureFlags(FEATURES, knownFeatures, featuresWereStripped) {
471
548
  if (featuresWereStripped) {
472
- _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' });
549
+ _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' });
473
550
 
474
551
  var keys = Object.keys(FEATURES || {});
475
552
  for (var i = 0; i < keys.length; i++) {
@@ -478,23 +555,23 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
478
555
  continue;
479
556
  }
480
557
 
481
- _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' });
558
+ _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' });
482
559
  }
483
560
  }
484
561
  }
485
562
 
486
- if (!_emberMetalTesting.isTesting()) {
563
+ if (!_emberMetal.isTesting()) {
487
564
  (function () {
488
565
  // Complain if they're using FEATURE flags in builds other than canary
489
- _emberMetalFeatures.FEATURES['features-stripped-test'] = true;
566
+ _emberMetal.FEATURES['features-stripped-test'] = true;
490
567
  var featuresWereStripped = true;
491
568
 
492
569
  if (false) {
493
570
  featuresWereStripped = false;
494
571
  }
495
572
 
496
- delete _emberMetalFeatures.FEATURES['features-stripped-test'];
497
- _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberMetalFeatures.DEFAULT_FEATURES, featuresWereStripped);
573
+ delete _emberMetal.FEATURES['features-stripped-test'];
574
+ _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberMetal.DEFAULT_FEATURES, featuresWereStripped);
498
575
 
499
576
  // Inform the developer about the Ember Inspector if not installed.
500
577
  var isFirefox = _emberEnvironment.environment.isFirefox;
@@ -511,7 +588,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
511
588
  downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
512
589
  }
513
590
 
514
- _emberMetalDebug.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
591
+ _emberMetal.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
515
592
  }
516
593
  }, false);
517
594
  }
@@ -521,7 +598,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
521
598
  @public
522
599
  @class Ember.Debug
523
600
  */
524
- _emberMetalCore.default.Debug = {};
601
+ _emberMetal.default.Debug = {};
525
602
 
526
603
  /**
527
604
  Allows for runtime registration of handler functions that override the default deprecation behavior.
@@ -537,7 +614,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
537
614
  // defer to whatever handler was registered before this one
538
615
  next(message, options);
539
616
  }
540
- }
617
+ });
541
618
  ```
542
619
 
543
620
  The handler function takes the following arguments:
@@ -558,7 +635,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
558
635
  @param handler {Function} A function to handle deprecation calls.
559
636
  @since 2.1.0
560
637
  */
561
- _emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
638
+ _emberMetal.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
562
639
  /**
563
640
  Allows for runtime registration of handler functions that override the default warning behavior.
564
641
  Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn).
@@ -587,7 +664,7 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
587
664
  @param handler {Function} A function to handle warnings.
588
665
  @since 2.1.0
589
666
  */
590
- _emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
667
+ _emberMetal.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
591
668
 
592
669
  /*
593
670
  We are transitioning away from `ember.js` to `ember.debug.js` to make
@@ -600,14 +677,13 @@ enifed('ember-debug/index', ['exports', 'ember-metal/core', 'ember-environment',
600
677
  var runningNonEmberDebugJS = false;
601
678
  exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
602
679
  if (runningNonEmberDebugJS) {
603
- _emberMetalDebug.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
680
+ _emberMetal.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
604
681
  }
605
682
  });
606
683
  // reexports
607
- enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal/debug', 'ember-debug/handlers'], function (exports, _emberConsole, _emberMetalDebug, _emberDebugHandlers) {
684
+ enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal', 'ember-debug/handlers'], function (exports, _emberConsole, _emberMetal, _emberDebugHandlers) {
608
685
  'use strict';
609
686
 
610
- var _slice = Array.prototype.slice;
611
687
  exports.registerHandler = registerHandler;
612
688
  exports.default = warn;
613
689
 
@@ -652,7 +728,7 @@ enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal/debug', 'em
652
728
 
653
729
  function warn(message, test, options) {
654
730
  if (!options) {
655
- _emberMetalDebug.deprecate(missingOptionsDeprecation, false, {
731
+ _emberMetal.deprecate(missingOptionsDeprecation, false, {
656
732
  id: 'ember-debug.warn-options-missing',
657
733
  until: '3.0.0',
658
734
  url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
@@ -660,17 +736,17 @@ enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal/debug', 'em
660
736
  }
661
737
 
662
738
  if (options && !options.id) {
663
- _emberMetalDebug.deprecate(missingOptionsIdDeprecation, false, {
739
+ _emberMetal.deprecate(missingOptionsIdDeprecation, false, {
664
740
  id: 'ember-debug.warn-id-missing',
665
741
  until: '3.0.0',
666
742
  url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
667
743
  });
668
744
  }
669
745
 
670
- _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
746
+ _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(babelHelpers.slice.call(arguments)));
671
747
  }
672
748
  });
673
- enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/object'], function (exports, _emberRuntimeSystemObject) {
749
+ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime'], function (exports, _emberRuntime) {
674
750
  'use strict';
675
751
 
676
752
  function K() {
@@ -690,7 +766,7 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
690
766
  @namespace Ember.Test
691
767
  @public
692
768
  */
693
- exports.default = _emberRuntimeSystemObject.default.extend({
769
+ exports.default = _emberRuntime.Object.extend({
694
770
  /**
695
771
  This callback will be called whenever an async operation is about to start.
696
772
  Override this to call your framework's methods that handle async
@@ -726,7 +802,7 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
726
802
  }
727
803
  });
728
804
  });
729
- enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapter', 'ember-metal/utils'], function (exports, _emberTestingAdaptersAdapter, _emberMetalUtils) {
805
+ enifed('ember-testing/adapters/qunit', ['exports', 'ember-utils', 'ember-testing/adapters/adapter'], function (exports, _emberUtils, _emberTestingAdaptersAdapter) {
730
806
  'use strict';
731
807
 
732
808
  /**
@@ -746,11 +822,11 @@ enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapt
746
822
  QUnit.start();
747
823
  },
748
824
  exception: function (error) {
749
- ok(false, _emberMetalUtils.inspect(error));
825
+ ok(false, _emberUtils.inspect(error));
750
826
  }
751
827
  });
752
828
  });
753
- enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-metal/run_loop'], function (exports, _emberViewsSystemJquery, _emberMetalRun_loop) {
829
+ enifed('ember-testing/events', ['exports', 'ember-views', 'ember-metal'], function (exports, _emberViews, _emberMetal) {
754
830
  'use strict';
755
831
 
756
832
  exports.focus = focus;
@@ -764,11 +840,11 @@ enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-m
764
840
  if (!el) {
765
841
  return;
766
842
  }
767
- var $el = _emberViewsSystemJquery.default(el);
843
+ var $el = _emberViews.jQuery(el);
768
844
  if ($el.is(':input, [contenteditable=true]')) {
769
845
  var type = $el.prop('type');
770
846
  if (type !== 'checkbox' && type !== 'radio' && type !== 'hidden') {
771
- _emberMetalRun_loop.default(null, function () {
847
+ _emberMetal.run(null, function () {
772
848
  // Firefox does not trigger the `focusin` event if the window
773
849
  // does not have focus. If the document doesn't have focus just
774
850
  // use trigger('focusin') instead.
@@ -802,7 +878,7 @@ enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-m
802
878
  clientX: x,
803
879
  clientY: y
804
880
  };
805
- event = buildMouseEvent(type, _emberViewsSystemJquery.default.extend(simulatedCoordinates, options));
881
+ event = buildMouseEvent(type, _emberViews.jQuery.extend(simulatedCoordinates, options));
806
882
  } else {
807
883
  event = buildBasicEvent(type, options);
808
884
  }
@@ -814,7 +890,7 @@ enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-m
814
890
 
815
891
  var event = document.createEvent('Events');
816
892
  event.initEvent(type, true, true);
817
- _emberViewsSystemJquery.default.extend(event, options);
893
+ _emberViews.jQuery.extend(event, options);
818
894
  return event;
819
895
  }
820
896
 
@@ -824,7 +900,7 @@ enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-m
824
900
  var event = undefined;
825
901
  try {
826
902
  event = document.createEvent('MouseEvents');
827
- var eventOpts = _emberViewsSystemJquery.default.extend({}, DEFAULT_EVENT_OPTIONS, options);
903
+ var eventOpts = _emberViews.jQuery.extend({}, DEFAULT_EVENT_OPTIONS, options);
828
904
  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);
829
905
  } catch (e) {
830
906
  event = buildBasicEvent(type, options);
@@ -838,7 +914,7 @@ enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-m
838
914
  var event = undefined;
839
915
  try {
840
916
  event = document.createEvent('KeyEvents');
841
- var eventOpts = _emberViewsSystemJquery.default.extend({}, DEFAULT_EVENT_OPTIONS, options);
917
+ var eventOpts = _emberViews.jQuery.extend({}, DEFAULT_EVENT_OPTIONS, options);
842
918
  event.initKeyEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.keyCode, eventOpts.charCode);
843
919
  } catch (e) {
844
920
  event = buildBasicEvent(type, options);
@@ -846,10 +922,10 @@ enifed('ember-testing/events', ['exports', 'ember-views/system/jquery', 'ember-m
846
922
  return event;
847
923
  }
848
924
  });
849
- 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) {
925
+ 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) {
850
926
  'use strict';
851
927
 
852
- _emberApplicationSystemApplication.default.reopen({
928
+ _emberApplication.Application.reopen({
853
929
  /**
854
930
  This property contains the testing helpers for the current application. These
855
931
  are created once you call `injectTestHelpers` on your `Ember.Application`
@@ -1036,53 +1112,69 @@ enifed('ember-testing/ext/application', ['exports', 'ember-application/system/ap
1036
1112
  };
1037
1113
  }
1038
1114
  });
1039
- 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) {
1115
+ enifed('ember-testing/ext/rsvp', ['exports', 'ember-runtime', 'ember-metal', 'ember-testing/test/adapter'], function (exports, _emberRuntime, _emberMetal, _emberTestingTestAdapter) {
1040
1116
  'use strict';
1041
1117
 
1042
- _emberRuntimeExtRsvp.default.configure('async', function (callback, promise) {
1118
+ _emberRuntime.RSVP.configure('async', function (callback, promise) {
1043
1119
  // if schedule will cause autorun, we need to inform adapter
1044
- if (_emberMetalTesting.isTesting() && !_emberMetalRun_loop.default.backburner.currentInstance) {
1120
+ if (_emberMetal.isTesting() && !_emberMetal.run.backburner.currentInstance) {
1045
1121
  _emberTestingTestAdapter.asyncStart();
1046
- _emberMetalRun_loop.default.backburner.schedule('actions', function () {
1122
+ _emberMetal.run.backburner.schedule('actions', function () {
1047
1123
  _emberTestingTestAdapter.asyncEnd();
1048
1124
  callback(promise);
1049
1125
  });
1050
1126
  } else {
1051
- _emberMetalRun_loop.default.backburner.schedule('actions', function () {
1127
+ _emberMetal.run.backburner.schedule('actions', function () {
1052
1128
  return callback(promise);
1053
1129
  });
1054
1130
  }
1055
1131
  });
1056
1132
 
1057
- exports.default = _emberRuntimeExtRsvp.default;
1133
+ exports.default = _emberRuntime.RSVP;
1058
1134
  });
1059
- 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) {
1135
+ 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) {
1060
1136
  'use strict';
1061
1137
 
1138
+ _emberTestingTestHelpers.registerAsyncHelper('visit', _emberTestingHelpersVisit.default);
1139
+ _emberTestingTestHelpers.registerAsyncHelper('click', _emberTestingHelpersClick.default);
1140
+ _emberTestingTestHelpers.registerAsyncHelper('keyEvent', _emberTestingHelpersKey_event.default);
1141
+ _emberTestingTestHelpers.registerAsyncHelper('fillIn', _emberTestingHelpersFill_in.default);
1142
+ _emberTestingTestHelpers.registerAsyncHelper('wait', _emberTestingHelpersWait.default);
1143
+ _emberTestingTestHelpers.registerAsyncHelper('andThen', _emberTestingHelpersAnd_then.default);
1144
+ _emberTestingTestHelpers.registerAsyncHelper('pauseTest', _emberTestingHelpersPause_test.pauseTest);
1145
+ _emberTestingTestHelpers.registerAsyncHelper('triggerEvent', _emberTestingHelpersTrigger_event.default);
1146
+
1147
+ _emberTestingTestHelpers.registerHelper('find', _emberTestingHelpersFind.default);
1148
+ _emberTestingTestHelpers.registerHelper('findWithAssert', _emberTestingHelpersFind_with_assert.default);
1149
+ _emberTestingTestHelpers.registerHelper('currentRouteName', _emberTestingHelpersCurrent_route_name.default);
1150
+ _emberTestingTestHelpers.registerHelper('currentPath', _emberTestingHelpersCurrent_path.default);
1151
+ _emberTestingTestHelpers.registerHelper('currentURL', _emberTestingHelpersCurrent_url.default);
1152
+
1153
+ if (false) {
1154
+ _emberTestingTestHelpers.registerHelper('resumeTest', _emberTestingHelpersPause_test.resumeTest);
1155
+ }
1156
+ });
1157
+ enifed("ember-testing/helpers/and_then", ["exports"], function (exports) {
1062
1158
  /**
1063
1159
  @module ember
1064
1160
  @submodule ember-testing
1065
1161
  */
1162
+ "use strict";
1066
1163
 
1164
+ exports.default = andThen;
1165
+
1166
+ function andThen(app, callback) {
1167
+ return app.testHelpers.wait(callback(app));
1168
+ }
1169
+ });
1170
+ enifed('ember-testing/helpers/click', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
1067
1171
  /**
1068
- Loads a route, sets up any controllers, and renders any templates associated
1069
- with the route as though a real user had triggered the route change while
1070
- using your app.
1071
-
1072
- Example:
1073
-
1074
- ```javascript
1075
- visit('posts/index').then(function() {
1076
- // assert something
1077
- });
1078
- ```
1079
-
1080
- @method visit
1081
- @param {String} url the name of the route
1082
- @return {RSVP.Promise}
1083
- @public
1172
+ @module ember
1173
+ @submodule ember-testing
1084
1174
  */
1085
- _emberTestingTestHelpers.registerAsyncHelper('visit', _emberTestingHelpersVisit.default);
1175
+ 'use strict';
1176
+
1177
+ exports.default = click;
1086
1178
 
1087
1179
  /**
1088
1180
  Clicks an element and triggers any actions triggered by the element's `click`
@@ -1102,111 +1194,30 @@ enifed('ember-testing/helpers', ['exports', 'ember-testing/test/helpers', 'ember
1102
1194
  @return {RSVP.Promise}
1103
1195
  @public
1104
1196
  */
1105
- _emberTestingTestHelpers.registerAsyncHelper('click', _emberTestingHelpersClick.default);
1106
1197
 
1107
- /**
1108
- Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
1109
-
1110
- Example:
1111
-
1112
- ```javascript
1113
- keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
1114
- // assert something
1115
- });
1116
- ```
1117
-
1118
- @method keyEvent
1119
- @param {String} selector jQuery selector for finding element on the DOM
1120
- @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
1121
- @param {Number} keyCode the keyCode of the simulated key event
1122
- @return {RSVP.Promise}
1123
- @since 1.5.0
1124
- @public
1125
- */
1126
- _emberTestingTestHelpers.registerAsyncHelper('keyEvent', _emberTestingHelpersKey_event.default);
1198
+ function click(app, selector, context) {
1199
+ var $el = app.testHelpers.findWithAssert(selector, context);
1200
+ var el = $el[0];
1127
1201
 
1128
- /**
1129
- Fills in an input element with some text.
1130
-
1131
- Example:
1132
-
1133
- ```javascript
1134
- fillIn('#email', 'you@example.com').then(function() {
1135
- // assert something
1136
- });
1137
- ```
1138
-
1139
- @method fillIn
1140
- @param {String} selector jQuery selector finding an input element on the DOM
1141
- to fill text with
1142
- @param {String} text text to place inside the input element
1143
- @return {RSVP.Promise}
1144
- @public
1145
- */
1146
- _emberTestingTestHelpers.registerAsyncHelper('fillIn', _emberTestingHelpersFill_in.default);
1202
+ _emberTestingEvents.fireEvent(el, 'mousedown');
1147
1203
 
1148
- /**
1149
- Finds an element in the context of the app's container element. A simple alias
1150
- for `app.$(selector)`.
1151
-
1152
- Example:
1153
-
1154
- ```javascript
1155
- var $el = find('.my-selector');
1156
- ```
1157
-
1158
- @method find
1159
- @param {String} selector jQuery string selector for element lookup
1160
- @return {Object} jQuery object representing the results of the query
1161
- @public
1162
- */
1163
- _emberTestingTestHelpers.registerHelper('find', _emberTestingHelpersFind.default);
1204
+ _emberTestingEvents.focus(el);
1164
1205
 
1165
- /**
1166
- Like `find`, but throws an error if the element selector returns no results.
1167
-
1168
- Example:
1169
-
1170
- ```javascript
1171
- var $el = findWithAssert('.doesnt-exist'); // throws error
1172
- ```
1173
-
1174
- @method findWithAssert
1175
- @param {String} selector jQuery selector string for finding an element within
1176
- the DOM
1177
- @return {Object} jQuery object representing the results of the query
1178
- @throws {Error} throws error if jQuery object returned has a length of 0
1179
- @public
1180
- */
1181
- _emberTestingTestHelpers.registerHelper('findWithAssert', _emberTestingHelpersFind_with_assert.default);
1206
+ _emberTestingEvents.fireEvent(el, 'mouseup');
1207
+ _emberTestingEvents.fireEvent(el, 'click');
1182
1208
 
1209
+ return app.testHelpers.wait();
1210
+ }
1211
+ });
1212
+ enifed('ember-testing/helpers/current_path', ['exports', 'ember-metal'], function (exports, _emberMetal) {
1183
1213
  /**
1184
- Causes the run loop to process any pending events. This is used to ensure that
1185
- any async operations from other helpers (or your assertions) have been processed.
1186
-
1187
- This is most often used as the return value for the helper functions (see 'click',
1188
- 'fillIn','visit',etc).
1189
-
1190
- Example:
1191
-
1192
- ```javascript
1193
- Ember.Test.registerAsyncHelper('loginUser', function(app, username, password) {
1194
- visit('secured/path/here')
1195
- .fillIn('#username', username)
1196
- .fillIn('#password', password)
1197
- .click('.submit')
1198
-
1199
- return app.testHelpers.wait();
1200
- });
1201
-
1202
- @method wait
1203
- @param {Object} value The value to be returned.
1204
- @return {RSVP.Promise}
1205
- @public
1214
+ @module ember
1215
+ @submodule ember-testing
1206
1216
  */
1207
- _emberTestingTestHelpers.registerAsyncHelper('wait', _emberTestingHelpersWait.default);
1208
- _emberTestingTestHelpers.registerAsyncHelper('andThen', _emberTestingHelpersAnd_then.default);
1209
- _emberTestingTestHelpers.registerHelper('currentRouteName', _emberTestingHelpersCurrent_route_name.default);
1217
+ 'use strict';
1218
+
1219
+ exports.default = currentPath;
1220
+
1210
1221
  /**
1211
1222
  Returns the current path.
1212
1223
 
@@ -1225,69 +1236,13 @@ enifed('ember-testing/helpers', ['exports', 'ember-testing/test/helpers', 'ember
1225
1236
  @since 1.5.0
1226
1237
  @public
1227
1238
  */
1228
- _emberTestingTestHelpers.registerHelper('currentPath', _emberTestingHelpersCurrent_path.default);
1229
-
1230
- /**
1231
- Returns the current URL.
1232
-
1233
- Example:
1234
-
1235
- ```javascript
1236
- function validateURL() {
1237
- equal(currentURL(), '/some/path', "correct URL was transitioned into.");
1238
- }
1239
-
1240
- click('#some-link-id').then(validateURL);
1241
- ```
1242
-
1243
- @method currentURL
1244
- @return {Object} The currently active URL.
1245
- @since 1.5.0
1246
- @public
1247
- */
1248
- _emberTestingTestHelpers.registerHelper('currentURL', _emberTestingHelpersCurrent_url.default);
1249
- _emberTestingTestHelpers.registerAsyncHelper('pauseTest', _emberTestingHelpersPause_test.default);
1250
- _emberTestingTestHelpers.registerAsyncHelper('triggerEvent', _emberTestingHelpersTrigger_event.default);
1251
- });
1252
- enifed("ember-testing/helpers/and_then", ["exports"], function (exports) {
1253
- "use strict";
1254
-
1255
- exports.default = andThen;
1256
-
1257
- function andThen(app, callback) {
1258
- return app.testHelpers.wait(callback(app));
1259
- }
1260
- });
1261
- enifed('ember-testing/helpers/click', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
1262
- 'use strict';
1263
-
1264
- exports.default = click;
1265
-
1266
- function click(app, selector, context) {
1267
- var $el = app.testHelpers.findWithAssert(selector, context);
1268
- var el = $el[0];
1269
-
1270
- _emberTestingEvents.fireEvent(el, 'mousedown');
1271
-
1272
- _emberTestingEvents.focus(el);
1273
-
1274
- _emberTestingEvents.fireEvent(el, 'mouseup');
1275
- _emberTestingEvents.fireEvent(el, 'click');
1276
-
1277
- return app.testHelpers.wait();
1278
- }
1279
- });
1280
- enifed('ember-testing/helpers/current_path', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
1281
- 'use strict';
1282
-
1283
- exports.default = currentPath;
1284
1239
 
1285
1240
  function currentPath(app) {
1286
1241
  var routingService = app.__container__.lookup('service:-routing');
1287
- return _emberMetalProperty_get.get(routingService, 'currentPath');
1242
+ return _emberMetal.get(routingService, 'currentPath');
1288
1243
  }
1289
1244
  });
1290
- enifed('ember-testing/helpers/current_route_name', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
1245
+ enifed('ember-testing/helpers/current_route_name', ['exports', 'ember-metal'], function (exports, _emberMetal) {
1291
1246
  /**
1292
1247
  @module ember
1293
1248
  @submodule ember-testing
@@ -1313,24 +1268,70 @@ enifed('ember-testing/helpers/current_route_name', ['exports', 'ember-metal/prop
1313
1268
 
1314
1269
  function currentRouteName(app) {
1315
1270
  var routingService = app.__container__.lookup('service:-routing');
1316
- return _emberMetalProperty_get.get(routingService, 'currentRouteName');
1271
+ return _emberMetal.get(routingService, 'currentRouteName');
1317
1272
  }
1318
1273
  });
1319
- enifed('ember-testing/helpers/current_url', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
1274
+ enifed('ember-testing/helpers/current_url', ['exports', 'ember-metal'], function (exports, _emberMetal) {
1275
+ /**
1276
+ @module ember
1277
+ @submodule ember-testing
1278
+ */
1320
1279
  'use strict';
1321
1280
 
1322
1281
  exports.default = currentURL;
1323
1282
 
1283
+ /**
1284
+ Returns the current URL.
1285
+
1286
+ Example:
1287
+
1288
+ ```javascript
1289
+ function validateURL() {
1290
+ equal(currentURL(), '/some/path', "correct URL was transitioned into.");
1291
+ }
1292
+
1293
+ click('#some-link-id').then(validateURL);
1294
+ ```
1295
+
1296
+ @method currentURL
1297
+ @return {Object} The currently active URL.
1298
+ @since 1.5.0
1299
+ @public
1300
+ */
1301
+
1324
1302
  function currentURL(app) {
1325
1303
  var router = app.__container__.lookup('router:main');
1326
- return _emberMetalProperty_get.get(router, 'location').getURL();
1304
+ return _emberMetal.get(router, 'location').getURL();
1327
1305
  }
1328
1306
  });
1329
1307
  enifed('ember-testing/helpers/fill_in', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
1308
+ /**
1309
+ @module ember
1310
+ @submodule ember-testing
1311
+ */
1330
1312
  'use strict';
1331
1313
 
1332
1314
  exports.default = fillIn;
1333
1315
 
1316
+ /**
1317
+ Fills in an input element with some text.
1318
+
1319
+ Example:
1320
+
1321
+ ```javascript
1322
+ fillIn('#email', 'you@example.com').then(function() {
1323
+ // assert something
1324
+ });
1325
+ ```
1326
+
1327
+ @method fillIn
1328
+ @param {String} selector jQuery selector finding an input element on the DOM
1329
+ to fill text with
1330
+ @param {String} text text to place inside the input element
1331
+ @return {RSVP.Promise}
1332
+ @public
1333
+ */
1334
+
1334
1335
  function fillIn(app, selector, contextOrText, text) {
1335
1336
  var $el = undefined,
1336
1337
  el = undefined,
@@ -1351,19 +1352,75 @@ enifed('ember-testing/helpers/fill_in', ['exports', 'ember-testing/events'], fun
1351
1352
  return app.testHelpers.wait();
1352
1353
  }
1353
1354
  });
1354
- enifed('ember-testing/helpers/find', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) {
1355
+ enifed('ember-testing/helpers/find', ['exports', 'ember-metal'], function (exports, _emberMetal) {
1356
+ /**
1357
+ @module ember
1358
+ @submodule ember-testing
1359
+ */
1355
1360
  'use strict';
1356
1361
 
1357
1362
  exports.default = find;
1358
1363
 
1364
+ /**
1365
+ Finds an element in the context of the app's container element. A simple alias
1366
+ for `app.$(selector)`.
1367
+
1368
+ Example:
1369
+
1370
+ ```javascript
1371
+ var $el = find('.my-selector');
1372
+ ```
1373
+
1374
+ With the `context` param:
1375
+
1376
+ ```javascript
1377
+ var $el = find('.my-selector', '.parent-element-class');
1378
+ ```
1379
+
1380
+ @method find
1381
+ @param {String} selector jQuery string selector for element lookup
1382
+ @param {String} [context] (optional) jQuery selector that will limit the selector
1383
+ argument to find only within the context's children
1384
+ @return {Object} jQuery object representing the results of the query
1385
+ @public
1386
+ */
1387
+
1359
1388
  function find(app, selector, context) {
1360
1389
  var $el = undefined;
1361
- context = context || _emberMetalProperty_get.get(app, 'rootElement');
1390
+ context = context || _emberMetal.get(app, 'rootElement');
1362
1391
  $el = app.$(selector, context);
1363
1392
  return $el;
1364
1393
  }
1365
1394
  });
1366
1395
  enifed('ember-testing/helpers/find_with_assert', ['exports'], function (exports) {
1396
+ /**
1397
+ @module ember
1398
+ @submodule ember-testing
1399
+ */
1400
+ /**
1401
+ Like `find`, but throws an error if the element selector returns no results.
1402
+
1403
+ Example:
1404
+
1405
+ ```javascript
1406
+ var $el = findWithAssert('.doesnt-exist'); // throws error
1407
+ ```
1408
+
1409
+ With the `context` param:
1410
+
1411
+ ```javascript
1412
+ var $el = findWithAssert('.selector-id', '.parent-element-class'); // assert will pass
1413
+ ```
1414
+
1415
+ @method findWithAssert
1416
+ @param {String} selector jQuery selector string for finding an element within
1417
+ the DOM
1418
+ @param {String} [context] (optional) jQuery selector that will limit the
1419
+ selector argument to find only within the context's children
1420
+ @return {Object} jQuery object representing the results of the query
1421
+ @throws {Error} throws error if jQuery object returned has a length of 0
1422
+ @public
1423
+ */
1367
1424
  'use strict';
1368
1425
 
1369
1426
  exports.default = findWithAssert;
@@ -1377,6 +1434,26 @@ enifed('ember-testing/helpers/find_with_assert', ['exports'], function (exports)
1377
1434
  }
1378
1435
  });
1379
1436
  enifed('ember-testing/helpers/key_event', ['exports'], function (exports) {
1437
+ /**
1438
+ @module ember
1439
+ @submodule ember-testing
1440
+ */
1441
+ /**
1442
+ Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
1443
+ Example:
1444
+ ```javascript
1445
+ keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
1446
+ // assert something
1447
+ });
1448
+ ```
1449
+ @method keyEvent
1450
+ @param {String} selector jQuery selector for finding element on the DOM
1451
+ @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
1452
+ @param {Number} keyCode the keyCode of the simulated key event
1453
+ @return {RSVP.Promise}
1454
+ @since 1.5.0
1455
+ @public
1456
+ */
1380
1457
  'use strict';
1381
1458
 
1382
1459
  exports.default = keyEvent;
@@ -1397,19 +1474,37 @@ enifed('ember-testing/helpers/key_event', ['exports'], function (exports) {
1397
1474
  return app.testHelpers.triggerEvent(selector, context, type, { keyCode: keyCode, which: keyCode });
1398
1475
  }
1399
1476
  });
1400
- enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime/ext/rsvp'], function (exports, _emberRuntimeExtRsvp) {
1477
+ enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime', 'ember-console', 'ember-metal'], function (exports, _emberRuntime, _emberConsole, _emberMetal) {
1401
1478
  /**
1402
1479
  @module ember
1403
1480
  @submodule ember-testing
1404
1481
  */
1405
1482
  'use strict';
1406
1483
 
1407
- exports.default = pauseTest;
1484
+ exports.resumeTest = resumeTest;
1485
+ exports.pauseTest = pauseTest;
1486
+
1487
+ var resume = undefined;
1488
+
1489
+ /**
1490
+ Resumes a test paused by `pauseTest`.
1491
+
1492
+ @method resumeTest
1493
+ @return {void}
1494
+ @public
1495
+ */
1496
+
1497
+ function resumeTest() {
1498
+ _emberMetal.assert('Testing has not been paused. There is nothing to resume.', resume);
1499
+ resume();
1500
+ resume = undefined;
1501
+ }
1408
1502
 
1409
1503
  /**
1410
1504
  Pauses the current test - this is useful for debugging while testing or for test-driving.
1411
1505
  It allows you to inspect the state of your application at any point.
1412
1506
  Example (The test will pause before clicking the button):
1507
+
1413
1508
  ```javascript
1414
1509
  visit('/')
1415
1510
  return pauseTest();
@@ -1422,7 +1517,15 @@ enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime/ext/rsvp']
1422
1517
  */
1423
1518
 
1424
1519
  function pauseTest() {
1425
- return new _emberRuntimeExtRsvp.default.Promise(function () {}, 'TestAdapter paused promise');
1520
+ if (false) {
1521
+ _emberConsole.default.info('Testing paused. Use `resumeTest()` to continue.');
1522
+ }
1523
+
1524
+ return new _emberRuntime.RSVP.Promise(function (resolve) {
1525
+ if (false) {
1526
+ resume = resolve;
1527
+ }
1528
+ }, 'TestAdapter paused promise');
1426
1529
  }
1427
1530
  });
1428
1531
  enifed('ember-testing/helpers/trigger_event', ['exports', 'ember-testing/events'], function (exports, _emberTestingEvents) {
@@ -1496,11 +1599,34 @@ enifed('ember-testing/helpers/trigger_event', ['exports', 'ember-testing/events'
1496
1599
  return app.testHelpers.wait();
1497
1600
  }
1498
1601
  });
1499
- enifed('ember-testing/helpers/visit', ['exports', 'ember-metal/run_loop'], function (exports, _emberMetalRun_loop) {
1602
+ enifed('ember-testing/helpers/visit', ['exports', 'ember-metal'], function (exports, _emberMetal) {
1603
+ /**
1604
+ @module ember
1605
+ @submodule ember-testing
1606
+ */
1500
1607
  'use strict';
1501
1608
 
1502
1609
  exports.default = visit;
1503
1610
 
1611
+ /**
1612
+ Loads a route, sets up any controllers, and renders any templates associated
1613
+ with the route as though a real user had triggered the route change while
1614
+ using your app.
1615
+
1616
+ Example:
1617
+
1618
+ ```javascript
1619
+ visit('posts/index').then(function() {
1620
+ // assert something
1621
+ });
1622
+ ```
1623
+
1624
+ @method visit
1625
+ @param {String} url the name of the route
1626
+ @return {RSVP.Promise}
1627
+ @public
1628
+ */
1629
+
1504
1630
  function visit(app, url) {
1505
1631
  var router = app.__container__.lookup('router:main');
1506
1632
  var shouldHandleURL = false;
@@ -1509,13 +1635,13 @@ enifed('ember-testing/helpers/visit', ['exports', 'ember-metal/run_loop'], funct
1509
1635
  router.location.setURL(url);
1510
1636
 
1511
1637
  if (shouldHandleURL) {
1512
- _emberMetalRun_loop.default(app.__deprecatedInstance__, 'handleURL', url);
1638
+ _emberMetal.run(app.__deprecatedInstance__, 'handleURL', url);
1513
1639
  }
1514
1640
  });
1515
1641
 
1516
1642
  if (app._readinessDeferrals > 0) {
1517
1643
  router['initialURL'] = url;
1518
- _emberMetalRun_loop.default(app, 'advanceReadiness');
1644
+ _emberMetal.run(app, 'advanceReadiness');
1519
1645
  delete router['initialURL'];
1520
1646
  } else {
1521
1647
  shouldHandleURL = true;
@@ -1524,13 +1650,42 @@ enifed('ember-testing/helpers/visit', ['exports', 'ember-metal/run_loop'], funct
1524
1650
  return app.testHelpers.wait();
1525
1651
  }
1526
1652
  });
1527
- 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) {
1653
+ 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) {
1654
+ /**
1655
+ @module ember
1656
+ @submodule ember-testing
1657
+ */
1528
1658
  'use strict';
1529
1659
 
1530
1660
  exports.default = wait;
1531
1661
 
1662
+ /**
1663
+ Causes the run loop to process any pending events. This is used to ensure that
1664
+ any async operations from other helpers (or your assertions) have been processed.
1665
+
1666
+ This is most often used as the return value for the helper functions (see 'click',
1667
+ 'fillIn','visit',etc).
1668
+
1669
+ Example:
1670
+
1671
+ ```javascript
1672
+ Ember.Test.registerAsyncHelper('loginUser', function(app, username, password) {
1673
+ visit('secured/path/here')
1674
+ .fillIn('#username', username)
1675
+ .fillIn('#password', password)
1676
+ .click('.submit')
1677
+
1678
+ return app.testHelpers.wait();
1679
+ });
1680
+
1681
+ @method wait
1682
+ @param {Object} value The value to be returned.
1683
+ @return {RSVP.Promise}
1684
+ @public
1685
+ */
1686
+
1532
1687
  function wait(app, value) {
1533
- return new _emberRuntimeExtRsvp.default.Promise(function (resolve) {
1688
+ return new _emberRuntime.RSVP.Promise(function (resolve) {
1534
1689
  var router = app.__container__.lookup('router:main');
1535
1690
 
1536
1691
  // Every 10ms, poll for the async thing to have finished
@@ -1547,7 +1702,7 @@ enifed('ember-testing/helpers/wait', ['exports', 'ember-testing/test/waiters', '
1547
1702
  }
1548
1703
 
1549
1704
  // 3. If there are scheduled timers or we are inside of a run loop, keep polling
1550
- if (_emberMetalRun_loop.default.hasScheduledTimers() || _emberMetalRun_loop.default.currentRunLoop) {
1705
+ if (_emberMetal.run.hasScheduledTimers() || _emberMetal.run.currentRunLoop) {
1551
1706
  return;
1552
1707
  }
1553
1708
 
@@ -1559,39 +1714,34 @@ enifed('ember-testing/helpers/wait', ['exports', 'ember-testing/test/waiters', '
1559
1714
  clearInterval(watcher);
1560
1715
 
1561
1716
  // Synchronously resolve the promise
1562
- _emberMetalRun_loop.default(null, resolve, value);
1717
+ _emberMetal.run(null, resolve, value);
1563
1718
  }, 10);
1564
1719
  });
1565
1720
  }
1566
1721
  });
1567
- 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) {
1722
+ 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) {
1568
1723
  'use strict';
1569
1724
 
1570
- // to setup initializer
1571
-
1572
- /**
1573
- @module ember
1574
- @submodule ember-testing
1575
- */
1576
-
1577
- _emberMetalCore.default.Test = _emberTestingTest.default;
1578
- _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default;
1579
- _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default;
1580
- Object.defineProperty(_emberTestingTest.default, 'QUnitAdapter', {
1581
- get: function () {
1582
- return _require.default('ember-testing/adapters/qunit').default;
1583
- }
1584
- });
1725
+ exports.Test = _emberTestingTest.default;
1726
+ exports.Adapter = _emberTestingAdaptersAdapter.default;
1727
+ exports.setupForTesting = _emberTestingSetup_for_testing.default;
1728
+ exports.QUnitAdapter = _emberTestingAdaptersQunit.default;
1585
1729
  });
1586
- // reexports
1587
1730
  // to handle various edge cases
1731
+ // setup RSVP + run loop integration
1588
1732
  // adds helpers to helpers object in Test
1589
- enifed('ember-testing/initializers', ['exports', 'ember-runtime/system/lazy_load'], function (exports, _emberRuntimeSystemLazy_load) {
1733
+ // to setup initializer
1734
+
1735
+ /**
1736
+ @module ember
1737
+ @submodule ember-testing
1738
+ */
1739
+ enifed('ember-testing/initializers', ['exports', 'ember-runtime'], function (exports, _emberRuntime) {
1590
1740
  'use strict';
1591
1741
 
1592
1742
  var name = 'deferReadiness in `testing` mode';
1593
1743
 
1594
- _emberRuntimeSystemLazy_load.onLoad('Ember.Application', function (Application) {
1744
+ _emberRuntime.onLoad('Ember.Application', function (Application) {
1595
1745
  if (!Application.initializers[name]) {
1596
1746
  Application.initializer({
1597
1747
  name: name,
@@ -1605,7 +1755,7 @@ enifed('ember-testing/initializers', ['exports', 'ember-runtime/system/lazy_load
1605
1755
  }
1606
1756
  });
1607
1757
  });
1608
- 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) {
1758
+ 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) {
1609
1759
  'use strict';
1610
1760
 
1611
1761
  exports.default = setupForTesting;
@@ -1624,25 +1774,24 @@ enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/testing', 'em
1624
1774
  */
1625
1775
 
1626
1776
  function setupForTesting() {
1627
- _emberMetalTesting.setTesting(true);
1777
+ _emberMetal.setTesting(true);
1628
1778
 
1629
1779
  var adapter = _emberTestingTestAdapter.getAdapter();
1630
1780
  // if adapter is not manually set default to QUnit
1631
1781
  if (!adapter) {
1632
- var QUnitAdapter = _require.default('ember-testing/adapters/qunit').default;
1633
- _emberTestingTestAdapter.setAdapter(new QUnitAdapter());
1782
+ _emberTestingTestAdapter.setAdapter(new _emberTestingAdaptersQunit.default());
1634
1783
  }
1635
1784
 
1636
- _emberViewsSystemJquery.default(document).off('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
1637
- _emberViewsSystemJquery.default(document).off('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
1785
+ _emberViews.jQuery(document).off('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
1786
+ _emberViews.jQuery(document).off('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
1638
1787
 
1639
1788
  _emberTestingTestPending_requests.clearPendingRequests();
1640
1789
 
1641
- _emberViewsSystemJquery.default(document).on('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
1642
- _emberViewsSystemJquery.default(document).on('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
1790
+ _emberViews.jQuery(document).on('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests);
1791
+ _emberViews.jQuery(document).on('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests);
1643
1792
  }
1644
1793
  });
1645
- enifed('ember-testing/support', ['exports', 'ember-metal/debug', 'ember-views/system/jquery', 'ember-environment'], function (exports, _emberMetalDebug, _emberViewsSystemJquery, _emberEnvironment) {
1794
+ enifed('ember-testing/support', ['exports', 'ember-metal', 'ember-views', 'ember-environment'], function (exports, _emberMetal, _emberViews, _emberEnvironment) {
1646
1795
  'use strict';
1647
1796
 
1648
1797
  /**
@@ -1650,7 +1799,7 @@ enifed('ember-testing/support', ['exports', 'ember-metal/debug', 'ember-views/sy
1650
1799
  @submodule ember-testing
1651
1800
  */
1652
1801
 
1653
- var $ = _emberViewsSystemJquery.default;
1802
+ var $ = _emberViews.jQuery;
1654
1803
 
1655
1804
  /**
1656
1805
  This method creates a checkbox and triggers the click event to fire the
@@ -1661,10 +1810,11 @@ enifed('ember-testing/support', ['exports', 'ember-metal/debug', 'ember-views/sy
1661
1810
  @method testCheckboxClick
1662
1811
  */
1663
1812
  function testCheckboxClick(handler) {
1664
- $('<input type="checkbox">').css({ position: 'absolute', left: '-1000px', top: '-1000px' }).appendTo('body').on('click', handler).trigger('click').remove();
1813
+ var input = document.createElement('input');
1814
+ $(input).attr('type', 'checkbox').css({ position: 'absolute', left: '-1000px', top: '-1000px' }).appendTo('body').on('click', handler).trigger('click').remove();
1665
1815
  }
1666
1816
 
1667
- if (_emberEnvironment.environment.hasDOM) {
1817
+ if (_emberEnvironment.environment.hasDOM && typeof $ === 'function') {
1668
1818
  $(function () {
1669
1819
  /*
1670
1820
  Determine whether a checkbox checked using jQuery's "click" method will have
@@ -1689,12 +1839,12 @@ enifed('ember-testing/support', ['exports', 'ember-metal/debug', 'ember-views/sy
1689
1839
 
1690
1840
  // Try again to verify that the patch took effect or blow up.
1691
1841
  testCheckboxClick(function () {
1692
- _emberMetalDebug.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' });
1842
+ _emberMetal.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' });
1693
1843
  });
1694
1844
  });
1695
1845
  }
1696
1846
  });
1697
- 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) {
1847
+ 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) {
1698
1848
  /**
1699
1849
  @module ember
1700
1850
  @submodule ember-testing
@@ -1768,7 +1918,7 @@ enifed('ember-testing/test', ['exports', 'ember-testing/test/helpers', 'ember-te
1768
1918
 
1769
1919
  exports.default = Test;
1770
1920
  });
1771
- enifed('ember-testing/test/adapter', ['exports', 'ember-console', 'ember-metal/error_handler'], function (exports, _emberConsole, _emberMetalError_handler) {
1921
+ enifed('ember-testing/test/adapter', ['exports', 'ember-console', 'ember-metal'], function (exports, _emberConsole, _emberMetal) {
1772
1922
  'use strict';
1773
1923
 
1774
1924
  exports.getAdapter = getAdapter;
@@ -1785,9 +1935,9 @@ enifed('ember-testing/test/adapter', ['exports', 'ember-console', 'ember-metal/e
1785
1935
  function setAdapter(value) {
1786
1936
  adapter = value;
1787
1937
  if (value) {
1788
- _emberMetalError_handler.setDispatchOverride(adapterDispatch);
1938
+ _emberMetal.setDispatchOverride(adapterDispatch);
1789
1939
  } else {
1790
- _emberMetalError_handler.setDispatchOverride(null);
1940
+ _emberMetal.setDispatchOverride(null);
1791
1941
  }
1792
1942
  }
1793
1943
 
@@ -1998,26 +2148,20 @@ enifed("ember-testing/test/pending_requests", ["exports"], function (exports) {
1998
2148
  }
1999
2149
  }
2000
2150
  });
2001
- enifed('ember-testing/test/promise', ['exports', 'ember-runtime/ext/rsvp', 'ember-testing/test/run'], function (exports, _emberRuntimeExtRsvp, _emberTestingTestRun) {
2151
+ enifed('ember-testing/test/promise', ['exports', 'ember-runtime', 'ember-testing/test/run'], function (exports, _emberRuntime, _emberTestingTestRun) {
2002
2152
  'use strict';
2003
2153
 
2004
2154
  exports.promise = promise;
2005
2155
  exports.resolve = resolve;
2006
2156
  exports.getLastPromise = getLastPromise;
2007
2157
 
2008
- 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; }
2009
-
2010
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
2011
-
2012
- 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); }
2013
-
2014
2158
  var lastPromise = undefined;
2015
2159
 
2016
2160
  var TestPromise = (function (_RSVP$Promise) {
2017
- _inherits(TestPromise, _RSVP$Promise);
2161
+ babelHelpers.inherits(TestPromise, _RSVP$Promise);
2018
2162
 
2019
2163
  function TestPromise() {
2020
- _classCallCheck(this, TestPromise);
2164
+ babelHelpers.classCallCheck(this, TestPromise);
2021
2165
 
2022
2166
  _RSVP$Promise.apply(this, arguments);
2023
2167
  lastPromise = this;
@@ -2037,12 +2181,6 @@ enifed('ember-testing/test/promise', ['exports', 'ember-runtime/ext/rsvp', 'embe
2037
2181
  @param {String} label An optional string for identifying the promise.
2038
2182
  */
2039
2183
 
2040
- TestPromise.resolve = function resolve(val) {
2041
- return new TestPromise(function (resolve) {
2042
- return resolve(val);
2043
- });
2044
- };
2045
-
2046
2184
  TestPromise.prototype.then = function then(onFulfillment) {
2047
2185
  var _RSVP$Promise$prototype$then;
2048
2186
 
@@ -2056,7 +2194,7 @@ enifed('ember-testing/test/promise', ['exports', 'ember-runtime/ext/rsvp', 'embe
2056
2194
  };
2057
2195
 
2058
2196
  return TestPromise;
2059
- })(_emberRuntimeExtRsvp.default.Promise);
2197
+ })(_emberRuntime.RSVP.Promise);
2060
2198
 
2061
2199
  exports.default = TestPromise;
2062
2200
 
@@ -2077,10 +2215,8 @@ enifed('ember-testing/test/promise', ['exports', 'ember-runtime/ext/rsvp', 'embe
2077
2215
  @since 1.2.0
2078
2216
  */
2079
2217
 
2080
- function resolve(result) {
2081
- return new TestPromise(function (resolve) {
2082
- return resolve(result);
2083
- });
2218
+ function resolve(result, label) {
2219
+ return TestPromise.resolve(result, label);
2084
2220
  }
2085
2221
 
2086
2222
  function getLastPromise() {
@@ -2116,20 +2252,20 @@ enifed('ember-testing/test/promise', ['exports', 'ember-runtime/ext/rsvp', 'embe
2116
2252
  }
2117
2253
  }
2118
2254
  });
2119
- enifed('ember-testing/test/run', ['exports', 'ember-metal/run_loop'], function (exports, _emberMetalRun_loop) {
2255
+ enifed('ember-testing/test/run', ['exports', 'ember-metal'], function (exports, _emberMetal) {
2120
2256
  'use strict';
2121
2257
 
2122
2258
  exports.default = run;
2123
2259
 
2124
2260
  function run(fn) {
2125
- if (!_emberMetalRun_loop.default.currentRunLoop) {
2126
- return _emberMetalRun_loop.default(fn);
2261
+ if (!_emberMetal.run.currentRunLoop) {
2262
+ return _emberMetal.run(fn);
2127
2263
  } else {
2128
2264
  return fn();
2129
2265
  }
2130
2266
  }
2131
2267
  });
2132
- enifed('ember-testing/test/waiters', ['exports', 'ember-metal/features', 'ember-metal/debug'], function (exports, _emberMetalFeatures, _emberMetalDebug) {
2268
+ enifed('ember-testing/test/waiters', ['exports', 'ember-metal'], function (exports, _emberMetal) {
2133
2269
  'use strict';
2134
2270
 
2135
2271
  exports.registerWaiter = registerWaiter;
@@ -2143,7 +2279,10 @@ enifed('ember-testing/test/waiters', ['exports', 'ember-metal/features', 'ember-
2143
2279
  /**
2144
2280
  This allows ember-testing to play nicely with other asynchronous
2145
2281
  events, such as an application that is waiting for a CSS3
2146
- transition or an IndexDB transaction.
2282
+ transition or an IndexDB transaction. The waiter runs periodically
2283
+ after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
2284
+ until the returning result is truthy. After the waiters finish, the next async helper
2285
+ is executed and the process repeats.
2147
2286
 
2148
2287
  For example:
2149
2288
 
@@ -2247,7 +2386,7 @@ enifed('ember-testing/test/waiters', ['exports', 'ember-metal/features', 'ember-
2247
2386
  }
2248
2387
 
2249
2388
  function generateDeprecatedWaitersArray() {
2250
- _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' });
2389
+ _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' });
2251
2390
 
2252
2391
  var array = new Array(callbacks.length);
2253
2392
  for (var i = 0; i < callbacks.length; i++) {