Skip to content

Commit 9270832

Browse files
authored
Merge pull request #110 from cibernox/update-tests-to-new-style
Update tests to new QUnit syntax
2 parents 8189f34 + 4405256 commit 9270832

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

addon/components/docs-viewer/x-nav-item/template.hbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
{{#link-to route model
33
class='docs-viewer__nav-link'
44
activeClass='docs-viewer__nav-link--active'
5-
data-test-id='nav-item'}}
5+
data-test-id='nav-item'
6+
data-test-label=label}}
67
{{label}}
78
{{/link-to}}
89
{{else}}
910
{{#link-to route
1011
class='docs-viewer__nav-link'
1112
activeClass='docs-viewer__nav-link--active'
12-
data-test-id='nav-item'}}
13+
data-test-id='nav-item'
14+
data-test-label=label}}
1315
{{label}}
1416
{{/link-to}}
1517
{{/if}}
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import { test } from 'qunit';
2-
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance';
1+
import { module, test } from 'qunit';
2+
import { setupApplicationTest } from 'ember-qunit';
3+
import { visit, click, currentURL, find } from '@ember/test-helpers';
34

4-
moduleForAcceptance('Acceptance | Docs route test');
5+
module('Acceptance | Docs route test', function(hooks) {
6+
setupApplicationTest(hooks);
57

6-
test('the docs route renders', function(assert) {
7-
visit('/docs');
8+
test('the docs route renders', async function(assert) {
9+
await visit('/docs');
810

9-
andThen(function() {
1011
assert.equal(currentURL(), '/docs');
1112
});
12-
});
1313

14-
test('I can visit an autogenerated docs route', function(assert) {
15-
visit('/docs');
16-
click('[data-test-id="nav-item"]:contains({{docs-hero}})');
14+
test('I can visit an autogenerated docs route', async function(assert) {
15+
await visit('/docs');
16+
await click('[data-test-label="{{docs-hero}}"]');
1717

18-
andThen(function() {
19-
assert.ok(find('h1:contains(DocsHero)').length);
18+
assert.equal(find('h1').textContent.trim(), 'DocsHero');
2019
});
2120
});

0 commit comments

Comments
 (0)