File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,22 @@ describe("UrlMatcher", function () {
163163 var m = new UrlMatcher ( '/users/:id/details/{type}/{repeat:[0-9]+}?from&to' ) ;
164164 expect ( m . exec ( '/users/123/details/what/thisShouldBeDigits' , { } ) ) . toBeNull ( ) ;
165165 } ) ;
166+
167+ it ( "should not use optional regexp for '/'" , function ( ) {
168+ var m = new UrlMatcher ( '/{language:(?:fr|en|de)}' ) ;
169+ expect ( m . exec ( '/' , { } ) ) . toBeNull ( ) ;
170+ } ) ;
171+
172+ it ( "should work with empty default value" , function ( ) {
173+ var m = new UrlMatcher ( '/foo/:str' , { params : { str : { value : "" } } } ) ;
174+ expect ( m . exec ( '/foo/' , { } ) ) . toEqual ( { str : "" } ) ;
175+ } ) ;
166176
177+ it ( "should work with empty default value for regex" , function ( ) {
178+ var m = new UrlMatcher ( '/foo/{param:(?:foo|bar|)}' , { params : { param : { value : "" } } } ) ;
179+ expect ( m . exec ( '/foo/' , { } ) ) . toEqual ( { param : "" } ) ;
180+ } ) ;
181+
167182 it ( "should treat the URL as already decoded and does not decode it further" , function ( ) {
168183 expect ( new UrlMatcher ( '/users/:id' ) . exec ( '/users/100%25' , { } ) ) . toEqual ( { id : '100%25' } ) ;
169184 } ) ;
You can’t perform that action at this time.
0 commit comments