From 04b9e0efd2fed267fd7a9f0f4d06437f818cb069 Mon Sep 17 00:00:00 2001 From: Ben Drucker Date: Sun, 3 Jul 2016 17:18:30 -0700 Subject: [PATCH] Add test coverage for disabling sheet-router history/href listeners --- tests/browser/routing.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/browser/routing.js b/tests/browser/routing.js index 23b5806..53daee6 100644 --- a/tests/browser/routing.js +++ b/tests/browser/routing.js @@ -109,4 +109,40 @@ test('routing', function (t) { return view`
${state.user}
` } }) + + t.test('disabling history', function (t) { + t.plan(1) + + const choo = proxyquire('../..', { + 'sheet-router/history': () => t.fail('history listener attached') + }) + + const app = choo() + + app.router('/', (route) => [ + route('/', function () { + t.pass('rendered') + }) + ]) + + app.start({history: false}) + }) + + t.test('disabling href', function (t) { + t.plan(1) + + const choo = proxyquire('../..', { + 'sheet-router/href': () => t.fail('href listener attached') + }) + + const app = choo() + + app.router('/', (route) => [ + route('/', function () { + t.pass('rendered') + }) + ]) + + app.start({href: false}) + }) })