-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 37 additions & 30 deletions
67
test-app/tests/acceptance/routeable-engine-demo-refresh-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,50 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit, find, click } from '@ember/test-helpers'; | ||
import { macroCondition, dependencySatisfies } from '@embroider/macros'; | ||
|
||
module('Acceptance | Engine Router Service | Refresh Method', function (hooks) { | ||
setupApplicationTest(hooks); | ||
if (macroCondition(dependencySatisfies('ember-source', '>= 4.1.0'))) { | ||
module( | ||
'Acceptance | Engine Router Service | Refresh Method', | ||
function (hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('refresh without params triggers refresh with current route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
test('refresh without params triggers refresh with current route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
|
||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh'); | ||
let counter = await find('.route-refresh-counter').textContent; | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.route-refresh-counter').hasText(counter); | ||
}); | ||
await click('.refresh'); | ||
|
||
test('refresh with params triggers refresh on provided route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.route-refresh-counter').hasText(counter); | ||
}); | ||
|
||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh-route'); | ||
test('refresh with params triggers refresh on provided route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.route-refresh-counter').hasText(counter); | ||
}); | ||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh-route'); | ||
|
||
test('refresh external route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.route-refresh-counter').hasText(counter); | ||
}); | ||
|
||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh-external'); | ||
test('refresh external route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.global-refresh-counter').hasText(counter); | ||
}); | ||
}); | ||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh-external'); | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.global-refresh-counter').hasText(counter); | ||
}); | ||
} | ||
); | ||
} |