Converting tests to use settled vs. routeSettled
MODIFY
addon/index.js
addon/index.js
export {
- setupRouter,
- reset,
beginTransition,
endTransition,
- didTransition,
routeSettled,
+ setupRouter,
+ reset,
+ didTransition,
whenRoutePainted,
whenRouteIdle,
TRANSITION_INTERUPTED,

MODIFY
tests/acceptance/deferred-render-test.js
tests/acceptance/deferred-render-test.js
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { visit, currentRouteName } from '@ember/test-helpers';
-import { setupRouter, reset, routeSettled } from 'ember-app-scheduler';
+import { setupRouter, reset } from 'ember-app-scheduler';
module('Acceptance | when rendered tests', function(hooks) {
setupApplicationTest(hooks);
@@ -23,8 +23,6 @@ module('Acceptance | when rendered tests', function(hooks) {
assert.equal(currentRouteName(), 'first-paint');
assert.dom('.only-when-route-painted').exists();
-
- await routeSettled();
});
test('visiting route renders deferred content via whenRouteIdle', async function(assert) {
@@ -34,8 +32,6 @@ module('Acceptance | when rendered tests', function(hooks) {
assert.equal(currentRouteName(), 'content-paint');
assert.dom('.only-when-route-idle').exists();
-
- await routeSettled();
});
test('visiting a route and immediately transitioning correctly aborts current transition', async function(assert) {
@@ -45,7 +41,5 @@ module('Acceptance | when rendered tests', function(hooks) {
assert.equal(currentRouteName(), 'first-paint');
assert.dom('.only-when-route-painted').exists();
-
- await routeSettled();
});
});

MODIFY
tests/integration/deferred-render-in-component-test.js
tests/integration/deferred-render-in-component-test.js
@@ -2,13 +2,12 @@ import { module, test } from 'qunit';
import Component from '@ember/component';
import hbs from 'htmlbars-inline-precompile';
import { setupRenderingTest } from 'ember-qunit';
-import { render, find, waitFor } from '@ember/test-helpers';
+import { render, find, waitFor, settled } from '@ember/test-helpers';
import {
beginTransition,
endTransition,
whenRoutePainted,
whenRouteIdle,
- routeSettled,
} from 'ember-app-scheduler';
module('Integration | Component | when rendered in component', function(hooks) {
@@ -73,7 +72,7 @@ module('Integration | Component | when rendered in component', function(hooks) {
assert.isVisible(foo);
- await routeSettled();
+ await settled();
});
test('deferred element is visible following whenRouteIdle', async function(assert) {
@@ -100,6 +99,6 @@ module('Integration | Component | when rendered in component', function(hooks) {
assert.isVisible(foo);
- await routeSettled();
+ await settled();
});
});

Converting tests to use settled vs. routeSettled