From b3c3e5a77d6a4a401aac3c80ba7d84361169f752 Mon Sep 17 00:00:00 2001 From: Simen Brekken Date: Wed, 17 Sep 2014 11:13:30 +0200 Subject: [PATCH] Compare active params and query using normal equlity operators. --- modules/mixins/ActiveDelegate.js | 4 ++-- specs/ActiveDelegate.spec.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/mixins/ActiveDelegate.js b/modules/mixins/ActiveDelegate.js index b2ae3a5c44..4355d28d16 100644 --- a/modules/mixins/ActiveDelegate.js +++ b/modules/mixins/ActiveDelegate.js @@ -9,7 +9,7 @@ function routeIsActive(activeRoutes, routeName) { function paramsAreActive(activeParams, params) { for (var property in params) { - if (activeParams[property] !== String(params[property])) + if (activeParams[property] != params[property]) return false; } @@ -18,7 +18,7 @@ function paramsAreActive(activeParams, params) { function queryIsActive(activeQuery, query) { for (var property in query) { - if (activeQuery[property] !== String(query[property])) + if (activeQuery[property] != query[property]) return false; } diff --git a/specs/ActiveDelegate.spec.js b/specs/ActiveDelegate.spec.js index 5b690ab1f6..16ba1b25aa 100644 --- a/specs/ActiveDelegate.spec.js +++ b/specs/ActiveDelegate.spec.js @@ -43,8 +43,8 @@ describe('when a Route is active', function () { App({ initialState: { activeRoutes: [ route ], - activeParams: { id: '123', show: 'true' }, - activeQuery: { search: 'abc' } + activeParams: { id: '123', show: 'true', variant: 456 }, + activeQuery: { search: 'abc', limit: 789 } } }) ); @@ -52,19 +52,19 @@ describe('when a Route is active', function () { describe('and no query is used', function () { it('is active', function () { - assert(app.isActive('products', { id: 123 })); + assert(app.isActive('products', { id: 123, variant: '456' })); }); }); describe('and a matching query is used', function () { it('is active', function () { - assert(app.isActive('products', { id: 123 }, { search: 'abc' })); + assert(app.isActive('products', { id: 123 }, { search: 'abc', limit: '789' })); }); }); describe('but the query does not match', function () { it('is not active', function () { - refute(app.isActive('products', { id: 123 }, { search: 'def' })); + refute(app.isActive('products', { id: 123 }, { search: 'def', limit: '123' })); }); }); });