Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up Fastboot tests to use ember-cli-head #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fastboot-tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
env: {
node: true,
mocha: true
}
};
1 change: 0 additions & 1 deletion fastboot-tests/fixtures/fastboot/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Sane Document Title</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

Expand Down
8 changes: 7 additions & 1 deletion fastboot-tests/fixtures/fastboot/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import config from './config/environment';

const Router = Ember.Router.extend({
location: config.locationType,
rootURL: config.rootURL
rootURL: config.rootURL,

headData: Ember.inject.service(),

setTitle(title) {
this.get('headData').set('title', title);
}
});

Router.map(function() {
Expand Down
6 changes: 6 additions & 0 deletions fastboot-tests/fixtures/fastboot/app/templates/head.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{!--
Add content you wish automatically added to the documents head
here. The 'model' available in this template can be populated by
setting values on the 'head-data' service.
--}}
<title>{{model.title}}</title>
9 changes: 6 additions & 3 deletions fastboot-tests/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ const expect = require('chai').expect;
const setupTest = require('ember-fastboot-addon-tests').setupTest;

describe('index', function() {
setupTest('fastboot'/*, options */);
setupTest('fastboot', {
installPackages: {
"ember-cli-head": "^0.3.1"
}
});

it('renders', function() {
return this.visit('/')
.then(function(res) {
let $ = res.jQuery;
let response = res.response;

// add your real tests here
expect(response.statusCode).to.equal(200);
expect($('body').length).to.equal(1);
expect($('h1').text().trim()).to.equal('ember-fastboot-addon-tests');
expect($('title').text().trim()).to.equal('Sane Document Title');
expect($('title').text().trim()).to.equal('application - index');
});
});

Expand Down