File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import createHistory from 'history/lib/createMemoryHistory'
5
5
import IndexRoute from '../IndexRoute'
6
6
import Router from '../Router'
7
7
import Route from '../Route'
8
+ import qs from 'qs'
8
9
9
10
describe ( 'isActive' , function ( ) {
10
11
@@ -106,6 +107,27 @@ describe('isActive', function () {
106
107
} )
107
108
} )
108
109
} )
110
+
111
+ describe ( 'with a custom parse function and a query that does not match' , function ( ) {
112
+ it ( 'is not active' , function ( done ) {
113
+ function stringifyQuery ( params ) {
114
+ return qs . stringify ( params , { arrayFormat : 'indices' } )
115
+ }
116
+ function parseQueryString ( query ) {
117
+ return qs . parse ( query , { arrayLimit : 0 } )
118
+ }
119
+
120
+ React . render ( (
121
+ < Router history = { createHistory ( '/home?foo[4]=bar' ) } stringifyQuery = { stringifyQuery } parseQueryString = { parseQueryString } >
122
+ < Route path = "/" />
123
+ < Route path = "/home" />
124
+ </ Router >
125
+ ) , node , function ( ) {
126
+ expect ( this . history . isActive ( '/home' , { foo : { 1 : 'bar' } } ) ) . toBe ( false )
127
+ done ( )
128
+ } )
129
+ } )
130
+ } )
109
131
} )
110
132
111
133
describe ( 'a pathname that matches an index URL' , function ( ) {
Original file line number Diff line number Diff line change 51
51
"karma-sourcemap-loader" : " ^0.3.5" ,
52
52
"karma-webpack" : " ^1.7.0" ,
53
53
"mocha" : " ^2.0.1" ,
54
+ "qs" : " ^4.0.0" ,
54
55
"react" : " 0.13.x" ,
55
56
"rf-changelog" : " ^0.4.0" ,
56
57
"style-loader" : " ^0.12.4" ,
You can’t perform that action at this time.
0 commit comments