@@ -1943,10 +1943,30 @@ describe('ngMock', function() {
1943
1943
) ;
1944
1944
they ( 'should ignore query param when matching in ' + routeShortcut + ' $prop method' , methods ,
1945
1945
function ( ) {
1946
- hb [ routeShortcut ] ( this , '/route/:id' ) . respond ( 'path' ) ;
1946
+ var paramsSpy = jasmine . createSpy ( 'paramsSpy' ) ;
1947
+ hb [ routeShortcut ] ( this , '/route/:id' ) . respond ( function ( method , url , data , headers , params ) {
1948
+ paramsSpy ( params ) ;
1949
+ // status, response, headers, statusText, xhrStatus
1950
+ return [ 200 , 'path' , { 'x-header' : 'foo' } , 'OK' , 'complete' ] ;
1951
+ } ) ;
1947
1952
hb ( this , '/route/123?q=str&foo=bar' , undefined , callback ) ;
1948
1953
hb . flush ( ) ;
1949
- expect ( callback ) . toHaveBeenCalledOnceWith ( 200 , 'path' , '' , '' , 'complete' ) ;
1954
+ expect ( callback ) . toHaveBeenCalledOnceWith ( 200 , 'path' , 'x-header: foo' , 'OK' , 'complete' ) ;
1955
+ expect ( paramsSpy ) . toHaveBeenCalledOnceWith ( { id : '123' , q : 'str' , foo : 'bar' } ) ;
1956
+ }
1957
+ ) ;
1958
+ they ( 'should ignore query param when matching eager parameters in ' + routeShortcut + ' $prop method' , methods ,
1959
+ function ( ) {
1960
+ var paramsSpy = jasmine . createSpy ( 'paramsSpy' ) ;
1961
+ hb [ routeShortcut ] ( this , '/route/:id*' ) . respond ( function ( method , url , data , headers , params ) {
1962
+ paramsSpy ( params ) ;
1963
+ // status, response, headers, statusText, xhrStatus
1964
+ return [ 200 , 'path' , { 'x-header' : 'foo' } , 'OK' , 'complete' ] ;
1965
+ } ) ;
1966
+ hb ( this , '/route/123/456?q=str&foo=bar' , undefined , callback ) ;
1967
+ hb . flush ( ) ;
1968
+ expect ( callback ) . toHaveBeenCalledOnceWith ( 200 , 'path' , 'x-header: foo' , 'OK' , 'complete' ) ;
1969
+ expect ( paramsSpy ) . toHaveBeenCalledOnceWith ( { id : '123/456' , q : 'str' , foo : 'bar' } ) ;
1950
1970
}
1951
1971
) ;
1952
1972
} ) ;
0 commit comments