ember-source 4.5.0-beta.1 → 4.6.0-alpha.3
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.
- package/blueprints-js/-addon-import.js +48 -0
- package/blueprints-js/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +24 -0
- package/blueprints-js/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
- package/blueprints-js/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +12 -0
- package/blueprints-js/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
- package/blueprints-js/component/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/component/files/__root__/__templatepath__/__templatename__.hbs +1 -0
- package/blueprints-js/component-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/component-class/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/component-class-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +34 -0
- package/blueprints-js/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +36 -0
- package/blueprints-js/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +38 -0
- package/blueprints-js/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +31 -0
- package/blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +36 -0
- package/blueprints-js/controller/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
- package/blueprints-js/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
- package/blueprints-js/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
- package/blueprints-js/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/helper/files/__root__/__collection__/__name__.js +5 -0
- package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +7 -0
- package/blueprints-js/helper-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +26 -0
- package/blueprints-js/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +28 -0
- package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +18 -0
- package/blueprints-js/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +15 -0
- package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +17 -0
- package/blueprints-js/initializer/files/__root__/initializers/__name__.js +5 -0
- package/blueprints-js/initializer-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +28 -0
- package/blueprints-js/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +31 -0
- package/blueprints-js/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +25 -0
- package/blueprints-js/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +37 -0
- package/blueprints-js/instance-initializer/files/__root__/instance-initializers/__name__.js +5 -0
- package/blueprints-js/instance-initializer-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +30 -0
- package/blueprints-js/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +32 -0
- package/blueprints-js/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +26 -0
- package/blueprints-js/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +39 -0
- package/blueprints-js/mixin/files/__root__/mixins/__name__.js +3 -0
- package/blueprints-js/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +13 -0
- package/blueprints-js/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +13 -0
- package/blueprints-js/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +12 -0
- package/blueprints-js/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +12 -0
- package/blueprints-js/route/files/__root__/__path__/__name__.js +9 -0
- package/blueprints-js/route/files/__root__/__templatepath__/__templatename__.hbs +2 -0
- package/blueprints-js/route-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/route-addon/files/__root__/__templatepath__/__templatename__.js +1 -0
- package/blueprints-js/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +15 -0
- package/blueprints-js/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +17 -0
- package/blueprints-js/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +11 -0
- package/blueprints-js/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +11 -0
- package/blueprints-js/service/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
- package/blueprints-js/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
- package/blueprints-js/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
- package/blueprints-js/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/template/files/__root__/__path__/__name__.hbs +0 -0
- package/blueprints-js/test-framework-detector.js +60 -0
- package/blueprints-js/util/files/__root__/utils/__name__.js +3 -0
- package/blueprints-js/util-test/mocha-files/__root__/__testType__/__name__-test.js +11 -0
- package/blueprints-js/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +11 -0
- package/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +10 -0
- package/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +10 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +4 -4
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +112 -136
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +584 -944
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/error-handling/index.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +21 -11
- package/dist/packages/@ember/-internals/metal/index.js +16 -9
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -4
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -3
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +281 -368
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -5
- package/dist/packages/@ember/application/lib/application.js +4 -1
- package/dist/packages/@ember/canary-features/index.js +2 -2
- package/dist/packages/@ember/controller/lib/controller_mixin.js +8 -18
- package/dist/packages/@ember/engine/index.js +3 -1
- package/dist/packages/@ember/object/index.js +16 -8
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +6 -4
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +74 -365
- package/dist/packages/@ember/test/adapter.js +2 -2
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +11 -27
- package/dist/packages/ember-testing/lib/adapters/qunit.js +8 -16
- package/dist/packages/ember-testing/lib/ext/application.js +28 -19
- package/dist/packages/ember-testing/lib/helpers/and_then.js +4 -1
- package/dist/packages/ember-testing/lib/helpers/current_path.js +5 -0
- package/dist/packages/ember-testing/lib/helpers/current_route_name.js +5 -0
- package/dist/packages/ember-testing/lib/helpers/current_url.js +8 -1
- package/dist/packages/ember-testing/lib/helpers/visit.js +12 -2
- package/dist/packages/ember-testing/lib/helpers/wait.js +6 -1
- package/dist/packages/ember-testing/lib/initializers.js +3 -3
- package/dist/packages/ember-testing/lib/test/adapter.js +2 -1
- package/dist/packages/ember-testing/lib/test/helpers.js +3 -1
- package/dist/packages/ember-testing/lib/test/on_inject_helpers.js +2 -2
- package/dist/packages/ember-testing/lib/test/promise.js +8 -8
- package/dist/packages/ember-testing/lib/test/waiters.js +14 -45
- package/dist/packages/ember-testing/lib/test.js +1 -1
- package/docs/data.json +745 -729
- package/package.json +7 -6
package/dist/ember-testing.js
CHANGED
|
@@ -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 4.
|
|
9
|
+
* @version 4.6.0-alpha.3
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -868,50 +868,34 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
868
868
|
});
|
|
869
869
|
_exports.default = void 0;
|
|
870
870
|
|
|
871
|
-
|
|
872
|
-
return this;
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
@module @ember/test
|
|
876
|
-
*/
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
The primary purpose of this class is to create hooks that can be implemented
|
|
880
|
-
by an adapter for various test frameworks.
|
|
881
|
-
|
|
882
|
-
@class TestAdapter
|
|
883
|
-
@public
|
|
884
|
-
*/
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
var _default = _runtime.Object.extend({
|
|
871
|
+
var Adapter = _runtime.Object.extend({
|
|
888
872
|
/**
|
|
889
873
|
This callback will be called whenever an async operation is about to start.
|
|
890
|
-
|
|
874
|
+
Override this to call your framework's methods that handle async
|
|
891
875
|
operations.
|
|
892
|
-
|
|
876
|
+
@public
|
|
893
877
|
@method asyncStart
|
|
894
878
|
*/
|
|
895
|
-
asyncStart
|
|
879
|
+
asyncStart() {},
|
|
896
880
|
|
|
897
881
|
/**
|
|
898
882
|
This callback will be called whenever an async operation has completed.
|
|
899
|
-
|
|
883
|
+
@public
|
|
900
884
|
@method asyncEnd
|
|
901
885
|
*/
|
|
902
|
-
asyncEnd
|
|
886
|
+
asyncEnd() {},
|
|
903
887
|
|
|
904
888
|
/**
|
|
905
889
|
Override this method with your testing framework's false assertion.
|
|
906
890
|
This function is called whenever an exception occurs causing the testing
|
|
907
891
|
promise to fail.
|
|
908
|
-
|
|
909
|
-
|
|
892
|
+
QUnit example:
|
|
893
|
+
```javascript
|
|
910
894
|
exception: function(error) {
|
|
911
895
|
ok(false, error);
|
|
912
896
|
};
|
|
913
897
|
```
|
|
914
|
-
|
|
898
|
+
@public
|
|
915
899
|
@method exception
|
|
916
900
|
@param {String} error The exception to be raised.
|
|
917
901
|
*/
|
|
@@ -921,6 +905,7 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
921
905
|
|
|
922
906
|
});
|
|
923
907
|
|
|
908
|
+
var _default = Adapter;
|
|
924
909
|
_exports.default = _default;
|
|
925
910
|
});
|
|
926
911
|
define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils", "ember-testing/lib/adapters/adapter"], function (_exports, _utils, _adapter) {
|
|
@@ -932,27 +917,17 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
932
917
|
_exports.default = void 0;
|
|
933
918
|
|
|
934
919
|
/* globals QUnit */
|
|
920
|
+
function isVeryOldQunit(obj) {
|
|
921
|
+
return obj != null && typeof obj.stop === 'function';
|
|
922
|
+
}
|
|
935
923
|
|
|
936
|
-
|
|
937
|
-
@module ember
|
|
938
|
-
*/
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
This class implements the methods defined by TestAdapter for the
|
|
942
|
-
QUnit testing framework.
|
|
943
|
-
|
|
944
|
-
@class QUnitAdapter
|
|
945
|
-
@namespace Ember.Test
|
|
946
|
-
@extends TestAdapter
|
|
947
|
-
@public
|
|
948
|
-
*/
|
|
949
|
-
var _default = _adapter.default.extend({
|
|
924
|
+
var QUnitAdapter = _adapter.default.extend({
|
|
950
925
|
init() {
|
|
951
926
|
this.doneCallbacks = [];
|
|
952
927
|
},
|
|
953
928
|
|
|
954
929
|
asyncStart() {
|
|
955
|
-
if (
|
|
930
|
+
if (isVeryOldQunit(QUnit)) {
|
|
956
931
|
// very old QUnit version
|
|
957
932
|
// eslint-disable-next-line qunit/no-qunit-stop
|
|
958
933
|
QUnit.stop();
|
|
@@ -965,7 +940,7 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
965
940
|
// checking for QUnit.stop here (even though we _need_ QUnit.start) because
|
|
966
941
|
// QUnit.start() still exists in QUnit 2.x (it just throws an error when calling
|
|
967
942
|
// inside a test context)
|
|
968
|
-
if (
|
|
943
|
+
if (isVeryOldQunit(QUnit)) {
|
|
969
944
|
QUnit.start();
|
|
970
945
|
} else {
|
|
971
946
|
var done = this.doneCallbacks.pop(); // This can be null if asyncStart() was called outside of a test
|
|
@@ -982,9 +957,10 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
982
957
|
|
|
983
958
|
});
|
|
984
959
|
|
|
960
|
+
var _default = QUnitAdapter;
|
|
985
961
|
_exports.default = _default;
|
|
986
962
|
});
|
|
987
|
-
define("ember-testing/lib/ext/application", ["@ember/application", "ember-testing/lib/setup_for_testing", "ember-testing/lib/test/helpers", "ember-testing/lib/test/promise", "ember-testing/lib/test/run", "ember-testing/lib/test/on_inject_helpers", "ember-testing/lib/test/adapter"], function (_application, _setup_for_testing, _helpers, _promise, _run, _on_inject_helpers, _adapter) {
|
|
963
|
+
define("ember-testing/lib/ext/application", ["@ember/application", "ember-testing/lib/setup_for_testing", "ember-testing/lib/test/helpers", "ember-testing/lib/test/promise", "ember-testing/lib/test/run", "ember-testing/lib/test/on_inject_helpers", "ember-testing/lib/test/adapter", "@ember/debug"], function (_application, _setup_for_testing, _helpers, _promise, _run, _on_inject_helpers, _adapter, _debug) {
|
|
988
964
|
"use strict";
|
|
989
965
|
|
|
990
966
|
_application.default.reopen({
|
|
@@ -993,7 +969,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
993
969
|
are created once you call `injectTestHelpers` on your `Application`
|
|
994
970
|
instance. The included helpers are also available on the `window` object by
|
|
995
971
|
default, but can be used from this object on the individual application also.
|
|
996
|
-
|
|
972
|
+
@property testHelpers
|
|
997
973
|
@type {Object}
|
|
998
974
|
@default {}
|
|
999
975
|
@public
|
|
@@ -1003,9 +979,9 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1003
979
|
/**
|
|
1004
980
|
This property will contain the original methods that were registered
|
|
1005
981
|
on the `helperContainer` before `injectTestHelpers` is called.
|
|
1006
|
-
|
|
982
|
+
When `removeTestHelpers` is called, these methods are restored to the
|
|
1007
983
|
`helperContainer`.
|
|
1008
|
-
|
|
984
|
+
@property originalMethods
|
|
1009
985
|
@type {Object}
|
|
1010
986
|
@default {}
|
|
1011
987
|
@private
|
|
@@ -1017,7 +993,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1017
993
|
This property indicates whether or not this application is currently in
|
|
1018
994
|
testing mode. This is set when `setupForTesting` is called on the current
|
|
1019
995
|
application.
|
|
1020
|
-
|
|
996
|
+
@property testing
|
|
1021
997
|
@type {Boolean}
|
|
1022
998
|
@default false
|
|
1023
999
|
@since 1.3.0
|
|
@@ -1032,11 +1008,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1032
1008
|
(preventing both accidental leaking of state between tests and interference
|
|
1033
1009
|
with your testing framework). `setupForTesting` should only be called after
|
|
1034
1010
|
setting a custom `router` class (for example `App.Router = Router.extend(`).
|
|
1035
|
-
|
|
1036
|
-
|
|
1011
|
+
Example:
|
|
1012
|
+
```
|
|
1037
1013
|
App.setupForTesting();
|
|
1038
1014
|
```
|
|
1039
|
-
|
|
1015
|
+
@method setupForTesting
|
|
1040
1016
|
@public
|
|
1041
1017
|
*/
|
|
1042
1018
|
setupForTesting() {
|
|
@@ -1050,7 +1026,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1050
1026
|
/**
|
|
1051
1027
|
This will be used as the container to inject the test helpers into. By
|
|
1052
1028
|
default the helpers are injected into `window`.
|
|
1053
|
-
|
|
1029
|
+
@property helperContainer
|
|
1054
1030
|
@type {Object} The object to be used for test helpers.
|
|
1055
1031
|
@default window
|
|
1056
1032
|
@since 1.2.0
|
|
@@ -1064,13 +1040,13 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1064
1040
|
to `window`. If a function of the same name has already been defined it will be cached
|
|
1065
1041
|
(so that it can be reset if the helper is removed with `unregisterHelper` or
|
|
1066
1042
|
`removeTestHelpers`).
|
|
1067
|
-
|
|
1043
|
+
Any callbacks registered with `onInjectHelpers` will be called once the
|
|
1068
1044
|
helpers have been injected.
|
|
1069
|
-
|
|
1045
|
+
Example:
|
|
1070
1046
|
```
|
|
1071
1047
|
App.injectTestHelpers();
|
|
1072
1048
|
```
|
|
1073
|
-
|
|
1049
|
+
@method injectTestHelpers
|
|
1074
1050
|
@public
|
|
1075
1051
|
*/
|
|
1076
1052
|
injectTestHelpers(helperContainer) {
|
|
@@ -1091,8 +1067,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1091
1067
|
this.testHelpers = {};
|
|
1092
1068
|
|
|
1093
1069
|
for (var name in _helpers.helpers) {
|
|
1094
|
-
|
|
1095
|
-
this.
|
|
1070
|
+
// SAFETY: It is safe to access a property on an object
|
|
1071
|
+
this.originalMethods[name] = this.helperContainer[name]; // SAFETY: It is not quite as safe to do this, but it _seems_ to be ok.
|
|
1072
|
+
|
|
1073
|
+
this.testHelpers[name] = this.helperContainer[name] = helper(this, name); // SAFETY: We checked that it exists
|
|
1074
|
+
|
|
1096
1075
|
protoWrap(_promise.default.prototype, name, helper(this, name), _helpers.helpers[name].meta.wait);
|
|
1097
1076
|
}
|
|
1098
1077
|
|
|
@@ -1102,11 +1081,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1102
1081
|
/**
|
|
1103
1082
|
This removes all helpers that have been registered, and resets and functions
|
|
1104
1083
|
that were overridden by the helpers.
|
|
1105
|
-
|
|
1106
|
-
|
|
1084
|
+
Example:
|
|
1085
|
+
```javascript
|
|
1107
1086
|
App.removeTestHelpers();
|
|
1108
1087
|
```
|
|
1109
|
-
|
|
1088
|
+
@public
|
|
1110
1089
|
@method removeTestHelpers
|
|
1111
1090
|
*/
|
|
1112
1091
|
removeTestHelpers() {
|
|
@@ -1115,7 +1094,8 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1115
1094
|
}
|
|
1116
1095
|
|
|
1117
1096
|
for (var name in _helpers.helpers) {
|
|
1118
|
-
this.helperContainer[name] = this.originalMethods[name];
|
|
1097
|
+
this.helperContainer[name] = this.originalMethods[name]; // SAFETY: This is a weird thing, but it's not technically unsafe here.
|
|
1098
|
+
|
|
1119
1099
|
delete _promise.default.prototype[name];
|
|
1120
1100
|
delete this.testHelpers[name];
|
|
1121
1101
|
delete this.originalMethods[name];
|
|
@@ -1128,6 +1108,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1128
1108
|
|
|
1129
1109
|
|
|
1130
1110
|
function protoWrap(proto, name, callback, isAsync) {
|
|
1111
|
+
// SAFETY: This isn't entirely safe, but it _seems_ to be ok.
|
|
1131
1112
|
proto[name] = function () {
|
|
1132
1113
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1133
1114
|
args[_key] = arguments[_key];
|
|
@@ -1136,6 +1117,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1136
1117
|
if (isAsync) {
|
|
1137
1118
|
return callback.apply(this, args);
|
|
1138
1119
|
} else {
|
|
1120
|
+
// SAFETY: This is not actually safe.
|
|
1139
1121
|
return this.then(function () {
|
|
1140
1122
|
return callback.apply(this, args);
|
|
1141
1123
|
});
|
|
@@ -1144,8 +1126,10 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1144
1126
|
}
|
|
1145
1127
|
|
|
1146
1128
|
function helper(app, name) {
|
|
1147
|
-
var
|
|
1148
|
-
|
|
1129
|
+
var helper = _helpers.helpers[name];
|
|
1130
|
+
(true && !(helper) && (0, _debug.assert)(`[BUG] Missing helper: ${name}`, helper));
|
|
1131
|
+
var fn = helper.method;
|
|
1132
|
+
var meta = helper.meta;
|
|
1149
1133
|
|
|
1150
1134
|
if (!meta.wait) {
|
|
1151
1135
|
return function () {
|
|
@@ -1209,7 +1193,7 @@ define("ember-testing/lib/helpers", ["ember-testing/lib/test/helpers", "ember-te
|
|
|
1209
1193
|
(0, _helpers.registerHelper)('currentURL', _current_url.default);
|
|
1210
1194
|
(0, _helpers.registerHelper)('resumeTest', _pause_test.resumeTest);
|
|
1211
1195
|
});
|
|
1212
|
-
define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
|
1196
|
+
define("ember-testing/lib/helpers/and_then", ["exports", "@ember/debug"], function (_exports, _debug) {
|
|
1213
1197
|
"use strict";
|
|
1214
1198
|
|
|
1215
1199
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1218,10 +1202,12 @@ define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
|
|
1218
1202
|
_exports.default = andThen;
|
|
1219
1203
|
|
|
1220
1204
|
function andThen(app, callback) {
|
|
1221
|
-
|
|
1205
|
+
var wait = app.testHelpers['wait'];
|
|
1206
|
+
(true && !(wait) && (0, _debug.assert)('[BUG] Missing wait helper', wait));
|
|
1207
|
+
return wait(callback(app));
|
|
1222
1208
|
}
|
|
1223
1209
|
});
|
|
1224
|
-
define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
1210
|
+
define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/metal", "@ember/-internals/routing", "@ember/debug"], function (_exports, _metal, _routing, _debug) {
|
|
1225
1211
|
"use strict";
|
|
1226
1212
|
|
|
1227
1213
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1252,12 +1238,15 @@ define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/
|
|
|
1252
1238
|
@public
|
|
1253
1239
|
*/
|
|
1254
1240
|
function currentPath(app) {
|
|
1241
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
1242
|
+
|
|
1255
1243
|
var routingService = app.__container__.lookup('service:-routing');
|
|
1256
1244
|
|
|
1245
|
+
(true && !(routingService instanceof _routing.RoutingService) && (0, _debug.assert)('[BUG] service:-routing is not a RoutingService', routingService instanceof _routing.RoutingService));
|
|
1257
1246
|
return (0, _metal.get)(routingService, 'currentPath');
|
|
1258
1247
|
}
|
|
1259
1248
|
});
|
|
1260
|
-
define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
1249
|
+
define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-internals/metal", "@ember/-internals/routing", "@ember/debug"], function (_exports, _metal, _routing, _debug) {
|
|
1261
1250
|
"use strict";
|
|
1262
1251
|
|
|
1263
1252
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1287,12 +1276,15 @@ define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-inte
|
|
|
1287
1276
|
@public
|
|
1288
1277
|
*/
|
|
1289
1278
|
function currentRouteName(app) {
|
|
1279
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
1280
|
+
|
|
1290
1281
|
var routingService = app.__container__.lookup('service:-routing');
|
|
1291
1282
|
|
|
1283
|
+
(true && !(routingService instanceof _routing.RoutingService) && (0, _debug.assert)('[BUG] service:-routing is not a RoutingService', routingService instanceof _routing.RoutingService));
|
|
1292
1284
|
return (0, _metal.get)(routingService, 'currentRouteName');
|
|
1293
1285
|
}
|
|
1294
1286
|
});
|
|
1295
|
-
define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
1287
|
+
define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/metal", "@ember/debug", "@ember/routing/router"], function (_exports, _metal, _debug, _router) {
|
|
1296
1288
|
"use strict";
|
|
1297
1289
|
|
|
1298
1290
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1323,9 +1315,14 @@ define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/m
|
|
|
1323
1315
|
@public
|
|
1324
1316
|
*/
|
|
1325
1317
|
function currentURL(app) {
|
|
1318
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
1319
|
+
|
|
1326
1320
|
var router = app.__container__.lookup('router:main');
|
|
1327
1321
|
|
|
1328
|
-
|
|
1322
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] router:main is not a Router', router instanceof _router.default));
|
|
1323
|
+
var location = (0, _metal.get)(router, 'location');
|
|
1324
|
+
(true && !(typeof location !== 'string') && (0, _debug.assert)('[BUG] location is still a string', typeof location !== 'string'));
|
|
1325
|
+
return location.getURL();
|
|
1329
1326
|
}
|
|
1330
1327
|
});
|
|
1331
1328
|
define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/runtime", "@ember/debug"], function (_exports, _runtime, _debug) {
|
|
@@ -1400,7 +1397,7 @@ define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/ru
|
|
|
1400
1397
|
}, 'TestAdapter paused promise');
|
|
1401
1398
|
}
|
|
1402
1399
|
});
|
|
1403
|
-
define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], function (_exports, _runloop) {
|
|
1400
|
+
define("ember-testing/lib/helpers/visit", ["exports", "@ember/debug", "@ember/routing/router", "@ember/runloop"], function (_exports, _debug, _router, _runloop) {
|
|
1404
1401
|
"use strict";
|
|
1405
1402
|
|
|
1406
1403
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1427,18 +1424,24 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
|
|
|
1427
1424
|
@public
|
|
1428
1425
|
*/
|
|
1429
1426
|
function visit(app, url) {
|
|
1427
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] Missing container', app.__container__));
|
|
1428
|
+
|
|
1430
1429
|
var router = app.__container__.lookup('router:main');
|
|
1431
1430
|
|
|
1431
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] router:main is not a Router', router instanceof _router.default));
|
|
1432
1432
|
var shouldHandleURL = false;
|
|
1433
1433
|
app.boot().then(() => {
|
|
1434
|
+
(true && !(typeof router.location !== 'string') && (0, _debug.assert)('[BUG] router.location is still a string', typeof router.location !== 'string'));
|
|
1434
1435
|
router.location.setURL(url);
|
|
1435
1436
|
|
|
1436
1437
|
if (shouldHandleURL) {
|
|
1438
|
+
(true && !(app.__deprecatedInstance__) && (0, _debug.assert)("[BUG] __deprecatedInstance__ isn't set", app.__deprecatedInstance__));
|
|
1437
1439
|
(0, _runloop.run)(app.__deprecatedInstance__, 'handleURL', url);
|
|
1438
1440
|
}
|
|
1439
1441
|
});
|
|
1440
1442
|
|
|
1441
1443
|
if (app._readinessDeferrals > 0) {
|
|
1444
|
+
// SAFETY: This should be safe, though it is odd.
|
|
1442
1445
|
router.initialURL = url;
|
|
1443
1446
|
(0, _runloop.run)(app, 'advanceReadiness');
|
|
1444
1447
|
delete router.initialURL;
|
|
@@ -1446,10 +1449,12 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
|
|
|
1446
1449
|
shouldHandleURL = true;
|
|
1447
1450
|
}
|
|
1448
1451
|
|
|
1449
|
-
|
|
1452
|
+
var wait = app.testHelpers['wait'];
|
|
1453
|
+
(true && !(wait) && (0, _debug.assert)('[BUG] missing wait helper', wait));
|
|
1454
|
+
return wait();
|
|
1450
1455
|
}
|
|
1451
1456
|
});
|
|
1452
|
-
define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/waiters", "@ember/-internals/runtime", "@ember/runloop", "ember-testing/lib/test/pending_requests"], function (_exports, _waiters, _runtime, _runloop, _pending_requests) {
|
|
1457
|
+
define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/waiters", "@ember/-internals/runtime", "@ember/runloop", "ember-testing/lib/test/pending_requests", "@ember/debug", "@ember/routing/router"], function (_exports, _waiters, _runtime, _runloop, _pending_requests, _debug, _router) {
|
|
1453
1458
|
"use strict";
|
|
1454
1459
|
|
|
1455
1460
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1493,8 +1498,11 @@ define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/wai
|
|
|
1493
1498
|
*/
|
|
1494
1499
|
function wait(app, value) {
|
|
1495
1500
|
return new _runtime.RSVP.Promise(function (resolve) {
|
|
1496
|
-
|
|
1501
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] Missing container', app.__container__));
|
|
1497
1502
|
|
|
1503
|
+
var router = app.__container__.lookup('router:main');
|
|
1504
|
+
|
|
1505
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] Expected router:main to be a subclass of Ember Router', router instanceof _router.default)); // Every 10ms, poll for the async thing to have finished
|
|
1498
1506
|
|
|
1499
1507
|
var watcher = setInterval(() => {
|
|
1500
1508
|
// 1. If the router is loading, keep polling
|
|
@@ -1530,9 +1538,9 @@ define("ember-testing/lib/initializers", ["@ember/application"], function (_appl
|
|
|
1530
1538
|
"use strict";
|
|
1531
1539
|
|
|
1532
1540
|
var name = 'deferReadiness in `testing` mode';
|
|
1533
|
-
(0, _application.onLoad)('Ember.Application', function (
|
|
1534
|
-
if (!
|
|
1535
|
-
|
|
1541
|
+
(0, _application.onLoad)('Ember.Application', function (ApplicationClass) {
|
|
1542
|
+
if (!ApplicationClass.initializers[name]) {
|
|
1543
|
+
ApplicationClass.initializer({
|
|
1536
1544
|
name: name,
|
|
1537
1545
|
|
|
1538
1546
|
initialize(application) {
|
|
@@ -1603,7 +1611,7 @@ define("ember-testing/lib/test", ["exports", "ember-testing/lib/test/helpers", "
|
|
|
1603
1611
|
var Test = {
|
|
1604
1612
|
/**
|
|
1605
1613
|
Hash containing all known test helpers.
|
|
1606
|
-
|
|
1614
|
+
@property _helpers
|
|
1607
1615
|
@private
|
|
1608
1616
|
@since 1.7.0
|
|
1609
1617
|
*/
|
|
@@ -1686,7 +1694,8 @@ define("ember-testing/lib/test/adapter", ["exports", "@ember/-internals/error-ha
|
|
|
1686
1694
|
}
|
|
1687
1695
|
|
|
1688
1696
|
function adapterDispatch(error) {
|
|
1689
|
-
adapter.exception(error);
|
|
1697
|
+
adapter.exception(error); // @ts-expect-error Normally unreachable
|
|
1698
|
+
|
|
1690
1699
|
console.error(error.stack); // eslint-disable-line no-console
|
|
1691
1700
|
}
|
|
1692
1701
|
});
|
|
@@ -1829,7 +1838,9 @@ define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/pro
|
|
|
1829
1838
|
|
|
1830
1839
|
|
|
1831
1840
|
function unregisterHelper(name) {
|
|
1832
|
-
delete helpers[name];
|
|
1841
|
+
delete helpers[name]; // SAFETY: This isn't necessarily a safe thing to do, but in terms of the immediate types here
|
|
1842
|
+
// it won't error.
|
|
1843
|
+
|
|
1833
1844
|
delete _promise.default.prototype[name];
|
|
1834
1845
|
}
|
|
1835
1846
|
});
|
|
@@ -1878,8 +1889,8 @@ define("ember-testing/lib/test/on_inject_helpers", ["exports"], function (_expor
|
|
|
1878
1889
|
}
|
|
1879
1890
|
|
|
1880
1891
|
function invokeInjectHelpersCallbacks(app) {
|
|
1881
|
-
for (var
|
|
1882
|
-
|
|
1892
|
+
for (var callback of callbacks) {
|
|
1893
|
+
callback(app);
|
|
1883
1894
|
}
|
|
1884
1895
|
}
|
|
1885
1896
|
});
|
|
@@ -1928,22 +1939,17 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
|
|
|
1928
1939
|
_exports.getLastPromise = getLastPromise;
|
|
1929
1940
|
_exports.promise = promise;
|
|
1930
1941
|
_exports.resolve = resolve;
|
|
1931
|
-
var lastPromise;
|
|
1942
|
+
var lastPromise = null;
|
|
1932
1943
|
|
|
1933
1944
|
class TestPromise extends _runtime.RSVP.Promise {
|
|
1934
|
-
constructor() {
|
|
1935
|
-
super(
|
|
1945
|
+
constructor(executor, label) {
|
|
1946
|
+
super(executor, label);
|
|
1936
1947
|
lastPromise = this;
|
|
1937
1948
|
}
|
|
1938
1949
|
|
|
1939
|
-
then(
|
|
1940
|
-
var
|
|
1941
|
-
|
|
1942
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1943
|
-
args[_key - 1] = arguments[_key];
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
return super.then(onFulfillment, ...args);
|
|
1950
|
+
then(onFulfilled, onRejected, label) {
|
|
1951
|
+
var normalizedOnFulfilled = typeof onFulfilled === 'function' ? result => isolate(onFulfilled, result) : undefined;
|
|
1952
|
+
return super.then(normalizedOnFulfilled, onRejected, label);
|
|
1947
1953
|
}
|
|
1948
1954
|
|
|
1949
1955
|
}
|
|
@@ -1995,10 +2001,10 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
|
|
|
1995
2001
|
// 3. Return the last promise created during method
|
|
1996
2002
|
|
|
1997
2003
|
|
|
1998
|
-
function isolate(
|
|
2004
|
+
function isolate(onFulfilled, result) {
|
|
1999
2005
|
// Reset lastPromise for nested helpers
|
|
2000
2006
|
lastPromise = null;
|
|
2001
|
-
var value =
|
|
2007
|
+
var value = onFulfilled(result);
|
|
2002
2008
|
var promise = lastPromise;
|
|
2003
2009
|
lastPromise = null; // If the method returned a promise
|
|
2004
2010
|
// return that promise. If not,
|
|
@@ -2042,55 +2048,25 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
|
|
2042
2048
|
*/
|
|
2043
2049
|
var contexts = [];
|
|
2044
2050
|
var callbacks = [];
|
|
2045
|
-
/**
|
|
2046
|
-
This allows ember-testing to play nicely with other asynchronous
|
|
2047
|
-
events, such as an application that is waiting for a CSS3
|
|
2048
|
-
transition or an IndexDB transaction. The waiter runs periodically
|
|
2049
|
-
after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
|
|
2050
|
-
until the returning result is truthy. After the waiters finish, the next async helper
|
|
2051
|
-
is executed and the process repeats.
|
|
2052
|
-
|
|
2053
|
-
For example:
|
|
2054
|
-
|
|
2055
|
-
```javascript
|
|
2056
|
-
import { registerWaiter } from '@ember/test';
|
|
2057
|
-
|
|
2058
|
-
registerWaiter(function() {
|
|
2059
|
-
return myPendingTransactions() === 0;
|
|
2060
|
-
});
|
|
2061
|
-
```
|
|
2062
|
-
The `context` argument allows you to optionally specify the `this`
|
|
2063
|
-
with which your callback will be invoked.
|
|
2064
|
-
|
|
2065
|
-
For example:
|
|
2066
|
-
|
|
2067
|
-
```javascript
|
|
2068
|
-
import { registerWaiter } from '@ember/test';
|
|
2069
|
-
|
|
2070
|
-
registerWaiter(MyDB, MyDB.hasPendingTransactions);
|
|
2071
|
-
```
|
|
2072
|
-
|
|
2073
|
-
@public
|
|
2074
|
-
@for @ember/test
|
|
2075
|
-
@static
|
|
2076
|
-
@method registerWaiter
|
|
2077
|
-
@param {Object} context (optional)
|
|
2078
|
-
@param {Function} callback
|
|
2079
|
-
@since 1.2.0
|
|
2080
|
-
*/
|
|
2081
2051
|
|
|
2082
|
-
function registerWaiter(
|
|
2052
|
+
function registerWaiter() {
|
|
2053
|
+
var checkedCallback;
|
|
2054
|
+
var checkedContext;
|
|
2055
|
+
|
|
2083
2056
|
if (arguments.length === 1) {
|
|
2084
|
-
|
|
2085
|
-
|
|
2057
|
+
checkedContext = null;
|
|
2058
|
+
checkedCallback = arguments.length <= 0 ? undefined : arguments[0];
|
|
2059
|
+
} else {
|
|
2060
|
+
checkedContext = arguments.length <= 0 ? undefined : arguments[0];
|
|
2061
|
+
checkedCallback = arguments.length <= 1 ? undefined : arguments[1];
|
|
2086
2062
|
}
|
|
2087
2063
|
|
|
2088
|
-
if (indexOf(
|
|
2064
|
+
if (indexOf(checkedContext, checkedCallback) > -1) {
|
|
2089
2065
|
return;
|
|
2090
2066
|
}
|
|
2091
2067
|
|
|
2092
|
-
contexts.push(
|
|
2093
|
-
callbacks.push(
|
|
2068
|
+
contexts.push(checkedContext);
|
|
2069
|
+
callbacks.push(checkedCallback);
|
|
2094
2070
|
}
|
|
2095
2071
|
/**
|
|
2096
2072
|
`unregisterWaiter` is used to unregister a callback that was
|
|
@@ -2147,7 +2123,7 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
|
|
2147
2123
|
|
|
2148
2124
|
for (var i = 0; i < callbacks.length; i++) {
|
|
2149
2125
|
var context = contexts[i];
|
|
2150
|
-
var callback = callbacks[i];
|
|
2126
|
+
var callback = callbacks[i]; // SAFETY: The loop ensures that this exists
|
|
2151
2127
|
|
|
2152
2128
|
if (!callback.call(context)) {
|
|
2153
2129
|
return true;
|