Skip to content

Commit bde3fef

Browse files
authored
Merge pull request #327 from kellyselden/rootUrl
baseline rootURL test before any changes.
2 parents 0ba40ab + 048e08c commit bde3fef

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

test/fastboot-location-test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('FastBootLocation', function () {
2626

2727
it('should NOT redirect when no transition is called', function () {
2828
return get({
29-
url: 'http://localhost:49741/test-passed',
29+
url: 'http://localhost:49741/my-root/test-passed',
3030
followRedirect: false
3131
})
3232
.then(function (response) {
@@ -35,15 +35,15 @@ describe('FastBootLocation', function () {
3535

3636
expect(response.headers).to.not.include.keys('location');
3737
expect(response.headers).to.include.keys('x-fastboot-path');
38-
expect(response.headers['x-fastboot-path']).to.equal('/test-passed');
38+
expect(response.headers['x-fastboot-path']).to.equal('/my-root/test-passed');
3939

4040
expect(response.body).to.contain('The Test Passed!');
4141
});
4242
});
4343

4444
it('should NOT redirect when intermediateTransitionTo is called', function () {
4545
return get({
46-
url: 'http://localhost:49741/redirect-on-intermediate-transition-to',
46+
url: 'http://localhost:49741/my-root/redirect-on-intermediate-transition-to',
4747
followRedirect: false
4848
})
4949
.then(function (response) {
@@ -52,7 +52,7 @@ describe('FastBootLocation', function () {
5252

5353
expect(response.headers).to.not.include.keys('location');
5454
expect(response.headers).to.include.keys('x-fastboot-path');
55-
expect(response.headers['x-fastboot-path']).to.equal('/redirect-on-intermediate-transition-to');
55+
expect(response.headers['x-fastboot-path']).to.equal('/my-root/redirect-on-intermediate-transition-to');
5656

5757
expect(response.body).to.not.contain('Welcome to Ember');
5858
expect(response.body).to.not.contain('The Test Passed!');
@@ -61,7 +61,7 @@ describe('FastBootLocation', function () {
6161

6262
it('should redirect when transitionTo is called', function () {
6363
return get({
64-
url: 'http://localhost:49741/redirect-on-transition-to',
64+
url: 'http://localhost:49741/my-root/redirect-on-transition-to',
6565
followRedirect: false
6666
})
6767
.then(function (response) {
@@ -73,14 +73,15 @@ describe('FastBootLocation', function () {
7373
'x-fastboot-path'
7474
]);
7575
expect(response.headers.location).to.equal('http://localhost:49741/test-passed');
76+
expect(response.headers['x-fastboot-path']).to.equal('/test-passed');
7677
expect(response.body).to.contain('Redirecting to');
7778
expect(response.body).to.contain('/test-passed');
7879
});
7980
});
8081

8182
it('should redirect when replaceWith is called', function () {
8283
return get({
83-
url: 'http://localhost:49741/redirect-on-replace-with',
84+
url: 'http://localhost:49741/my-root/redirect-on-replace-with',
8485
followRedirect: false
8586
})
8687
.then(function (response) {
@@ -92,6 +93,7 @@ describe('FastBootLocation', function () {
9293
'x-fastboot-path'
9394
]);
9495
expect(response.headers.location).to.equal('http://localhost:49741/test-passed');
96+
expect(response.headers['x-fastboot-path']).to.equal('/test-passed');
9597
expect(response.body).to.contain('Redirecting to');
9698
expect(response.body).to.contain('/test-passed');
9799
});

test/fixtures/fastboot-location/app/router.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import Ember from 'ember';
2+
import config from './config/environment';
23

3-
let Router = Ember.Router;
4+
const Router = Ember.Router.extend({
5+
location: config.locationType,
6+
rootURL: config.rootURL
7+
});
48

59
Router.map(function() {
610
this.route('redirect-on-intermediate-transition-to');

test/fixtures/fastboot-location/config/environment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = function(environment) {
44
var ENV = {
5-
baseUrl: '/',
5+
rootURL: '/my-root/',
66
environment: environment,
77
modulePrefix: 'fastboot-location',
88
fastboot: {

0 commit comments

Comments
 (0)