Skip to content

Commit 5924af5

Browse files
committed
fix tests because of updated template
1 parent 7127f50 commit 5924af5

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

tests/acceptance/meta-data-test.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,27 @@ module('Acceptance | meta data', function(hooks) {
77

88
test('meta data title and description', async function(assert) {
99
await visit('/release/');
10-
await click('[data-test-toc-title="Routing"]')
11-
await click('[data-test-toc-link="Defining Your Routes"]')
1210

13-
assert.equal(currentURL(), '/release/routing/defining-your-routes');
11+
await click('[data-test-toc-link="Routing"]');
12+
assert.equal(currentURL(), '/release/routing');
13+
14+
// look up the og:title instead of title because testem modifies title https://github.com/testem/testem/issues/195
15+
assert.dom('head meta[property="og:title"]', document)
16+
.hasAttribute('content', 'Introduction - Routing - Ember Guides');
17+
assert.dom('head meta[name="description"]', document)
18+
.hasAttribute('content', 'Imagine we are writing a web app for managing a blog. At any given time, we should be able to answer questions like What post are they looking at? and Are they editing it? In Ember.js, the answer to these questions is determined by the URL. \n\nThe URL can be...');
1419

15-
// lookup title from service because testem modifies title https://github.com/testem/testem/issues/195
16-
let headData = this.owner.lookup('service:head-data');
17-
let title = headData.title;
1820

19-
let description = document.head.querySelector('meta[name="description"]');
21+
await click('[data-test-toc-link="Defining Your Routes"]');
22+
assert.equal(currentURL(), '/release/routing/defining-your-routes');
2023

21-
assert.ok(title);
22-
assert.ok(description);
24+
assert.dom('head meta[property="og:title"]', document)
25+
.hasAttribute('content', 'Defining Your Routes - Routing - Ember Guides');
26+
assert.dom('head meta[name="description"]', document)
27+
.hasAttribute('content', `When your application starts, the router matches the current URL to the routes that you've defined. The routes, in turn, are responsible for displaying templates, loading data, and setting up application state.
2328
24-
assert.equal(title,
25-
'Defining Your Routes - Routing - Ember Guides');
29+
To define a route, run
2630
27-
const descriptionStart = 'When your application starts, the router matches the current URL to the routes';
28-
assert.ok(description.content.startsWith(descriptionStart), `${description.content} should start with ${descriptionStart}`);
31+
ember generate...`);
2932
});
3033
});

tests/acceptance/table-of-contents-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module('Acceptance | table of contents', function(hooks) {
77

88
test('navigation by TOC', async function(assert) {
99
await visit('/v2.17.0/');
10-
await click('[data-test-toc-title="Routing"]')
10+
await click('[data-test-toc-link="Routing"]')
1111
await click('[data-test-toc-link="Defining Your Routes"]')
1212
assert.equal(currentURL(), '/v2.17.0/routing/defining-your-routes');
1313
});

tests/helpers/table-of-contents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function setupCustomAssertions(assert) {
3030
};
3131

3232
assert.areTitlesCorrect = (expectedTitles = []) => {
33-
const tocTitles = findAll('[data-test-toc-title]');
33+
const tocTitles = findAll('[data-test-toc-link]');
3434
const isLengthCorrect = tocTitles.length === expectedTitles.length;
3535

3636
assert.ok(

0 commit comments

Comments
 (0)