ember-source 4.6.0-alpha.2 → 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/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +2 -2
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +110 -129
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +465 -525
- 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/metal/index.js +16 -6
- 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/engine/index.js +3 -1
- package/dist/packages/@ember/object/index.js +16 -8
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +1 -1
- 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 +9 -20
- 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 +268 -258
- package/package.json +3 -3
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.6.0-alpha.
|
|
9
|
+
* @version 4.6.0-alpha.3
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -868,30 +868,19 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
868
868
|
});
|
|
869
869
|
_exports.default = void 0;
|
|
870
870
|
|
|
871
|
-
|
|
872
|
-
@module @ember/test
|
|
873
|
-
*/
|
|
874
|
-
|
|
875
|
-
/**
|
|
876
|
-
The primary purpose of this class is to create hooks that can be implemented
|
|
877
|
-
by an adapter for various test frameworks.
|
|
878
|
-
|
|
879
|
-
@class TestAdapter
|
|
880
|
-
@public
|
|
881
|
-
*/
|
|
882
|
-
var _default = _runtime.Object.extend({
|
|
871
|
+
var Adapter = _runtime.Object.extend({
|
|
883
872
|
/**
|
|
884
873
|
This callback will be called whenever an async operation is about to start.
|
|
885
|
-
|
|
874
|
+
Override this to call your framework's methods that handle async
|
|
886
875
|
operations.
|
|
887
|
-
|
|
876
|
+
@public
|
|
888
877
|
@method asyncStart
|
|
889
878
|
*/
|
|
890
879
|
asyncStart() {},
|
|
891
880
|
|
|
892
881
|
/**
|
|
893
882
|
This callback will be called whenever an async operation has completed.
|
|
894
|
-
|
|
883
|
+
@public
|
|
895
884
|
@method asyncEnd
|
|
896
885
|
*/
|
|
897
886
|
asyncEnd() {},
|
|
@@ -900,13 +889,13 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
900
889
|
Override this method with your testing framework's false assertion.
|
|
901
890
|
This function is called whenever an exception occurs causing the testing
|
|
902
891
|
promise to fail.
|
|
903
|
-
|
|
904
|
-
|
|
892
|
+
QUnit example:
|
|
893
|
+
```javascript
|
|
905
894
|
exception: function(error) {
|
|
906
895
|
ok(false, error);
|
|
907
896
|
};
|
|
908
897
|
```
|
|
909
|
-
|
|
898
|
+
@public
|
|
910
899
|
@method exception
|
|
911
900
|
@param {String} error The exception to be raised.
|
|
912
901
|
*/
|
|
@@ -916,6 +905,7 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
916
905
|
|
|
917
906
|
});
|
|
918
907
|
|
|
908
|
+
var _default = Adapter;
|
|
919
909
|
_exports.default = _default;
|
|
920
910
|
});
|
|
921
911
|
define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils", "ember-testing/lib/adapters/adapter"], function (_exports, _utils, _adapter) {
|
|
@@ -927,27 +917,17 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
927
917
|
_exports.default = void 0;
|
|
928
918
|
|
|
929
919
|
/* globals QUnit */
|
|
920
|
+
function isVeryOldQunit(obj) {
|
|
921
|
+
return obj != null && typeof obj.stop === 'function';
|
|
922
|
+
}
|
|
930
923
|
|
|
931
|
-
|
|
932
|
-
@module ember
|
|
933
|
-
*/
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
This class implements the methods defined by TestAdapter for the
|
|
937
|
-
QUnit testing framework.
|
|
938
|
-
|
|
939
|
-
@class QUnitAdapter
|
|
940
|
-
@namespace Ember.Test
|
|
941
|
-
@extends TestAdapter
|
|
942
|
-
@public
|
|
943
|
-
*/
|
|
944
|
-
var _default = _adapter.default.extend({
|
|
924
|
+
var QUnitAdapter = _adapter.default.extend({
|
|
945
925
|
init() {
|
|
946
926
|
this.doneCallbacks = [];
|
|
947
927
|
},
|
|
948
928
|
|
|
949
929
|
asyncStart() {
|
|
950
|
-
if (
|
|
930
|
+
if (isVeryOldQunit(QUnit)) {
|
|
951
931
|
// very old QUnit version
|
|
952
932
|
// eslint-disable-next-line qunit/no-qunit-stop
|
|
953
933
|
QUnit.stop();
|
|
@@ -960,7 +940,7 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
960
940
|
// checking for QUnit.stop here (even though we _need_ QUnit.start) because
|
|
961
941
|
// QUnit.start() still exists in QUnit 2.x (it just throws an error when calling
|
|
962
942
|
// inside a test context)
|
|
963
|
-
if (
|
|
943
|
+
if (isVeryOldQunit(QUnit)) {
|
|
964
944
|
QUnit.start();
|
|
965
945
|
} else {
|
|
966
946
|
var done = this.doneCallbacks.pop(); // This can be null if asyncStart() was called outside of a test
|
|
@@ -977,9 +957,10 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
977
957
|
|
|
978
958
|
});
|
|
979
959
|
|
|
960
|
+
var _default = QUnitAdapter;
|
|
980
961
|
_exports.default = _default;
|
|
981
962
|
});
|
|
982
|
-
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) {
|
|
983
964
|
"use strict";
|
|
984
965
|
|
|
985
966
|
_application.default.reopen({
|
|
@@ -988,7 +969,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
988
969
|
are created once you call `injectTestHelpers` on your `Application`
|
|
989
970
|
instance. The included helpers are also available on the `window` object by
|
|
990
971
|
default, but can be used from this object on the individual application also.
|
|
991
|
-
|
|
972
|
+
@property testHelpers
|
|
992
973
|
@type {Object}
|
|
993
974
|
@default {}
|
|
994
975
|
@public
|
|
@@ -998,9 +979,9 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
998
979
|
/**
|
|
999
980
|
This property will contain the original methods that were registered
|
|
1000
981
|
on the `helperContainer` before `injectTestHelpers` is called.
|
|
1001
|
-
|
|
982
|
+
When `removeTestHelpers` is called, these methods are restored to the
|
|
1002
983
|
`helperContainer`.
|
|
1003
|
-
|
|
984
|
+
@property originalMethods
|
|
1004
985
|
@type {Object}
|
|
1005
986
|
@default {}
|
|
1006
987
|
@private
|
|
@@ -1012,7 +993,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1012
993
|
This property indicates whether or not this application is currently in
|
|
1013
994
|
testing mode. This is set when `setupForTesting` is called on the current
|
|
1014
995
|
application.
|
|
1015
|
-
|
|
996
|
+
@property testing
|
|
1016
997
|
@type {Boolean}
|
|
1017
998
|
@default false
|
|
1018
999
|
@since 1.3.0
|
|
@@ -1027,11 +1008,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1027
1008
|
(preventing both accidental leaking of state between tests and interference
|
|
1028
1009
|
with your testing framework). `setupForTesting` should only be called after
|
|
1029
1010
|
setting a custom `router` class (for example `App.Router = Router.extend(`).
|
|
1030
|
-
|
|
1031
|
-
|
|
1011
|
+
Example:
|
|
1012
|
+
```
|
|
1032
1013
|
App.setupForTesting();
|
|
1033
1014
|
```
|
|
1034
|
-
|
|
1015
|
+
@method setupForTesting
|
|
1035
1016
|
@public
|
|
1036
1017
|
*/
|
|
1037
1018
|
setupForTesting() {
|
|
@@ -1045,7 +1026,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1045
1026
|
/**
|
|
1046
1027
|
This will be used as the container to inject the test helpers into. By
|
|
1047
1028
|
default the helpers are injected into `window`.
|
|
1048
|
-
|
|
1029
|
+
@property helperContainer
|
|
1049
1030
|
@type {Object} The object to be used for test helpers.
|
|
1050
1031
|
@default window
|
|
1051
1032
|
@since 1.2.0
|
|
@@ -1059,13 +1040,13 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1059
1040
|
to `window`. If a function of the same name has already been defined it will be cached
|
|
1060
1041
|
(so that it can be reset if the helper is removed with `unregisterHelper` or
|
|
1061
1042
|
`removeTestHelpers`).
|
|
1062
|
-
|
|
1043
|
+
Any callbacks registered with `onInjectHelpers` will be called once the
|
|
1063
1044
|
helpers have been injected.
|
|
1064
|
-
|
|
1045
|
+
Example:
|
|
1065
1046
|
```
|
|
1066
1047
|
App.injectTestHelpers();
|
|
1067
1048
|
```
|
|
1068
|
-
|
|
1049
|
+
@method injectTestHelpers
|
|
1069
1050
|
@public
|
|
1070
1051
|
*/
|
|
1071
1052
|
injectTestHelpers(helperContainer) {
|
|
@@ -1086,8 +1067,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1086
1067
|
this.testHelpers = {};
|
|
1087
1068
|
|
|
1088
1069
|
for (var name in _helpers.helpers) {
|
|
1089
|
-
|
|
1090
|
-
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
|
+
|
|
1091
1075
|
protoWrap(_promise.default.prototype, name, helper(this, name), _helpers.helpers[name].meta.wait);
|
|
1092
1076
|
}
|
|
1093
1077
|
|
|
@@ -1097,11 +1081,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1097
1081
|
/**
|
|
1098
1082
|
This removes all helpers that have been registered, and resets and functions
|
|
1099
1083
|
that were overridden by the helpers.
|
|
1100
|
-
|
|
1101
|
-
|
|
1084
|
+
Example:
|
|
1085
|
+
```javascript
|
|
1102
1086
|
App.removeTestHelpers();
|
|
1103
1087
|
```
|
|
1104
|
-
|
|
1088
|
+
@public
|
|
1105
1089
|
@method removeTestHelpers
|
|
1106
1090
|
*/
|
|
1107
1091
|
removeTestHelpers() {
|
|
@@ -1110,7 +1094,8 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1110
1094
|
}
|
|
1111
1095
|
|
|
1112
1096
|
for (var name in _helpers.helpers) {
|
|
1113
|
-
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
|
+
|
|
1114
1099
|
delete _promise.default.prototype[name];
|
|
1115
1100
|
delete this.testHelpers[name];
|
|
1116
1101
|
delete this.originalMethods[name];
|
|
@@ -1123,6 +1108,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1123
1108
|
|
|
1124
1109
|
|
|
1125
1110
|
function protoWrap(proto, name, callback, isAsync) {
|
|
1111
|
+
// SAFETY: This isn't entirely safe, but it _seems_ to be ok.
|
|
1126
1112
|
proto[name] = function () {
|
|
1127
1113
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1128
1114
|
args[_key] = arguments[_key];
|
|
@@ -1131,6 +1117,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1131
1117
|
if (isAsync) {
|
|
1132
1118
|
return callback.apply(this, args);
|
|
1133
1119
|
} else {
|
|
1120
|
+
// SAFETY: This is not actually safe.
|
|
1134
1121
|
return this.then(function () {
|
|
1135
1122
|
return callback.apply(this, args);
|
|
1136
1123
|
});
|
|
@@ -1139,8 +1126,10 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
1139
1126
|
}
|
|
1140
1127
|
|
|
1141
1128
|
function helper(app, name) {
|
|
1142
|
-
var
|
|
1143
|
-
|
|
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;
|
|
1144
1133
|
|
|
1145
1134
|
if (!meta.wait) {
|
|
1146
1135
|
return function () {
|
|
@@ -1204,7 +1193,7 @@ define("ember-testing/lib/helpers", ["ember-testing/lib/test/helpers", "ember-te
|
|
|
1204
1193
|
(0, _helpers.registerHelper)('currentURL', _current_url.default);
|
|
1205
1194
|
(0, _helpers.registerHelper)('resumeTest', _pause_test.resumeTest);
|
|
1206
1195
|
});
|
|
1207
|
-
define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
|
1196
|
+
define("ember-testing/lib/helpers/and_then", ["exports", "@ember/debug"], function (_exports, _debug) {
|
|
1208
1197
|
"use strict";
|
|
1209
1198
|
|
|
1210
1199
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1213,10 +1202,12 @@ define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
|
|
1213
1202
|
_exports.default = andThen;
|
|
1214
1203
|
|
|
1215
1204
|
function andThen(app, callback) {
|
|
1216
|
-
|
|
1205
|
+
var wait = app.testHelpers['wait'];
|
|
1206
|
+
(true && !(wait) && (0, _debug.assert)('[BUG] Missing wait helper', wait));
|
|
1207
|
+
return wait(callback(app));
|
|
1217
1208
|
}
|
|
1218
1209
|
});
|
|
1219
|
-
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) {
|
|
1220
1211
|
"use strict";
|
|
1221
1212
|
|
|
1222
1213
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1247,12 +1238,15 @@ define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/
|
|
|
1247
1238
|
@public
|
|
1248
1239
|
*/
|
|
1249
1240
|
function currentPath(app) {
|
|
1241
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
1242
|
+
|
|
1250
1243
|
var routingService = app.__container__.lookup('service:-routing');
|
|
1251
1244
|
|
|
1245
|
+
(true && !(routingService instanceof _routing.RoutingService) && (0, _debug.assert)('[BUG] service:-routing is not a RoutingService', routingService instanceof _routing.RoutingService));
|
|
1252
1246
|
return (0, _metal.get)(routingService, 'currentPath');
|
|
1253
1247
|
}
|
|
1254
1248
|
});
|
|
1255
|
-
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) {
|
|
1256
1250
|
"use strict";
|
|
1257
1251
|
|
|
1258
1252
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1282,12 +1276,15 @@ define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-inte
|
|
|
1282
1276
|
@public
|
|
1283
1277
|
*/
|
|
1284
1278
|
function currentRouteName(app) {
|
|
1279
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
1280
|
+
|
|
1285
1281
|
var routingService = app.__container__.lookup('service:-routing');
|
|
1286
1282
|
|
|
1283
|
+
(true && !(routingService instanceof _routing.RoutingService) && (0, _debug.assert)('[BUG] service:-routing is not a RoutingService', routingService instanceof _routing.RoutingService));
|
|
1287
1284
|
return (0, _metal.get)(routingService, 'currentRouteName');
|
|
1288
1285
|
}
|
|
1289
1286
|
});
|
|
1290
|
-
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) {
|
|
1291
1288
|
"use strict";
|
|
1292
1289
|
|
|
1293
1290
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1318,9 +1315,14 @@ define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/m
|
|
|
1318
1315
|
@public
|
|
1319
1316
|
*/
|
|
1320
1317
|
function currentURL(app) {
|
|
1318
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
1319
|
+
|
|
1321
1320
|
var router = app.__container__.lookup('router:main');
|
|
1322
1321
|
|
|
1323
|
-
|
|
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();
|
|
1324
1326
|
}
|
|
1325
1327
|
});
|
|
1326
1328
|
define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/runtime", "@ember/debug"], function (_exports, _runtime, _debug) {
|
|
@@ -1395,7 +1397,7 @@ define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/ru
|
|
|
1395
1397
|
}, 'TestAdapter paused promise');
|
|
1396
1398
|
}
|
|
1397
1399
|
});
|
|
1398
|
-
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) {
|
|
1399
1401
|
"use strict";
|
|
1400
1402
|
|
|
1401
1403
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1422,18 +1424,24 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
|
|
|
1422
1424
|
@public
|
|
1423
1425
|
*/
|
|
1424
1426
|
function visit(app, url) {
|
|
1427
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] Missing container', app.__container__));
|
|
1428
|
+
|
|
1425
1429
|
var router = app.__container__.lookup('router:main');
|
|
1426
1430
|
|
|
1431
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] router:main is not a Router', router instanceof _router.default));
|
|
1427
1432
|
var shouldHandleURL = false;
|
|
1428
1433
|
app.boot().then(() => {
|
|
1434
|
+
(true && !(typeof router.location !== 'string') && (0, _debug.assert)('[BUG] router.location is still a string', typeof router.location !== 'string'));
|
|
1429
1435
|
router.location.setURL(url);
|
|
1430
1436
|
|
|
1431
1437
|
if (shouldHandleURL) {
|
|
1438
|
+
(true && !(app.__deprecatedInstance__) && (0, _debug.assert)("[BUG] __deprecatedInstance__ isn't set", app.__deprecatedInstance__));
|
|
1432
1439
|
(0, _runloop.run)(app.__deprecatedInstance__, 'handleURL', url);
|
|
1433
1440
|
}
|
|
1434
1441
|
});
|
|
1435
1442
|
|
|
1436
1443
|
if (app._readinessDeferrals > 0) {
|
|
1444
|
+
// SAFETY: This should be safe, though it is odd.
|
|
1437
1445
|
router.initialURL = url;
|
|
1438
1446
|
(0, _runloop.run)(app, 'advanceReadiness');
|
|
1439
1447
|
delete router.initialURL;
|
|
@@ -1441,10 +1449,12 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
|
|
|
1441
1449
|
shouldHandleURL = true;
|
|
1442
1450
|
}
|
|
1443
1451
|
|
|
1444
|
-
|
|
1452
|
+
var wait = app.testHelpers['wait'];
|
|
1453
|
+
(true && !(wait) && (0, _debug.assert)('[BUG] missing wait helper', wait));
|
|
1454
|
+
return wait();
|
|
1445
1455
|
}
|
|
1446
1456
|
});
|
|
1447
|
-
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) {
|
|
1448
1458
|
"use strict";
|
|
1449
1459
|
|
|
1450
1460
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -1488,8 +1498,11 @@ define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/wai
|
|
|
1488
1498
|
*/
|
|
1489
1499
|
function wait(app, value) {
|
|
1490
1500
|
return new _runtime.RSVP.Promise(function (resolve) {
|
|
1491
|
-
|
|
1501
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] Missing container', app.__container__));
|
|
1502
|
+
|
|
1503
|
+
var router = app.__container__.lookup('router:main');
|
|
1492
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
|
|
1493
1506
|
|
|
1494
1507
|
var watcher = setInterval(() => {
|
|
1495
1508
|
// 1. If the router is loading, keep polling
|
|
@@ -1525,9 +1538,9 @@ define("ember-testing/lib/initializers", ["@ember/application"], function (_appl
|
|
|
1525
1538
|
"use strict";
|
|
1526
1539
|
|
|
1527
1540
|
var name = 'deferReadiness in `testing` mode';
|
|
1528
|
-
(0, _application.onLoad)('Ember.Application', function (
|
|
1529
|
-
if (!
|
|
1530
|
-
|
|
1541
|
+
(0, _application.onLoad)('Ember.Application', function (ApplicationClass) {
|
|
1542
|
+
if (!ApplicationClass.initializers[name]) {
|
|
1543
|
+
ApplicationClass.initializer({
|
|
1531
1544
|
name: name,
|
|
1532
1545
|
|
|
1533
1546
|
initialize(application) {
|
|
@@ -1598,7 +1611,7 @@ define("ember-testing/lib/test", ["exports", "ember-testing/lib/test/helpers", "
|
|
|
1598
1611
|
var Test = {
|
|
1599
1612
|
/**
|
|
1600
1613
|
Hash containing all known test helpers.
|
|
1601
|
-
|
|
1614
|
+
@property _helpers
|
|
1602
1615
|
@private
|
|
1603
1616
|
@since 1.7.0
|
|
1604
1617
|
*/
|
|
@@ -1681,7 +1694,8 @@ define("ember-testing/lib/test/adapter", ["exports", "@ember/-internals/error-ha
|
|
|
1681
1694
|
}
|
|
1682
1695
|
|
|
1683
1696
|
function adapterDispatch(error) {
|
|
1684
|
-
adapter.exception(error);
|
|
1697
|
+
adapter.exception(error); // @ts-expect-error Normally unreachable
|
|
1698
|
+
|
|
1685
1699
|
console.error(error.stack); // eslint-disable-line no-console
|
|
1686
1700
|
}
|
|
1687
1701
|
});
|
|
@@ -1824,7 +1838,9 @@ define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/pro
|
|
|
1824
1838
|
|
|
1825
1839
|
|
|
1826
1840
|
function unregisterHelper(name) {
|
|
1827
|
-
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
|
+
|
|
1828
1844
|
delete _promise.default.prototype[name];
|
|
1829
1845
|
}
|
|
1830
1846
|
});
|
|
@@ -1873,8 +1889,8 @@ define("ember-testing/lib/test/on_inject_helpers", ["exports"], function (_expor
|
|
|
1873
1889
|
}
|
|
1874
1890
|
|
|
1875
1891
|
function invokeInjectHelpersCallbacks(app) {
|
|
1876
|
-
for (var
|
|
1877
|
-
|
|
1892
|
+
for (var callback of callbacks) {
|
|
1893
|
+
callback(app);
|
|
1878
1894
|
}
|
|
1879
1895
|
}
|
|
1880
1896
|
});
|
|
@@ -1923,22 +1939,17 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
|
|
|
1923
1939
|
_exports.getLastPromise = getLastPromise;
|
|
1924
1940
|
_exports.promise = promise;
|
|
1925
1941
|
_exports.resolve = resolve;
|
|
1926
|
-
var lastPromise;
|
|
1942
|
+
var lastPromise = null;
|
|
1927
1943
|
|
|
1928
1944
|
class TestPromise extends _runtime.RSVP.Promise {
|
|
1929
|
-
constructor() {
|
|
1930
|
-
super(
|
|
1945
|
+
constructor(executor, label) {
|
|
1946
|
+
super(executor, label);
|
|
1931
1947
|
lastPromise = this;
|
|
1932
1948
|
}
|
|
1933
1949
|
|
|
1934
|
-
then(
|
|
1935
|
-
var
|
|
1936
|
-
|
|
1937
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1938
|
-
args[_key - 1] = arguments[_key];
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
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);
|
|
1942
1953
|
}
|
|
1943
1954
|
|
|
1944
1955
|
}
|
|
@@ -1990,10 +2001,10 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
|
|
|
1990
2001
|
// 3. Return the last promise created during method
|
|
1991
2002
|
|
|
1992
2003
|
|
|
1993
|
-
function isolate(
|
|
2004
|
+
function isolate(onFulfilled, result) {
|
|
1994
2005
|
// Reset lastPromise for nested helpers
|
|
1995
2006
|
lastPromise = null;
|
|
1996
|
-
var value =
|
|
2007
|
+
var value = onFulfilled(result);
|
|
1997
2008
|
var promise = lastPromise;
|
|
1998
2009
|
lastPromise = null; // If the method returned a promise
|
|
1999
2010
|
// return that promise. If not,
|
|
@@ -2037,55 +2048,25 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
|
|
2037
2048
|
*/
|
|
2038
2049
|
var contexts = [];
|
|
2039
2050
|
var callbacks = [];
|
|
2040
|
-
/**
|
|
2041
|
-
This allows ember-testing to play nicely with other asynchronous
|
|
2042
|
-
events, such as an application that is waiting for a CSS3
|
|
2043
|
-
transition or an IndexDB transaction. The waiter runs periodically
|
|
2044
|
-
after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
|
|
2045
|
-
until the returning result is truthy. After the waiters finish, the next async helper
|
|
2046
|
-
is executed and the process repeats.
|
|
2047
|
-
|
|
2048
|
-
For example:
|
|
2049
|
-
|
|
2050
|
-
```javascript
|
|
2051
|
-
import { registerWaiter } from '@ember/test';
|
|
2052
|
-
|
|
2053
|
-
registerWaiter(function() {
|
|
2054
|
-
return myPendingTransactions() === 0;
|
|
2055
|
-
});
|
|
2056
|
-
```
|
|
2057
|
-
The `context` argument allows you to optionally specify the `this`
|
|
2058
|
-
with which your callback will be invoked.
|
|
2059
|
-
|
|
2060
|
-
For example:
|
|
2061
|
-
|
|
2062
|
-
```javascript
|
|
2063
|
-
import { registerWaiter } from '@ember/test';
|
|
2064
|
-
|
|
2065
|
-
registerWaiter(MyDB, MyDB.hasPendingTransactions);
|
|
2066
|
-
```
|
|
2067
|
-
|
|
2068
|
-
@public
|
|
2069
|
-
@for @ember/test
|
|
2070
|
-
@static
|
|
2071
|
-
@method registerWaiter
|
|
2072
|
-
@param {Object} context (optional)
|
|
2073
|
-
@param {Function} callback
|
|
2074
|
-
@since 1.2.0
|
|
2075
|
-
*/
|
|
2076
2051
|
|
|
2077
|
-
function registerWaiter(
|
|
2052
|
+
function registerWaiter() {
|
|
2053
|
+
var checkedCallback;
|
|
2054
|
+
var checkedContext;
|
|
2055
|
+
|
|
2078
2056
|
if (arguments.length === 1) {
|
|
2079
|
-
|
|
2080
|
-
|
|
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];
|
|
2081
2062
|
}
|
|
2082
2063
|
|
|
2083
|
-
if (indexOf(
|
|
2064
|
+
if (indexOf(checkedContext, checkedCallback) > -1) {
|
|
2084
2065
|
return;
|
|
2085
2066
|
}
|
|
2086
2067
|
|
|
2087
|
-
contexts.push(
|
|
2088
|
-
callbacks.push(
|
|
2068
|
+
contexts.push(checkedContext);
|
|
2069
|
+
callbacks.push(checkedCallback);
|
|
2089
2070
|
}
|
|
2090
2071
|
/**
|
|
2091
2072
|
`unregisterWaiter` is used to unregister a callback that was
|
|
@@ -2142,7 +2123,7 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
|
|
2142
2123
|
|
|
2143
2124
|
for (var i = 0; i < callbacks.length; i++) {
|
|
2144
2125
|
var context = contexts[i];
|
|
2145
|
-
var callback = callbacks[i];
|
|
2126
|
+
var callback = callbacks[i]; // SAFETY: The loop ensures that this exists
|
|
2146
2127
|
|
|
2147
2128
|
if (!callback.call(context)) {
|
|
2148
2129
|
return true;
|