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.
Files changed (37) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/ember-template-compiler.js +2 -2
  3. package/dist/ember-template-compiler.map +1 -1
  4. package/dist/ember-testing.js +110 -129
  5. package/dist/ember-testing.map +1 -1
  6. package/dist/ember.debug.js +465 -525
  7. package/dist/ember.debug.map +1 -1
  8. package/dist/header/license.js +1 -1
  9. package/dist/packages/@ember/-internals/error-handling/index.js +1 -1
  10. package/dist/packages/@ember/-internals/metal/index.js +16 -6
  11. package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -3
  12. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +281 -368
  13. package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -5
  14. package/dist/packages/@ember/application/lib/application.js +4 -1
  15. package/dist/packages/@ember/engine/index.js +3 -1
  16. package/dist/packages/@ember/object/index.js +16 -8
  17. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +1 -1
  18. package/dist/packages/@ember/test/adapter.js +2 -2
  19. package/dist/packages/ember/version.js +1 -1
  20. package/dist/packages/ember-testing/lib/adapters/adapter.js +9 -20
  21. package/dist/packages/ember-testing/lib/adapters/qunit.js +8 -16
  22. package/dist/packages/ember-testing/lib/ext/application.js +28 -19
  23. package/dist/packages/ember-testing/lib/helpers/and_then.js +4 -1
  24. package/dist/packages/ember-testing/lib/helpers/current_path.js +5 -0
  25. package/dist/packages/ember-testing/lib/helpers/current_route_name.js +5 -0
  26. package/dist/packages/ember-testing/lib/helpers/current_url.js +8 -1
  27. package/dist/packages/ember-testing/lib/helpers/visit.js +12 -2
  28. package/dist/packages/ember-testing/lib/helpers/wait.js +6 -1
  29. package/dist/packages/ember-testing/lib/initializers.js +3 -3
  30. package/dist/packages/ember-testing/lib/test/adapter.js +2 -1
  31. package/dist/packages/ember-testing/lib/test/helpers.js +3 -1
  32. package/dist/packages/ember-testing/lib/test/on_inject_helpers.js +2 -2
  33. package/dist/packages/ember-testing/lib/test/promise.js +8 -8
  34. package/dist/packages/ember-testing/lib/test/waiters.js +14 -45
  35. package/dist/packages/ember-testing/lib/test.js +1 -1
  36. package/docs/data.json +268 -258
  37. package/package.json +3 -3
@@ -3,55 +3,24 @@
3
3
  */
4
4
  const contexts = [];
5
5
  const callbacks = [];
6
- /**
7
- This allows ember-testing to play nicely with other asynchronous
8
- events, such as an application that is waiting for a CSS3
9
- transition or an IndexDB transaction. The waiter runs periodically
10
- after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
11
- until the returning result is truthy. After the waiters finish, the next async helper
12
- is executed and the process repeats.
13
-
14
- For example:
15
-
16
- ```javascript
17
- import { registerWaiter } from '@ember/test';
18
-
19
- registerWaiter(function() {
20
- return myPendingTransactions() === 0;
21
- });
22
- ```
23
- The `context` argument allows you to optionally specify the `this`
24
- with which your callback will be invoked.
25
-
26
- For example:
27
-
28
- ```javascript
29
- import { registerWaiter } from '@ember/test';
30
-
31
- registerWaiter(MyDB, MyDB.hasPendingTransactions);
32
- ```
33
-
34
- @public
35
- @for @ember/test
36
- @static
37
- @method registerWaiter
38
- @param {Object} context (optional)
39
- @param {Function} callback
40
- @since 1.2.0
41
- */
42
-
43
- export function registerWaiter(context, callback) {
44
- if (arguments.length === 1) {
45
- callback = context;
46
- context = null;
6
+ export function registerWaiter(...args) {
7
+ let checkedCallback;
8
+ let checkedContext;
9
+
10
+ if (args.length === 1) {
11
+ checkedContext = null;
12
+ checkedCallback = args[0];
13
+ } else {
14
+ checkedContext = args[0];
15
+ checkedCallback = args[1];
47
16
  }
48
17
 
49
- if (indexOf(context, callback) > -1) {
18
+ if (indexOf(checkedContext, checkedCallback) > -1) {
50
19
  return;
51
20
  }
52
21
 
53
- contexts.push(context);
54
- callbacks.push(callback);
22
+ contexts.push(checkedContext);
23
+ callbacks.push(checkedCallback);
55
24
  }
56
25
  /**
57
26
  `unregisterWaiter` is used to unregister a callback that was
@@ -106,7 +75,7 @@ export function checkWaiters() {
106
75
 
107
76
  for (let i = 0; i < callbacks.length; i++) {
108
77
  let context = contexts[i];
109
- let callback = callbacks[i];
78
+ let callback = callbacks[i]; // SAFETY: The loop ensures that this exists
110
79
 
111
80
  if (!callback.call(context)) {
112
81
  return true;
@@ -22,7 +22,7 @@ import { getAdapter, setAdapter } from './test/adapter';
22
22
  const Test = {
23
23
  /**
24
24
  Hash containing all known test helpers.
25
- @property _helpers
25
+ @property _helpers
26
26
  @private
27
27
  @since 1.7.0
28
28
  */