diff --git a/addon/components/docs-viewer/x-nav-item/template.hbs b/addon/components/docs-viewer/x-nav-item/template.hbs index 5d790bd03..7d411768e 100644 --- a/addon/components/docs-viewer/x-nav-item/template.hbs +++ b/addon/components/docs-viewer/x-nav-item/template.hbs @@ -2,14 +2,16 @@ {{#link-to route model class='docs-viewer__nav-link' activeClass='docs-viewer__nav-link--active' - data-test-id='nav-item'}} + data-test-id='nav-item' + data-test-label=label}} {{label}} {{/link-to}} {{else}} {{#link-to route class='docs-viewer__nav-link' activeClass='docs-viewer__nav-link--active' - data-test-id='nav-item'}} + data-test-id='nav-item' + data-test-label=label}} {{label}} {{/link-to}} {{/if}} diff --git a/tests/acceptance/docs-route-test.js b/tests/acceptance/docs-route-test.js index fa9ad1625..2fbd9da86 100644 --- a/tests/acceptance/docs-route-test.js +++ b/tests/acceptance/docs-route-test.js @@ -1,21 +1,20 @@ -import { test } from 'qunit'; -import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; +import { module, test } from 'qunit'; +import { setupApplicationTest } from 'ember-qunit'; +import { visit, click, currentURL, find } from '@ember/test-helpers'; -moduleForAcceptance('Acceptance | Docs route test'); +module('Acceptance | Docs route test', function(hooks) { + setupApplicationTest(hooks); -test('the docs route renders', function(assert) { - visit('/docs'); + test('the docs route renders', async function(assert) { + await visit('/docs'); - andThen(function() { assert.equal(currentURL(), '/docs'); }); -}); -test('I can visit an autogenerated docs route', function(assert) { - visit('/docs'); - click('[data-test-id="nav-item"]:contains({{docs-hero}})'); + test('I can visit an autogenerated docs route', async function(assert) { + await visit('/docs'); + await click('[data-test-label="{{docs-hero}}"]'); - andThen(function() { - assert.ok(find('h1:contains(DocsHero)').length); + assert.equal(find('h1').textContent.trim(), 'DocsHero'); }); });