Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aklkv committed Nov 3, 2023
1 parent 30da677 commit 7a8e3df
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions test-app/tests/acceptance/routeable-engine-demo-refresh-test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { visit, find, click } from '@ember/test-helpers';
import { setupOnerror } from '@ember/test-helpers';
import { macroCondition, dependencySatisfies } from '@embroider/macros';

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');
assert.expect(1);

let counter = await find('.route-refresh-counter').textContent;
await click('.refresh');
await visit('/routable-engine-demo/ember-blog/new');

counter = parseInt(counter, 10);
counter = ++counter;
counter = counter.toString();
assert.dom('.route-refresh-counter').hasText(counter);
if (macroCondition(dependencySatisfies('ember-source', '>= 4.1.0'))) {
let counter = await find('.route-refresh-counter').textContent;
await click('.refresh');

counter = parseInt(counter, 10);
counter = ++counter;
counter = counter.toString();
assert.dom('.route-refresh-counter').hasText(counter);
} else {
setupOnerror(function (err) {
assert.ok(err);
});
}
});

test('refresh with params triggers refresh on provided route', async function (assert) {
Expand Down

0 comments on commit 7a8e3df

Please sign in to comment.