From 07c72d735e8326be8aa633239b7fb782dba17ba6 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Sun, 24 Jun 2018 00:32:09 +0200 Subject: [PATCH] Dynamic Routing Beta: Render default.hbs as fallback for static routes refs refs #9601 - instead of index.hbs (that doesn't make sense) --- core/server/services/routing/StaticRoutesRouter.js | 3 ++- core/test/integration/web/site_spec.js | 8 +++----- .../test/unit/services/routing/StaticRoutesRouter_spec.js | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/server/services/routing/StaticRoutesRouter.js b/core/server/services/routing/StaticRoutesRouter.js index 4488650c71..eb7857bd74 100644 --- a/core/server/services/routing/StaticRoutesRouter.js +++ b/core/server/services/routing/StaticRoutesRouter.js @@ -81,7 +81,8 @@ class StaticRoutesRouter extends ParentRouter { res._route = { type: 'custom', - templates: this.templates + templates: this.templates, + defaultTemplate: 'default' }; next(); diff --git a/core/test/integration/web/site_spec.js b/core/test/integration/web/site_spec.js index 1db4148f72..a2a79bf9a6 100644 --- a/core/test/integration/web/site_spec.js +++ b/core/test/integration/web/site_spec.js @@ -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', @@ -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'); }); }); @@ -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'); }); }); }); diff --git a/core/test/unit/services/routing/StaticRoutesRouter_spec.js b/core/test/unit/services/routing/StaticRoutesRouter_spec.js index 0922175ff6..0f46ce1920 100644 --- a/core/test/unit/services/routing/StaticRoutesRouter_spec.js +++ b/core/test/unit/services/routing/StaticRoutesRouter_spec.js @@ -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: {}});