Skip to content

Commit 9ac7af6

Browse files
author
Robert Jackson
authored
Merge pull request #799 from kiwiupover/head-content-test
Moving head-content test
2 parents 025040b + bd9740b commit 9ac7af6

10 files changed

Lines changed: 885 additions & 64 deletions

File tree

packages/ember-cli-fastboot/test/fixtures/head-content/app/routes/application.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/ember-cli-fastboot/test/head-content-test.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

test-packages/basic-app/app/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Router.map(function() {
1111
this.route('boom');
1212
this.route('imports');
1313
this.route('error-route');
14+
this.route('head-content');
1415
this.route('async-content');
1516
this.route('echo-request-headers');
1617
this.route('return-status-code-418');
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { set } from '@ember/object';
2+
import Route from '@ember/routing/route';
3+
import { inject as service } from '@ember/service';
4+
5+
export default class HeadContentRoute extends Route {
6+
@service headData;
7+
8+
afterModel() {
9+
set(this, 'headData.title', 'Go Sounders');
10+
}
11+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{head-layout}}
2+
13
<h1>Basic fastboot ember app</h1>
24

3-
{{outlet}}
5+
{{outlet}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{outlet}}

packages/ember-cli-fastboot/test/fixtures/head-content/app/templates/head.hbs renamed to test-packages/basic-app/app/templates/head.hbs

File renamed without changes.

test-packages/basic-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"ember-cli-babel": "^7.20.5",
4141
"ember-cli-dependency-checker": "^3.2.0",
4242
"ember-cli-fastboot": "3.0.0-beta.2",
43+
"ember-cli-head": "^1.0.0",
4344
"ember-cli-htmlbars": "^5.1.2",
4445
"ember-cli-inject-live-reload": "^2.0.2",
4546
"ember-cli-sri": "^2.1.1",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
3+
const RSVP = require('rsvp');
4+
const request = RSVP.denodeify(require('request'));
5+
const expect = require('chai').use(require('chai-string')).expect;
6+
const { startServer, stopServer } = require('../../test-libs');
7+
8+
describe('head content acceptance', function() {
9+
this.timeout(100000);
10+
11+
before(function() {
12+
return startServer();
13+
});
14+
15+
after(function() {
16+
return stopServer();
17+
});
18+
19+
it('has head content replaced`', async () => {
20+
const response = await request({
21+
url: `http://localhost:45678/head-content`,
22+
headers: {
23+
'Accept': 'text/html'
24+
}
25+
});
26+
27+
expect(response.statusCode).to.equal(200);
28+
expect(response.headers["content-type"]).to.equalIgnoreCase("text/html; charset=utf-8");
29+
expect(response.body).to.contain('<meta property="og:title" content="Go Sounders">');
30+
expect(response.body).to.not.contain('<!-- EMBER_CLI_FASTBOOT_HEAD -->');
31+
});
32+
});

0 commit comments

Comments
 (0)