@@ -84,6 +84,22 @@ it('optional', () => {
8484 checkRoutes ( arr , 3 )
8585} )
8686
87+ it ( 'redirect' , ( ) => {
88+ let arr = [ 1 , 2 , 3 ]
89+
90+ cy . visit ( '#/redirect' )
91+ checkRoutes ( arr )
92+
93+ cy . visit ( '#/redirect/route4' )
94+ checkRoutes ( arr , 1 )
95+
96+ cy . visit ( '#/redirect/route5' )
97+ checkRoutes ( arr , 2 )
98+
99+ cy . visit ( '#/redirect-whatever' )
100+ checkRoutes ( arr , 3 )
101+ } )
102+
87103it ( 'params' , ( ) => {
88104 let arr = [ 1 , 2 , 3 ]
89105 let checkProp = ( id , name , wildcard ) => {
@@ -109,6 +125,46 @@ it('params', () => {
109125 checkRoutes ( arr , 3 )
110126
111127 cy . visit ( '#/params/123' )
112- checkProp ( undefined , undefined , '/123' )
128+ checkProp ( null , null , '/123' )
113129 checkRoutes ( arr , 4 )
114130} )
131+
132+ it ( 'query' , ( ) => {
133+ let checkProp = ( id , name ) => {
134+ checkProperty ( 'id' , id )
135+ checkProperty ( 'name' , name )
136+ checkProperty ( 'whatever' )
137+ }
138+
139+ cy . visit ( '#/query?' )
140+ checkProp ( )
141+
142+ cy . visit ( '#/query?id=1' )
143+ checkProp ( 1 )
144+
145+ cy . visit ( '#/query?name=John' )
146+ checkProp ( null , 'John' )
147+
148+ cy . visit ( '#/query?id=1&name=John' )
149+ checkProp ( 1 , 'John' )
150+ } )
151+
152+ it ( 'active' , ( ) => {
153+ let arr = [ 1 , 2 , 3 ]
154+
155+ cy . visit ( '#/active' )
156+ checkProperty ( 'href' , '#/active' )
157+ checkRoutes ( arr )
158+
159+ cy . visit ( '#/active/route1' )
160+ checkProperty ( 'href' , '#/active/route1' )
161+ checkRoutes ( arr , 1 )
162+
163+ cy . visit ( '#/active/route2' )
164+ checkProperty ( 'href' , '#/active/route2' )
165+ checkRoutes ( arr , 2 )
166+
167+ cy . visit ( '#/active/route2/route3' )
168+ checkProperty ( 'href' , '#/active/route2/route3' )
169+ checkRoutes ( arr , 2 , 3 )
170+ } )
0 commit comments