|
1 | 1 | import { module, test } from 'qunit';
|
2 | 2 | import { setupApplicationTest } from 'ember-qunit';
|
3 | 3 | import { visit, find, click } from '@ember/test-helpers';
|
| 4 | +import { setupOnerror } from '@ember/test-helpers'; |
| 5 | +import { macroCondition, dependencySatisfies } from '@embroider/macros'; |
4 | 6 |
|
5 | 7 | module('Acceptance | Engine Router Service | Refresh Method', function (hooks) {
|
6 | 8 | setupApplicationTest(hooks);
|
7 | 9 |
|
8 | 10 | test('refresh without params triggers refresh with current route', async function (assert) {
|
9 | 11 | await visit('/routable-engine-demo/ember-blog/new');
|
10 | 12 |
|
11 |
| - let counter = await find('.route-refresh-counter').textContent; |
12 |
| - await click('.refresh'); |
13 |
| - |
14 |
| - counter = parseInt(counter, 10); |
15 |
| - counter = ++counter; |
16 |
| - counter = counter.toString(); |
17 |
| - assert.dom('.route-refresh-counter').hasText(counter); |
| 13 | + if (macroCondition(dependencySatisfies('ember-source', '>= 4.1.0'))) { |
| 14 | + let counter = await find('.route-refresh-counter').textContent; |
| 15 | + await click('.refresh'); |
| 16 | + |
| 17 | + counter = parseInt(counter, 10); |
| 18 | + counter = ++counter; |
| 19 | + counter = counter.toString(); |
| 20 | + assert.dom('.route-refresh-counter').hasText(counter); |
| 21 | + } else { |
| 22 | + setupOnerror(function (err) { |
| 23 | + assert.ok(err); |
| 24 | + }); |
| 25 | + } |
18 | 26 | });
|
19 | 27 |
|
20 | 28 | test('refresh with params triggers refresh on provided route', async function (assert) {
|
|
0 commit comments