Skip to content

Commit b3c3e5a

Browse files
author
Simen Brekken
committed
Compare active params and query using normal equlity operators.
1 parent a783c0e commit b3c3e5a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

modules/mixins/ActiveDelegate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function routeIsActive(activeRoutes, routeName) {
99

1010
function paramsAreActive(activeParams, params) {
1111
for (var property in params) {
12-
if (activeParams[property] !== String(params[property]))
12+
if (activeParams[property] != params[property])
1313
return false;
1414
}
1515

@@ -18,7 +18,7 @@ function paramsAreActive(activeParams, params) {
1818

1919
function queryIsActive(activeQuery, query) {
2020
for (var property in query) {
21-
if (activeQuery[property] !== String(query[property]))
21+
if (activeQuery[property] != query[property])
2222
return false;
2323
}
2424

specs/ActiveDelegate.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,28 @@ describe('when a Route is active', function () {
4343
App({
4444
initialState: {
4545
activeRoutes: [ route ],
46-
activeParams: { id: '123', show: 'true' },
47-
activeQuery: { search: 'abc' }
46+
activeParams: { id: '123', show: 'true', variant: 456 },
47+
activeQuery: { search: 'abc', limit: 789 }
4848
}
4949
})
5050
);
5151
});
5252

5353
describe('and no query is used', function () {
5454
it('is active', function () {
55-
assert(app.isActive('products', { id: 123 }));
55+
assert(app.isActive('products', { id: 123, variant: '456' }));
5656
});
5757
});
5858

5959
describe('and a matching query is used', function () {
6060
it('is active', function () {
61-
assert(app.isActive('products', { id: 123 }, { search: 'abc' }));
61+
assert(app.isActive('products', { id: 123 }, { search: 'abc', limit: '789' }));
6262
});
6363
});
6464

6565
describe('but the query does not match', function () {
6666
it('is not active', function () {
67-
refute(app.isActive('products', { id: 123 }, { search: 'def' }));
67+
refute(app.isActive('products', { id: 123 }, { search: 'def', limit: '123' }));
6868
});
6969
});
7070
});

0 commit comments

Comments
 (0)