Skip to content

Commit

Permalink
Dynamic Routing Beta: Render default.hbs as fallback for static routes
Browse files Browse the repository at this point in the history
refs refs #9601

- instead of index.hbs (that doesn't make sense)
  • Loading branch information
kirrg001 committed Jun 24, 2018
1 parent c2fa469 commit 07c72d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion core/server/services/routing/StaticRoutesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class StaticRoutesRouter extends ParentRouter {

res._route = {
type: 'custom',
templates: this.templates
templates: this.templates,
defaultTemplate: 'default'
};

next();
Expand Down
8 changes: 3 additions & 5 deletions core/test/integration/web/site_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ describe('Integration - Web - Site', function () {
sandbox.restore();
});

it('serve home', function () {
it('serve static route', function () {
const req = {
secure: true,
method: 'GET',
Expand All @@ -486,9 +486,7 @@ describe('Integration - Web - Site', function () {
return testUtils.mocks.express.invoke(app, req)
.then(function (response) {
response.statusCode.should.eql(200);

// falls back to index, because Casper has no home.hbs
response.template.should.eql('index');
response.template.should.eql('default');
});
});

Expand Down Expand Up @@ -604,7 +602,7 @@ describe('Integration - Web - Site', function () {
return testUtils.mocks.express.invoke(app, req)
.then(function (response) {
response.statusCode.should.eql(200);
response.template.should.eql('index');
response.template.should.eql('default');
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion core/test/unit/services/routing/StaticRoutesRouter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ describe('UNIT - services/routing/StaticRoutesRouter', function () {
next.called.should.be.true();
res._route.should.eql({
type: 'custom',
templates: []
templates: [],
defaultTemplate: 'default'
});

res.locals.routerOptions.should.eql({context: [], data: {}});
Expand Down

0 comments on commit 07c72d7

Please sign in to comment.