@@ -59,7 +59,31 @@ describe("UrlRouter", function () {
59
59
match = [ '/foo/bar' , $match ] ;
60
60
} ) . when ( '/bar' , function ( $match ) {
61
61
match = [ '/bar' , $match ] ;
62
- } ) ;
62
+ } ) . when ( '/' , function ( ) {
63
+ match = '/home' ;
64
+ } ) . when ( '/abc' , function ( ) {
65
+ match = '/abc/step1' ;
66
+ } ) . when ( '/abc' , function ( ) {
67
+ match = '/abc/step2' ;
68
+ } ) . when ( '/defg' , function ( ) {
69
+ match = '/defg' ;
70
+ } ) . when ( '/hij' , function ( ) {
71
+ match = '/hij/step1' ;
72
+ } ) . when ( '/hij' , function ( ) {
73
+ match = '/hij/step2' ;
74
+ } ) . when ( '/hij' , function ( ) {
75
+ match = '/hij/step3' ;
76
+ } ) . when ( '/hij' , function ( ) {
77
+ match = '/hij/step4' ;
78
+ } ) . when ( '/klmno' , function ( ) {
79
+ match = '/klmno/step1' ;
80
+ } ) . when ( '/klmno' , function ( ) {
81
+ match = '/klmno/step2' ;
82
+ } ) . when ( '/pqr' , function ( ) {
83
+ match = '/pqr/step1' ;
84
+ } ) . when ( '/pqr' , function ( ) {
85
+ match = '/pqr/step2' ; }
86
+ ) ;
63
87
} ) ;
64
88
65
89
module ( 'ui.router.router' , 'ui.router.router.test' ) ;
@@ -84,6 +108,12 @@ describe("UrlRouter", function () {
84
108
expect ( match [ 0 ] ) . toBe ( "/foo/:param" ) ;
85
109
expect ( match [ 1 ] ) . toEqual ( { param : 'baz' } ) ;
86
110
} ) ;
111
+
112
+ it ( 'should default to the first rule defined for same url' , function ( ) {
113
+ location . path ( '/hij' ) ;
114
+ scope . $emit ( '$locationChangeSuccess' ) ;
115
+ expect ( match ) . toBe ( '/hij/step1' ) ;
116
+ } ) ;
87
117
88
118
it ( "should execute rewrite rules" , function ( ) {
89
119
location . path ( "/foo" ) ;
@@ -261,4 +291,4 @@ describe("UrlRouter", function () {
261
291
} ) ;
262
292
} ) ;
263
293
264
- } ) ;
294
+ } ) ;
0 commit comments