@@ -13,16 +13,16 @@ import {
1313} from 'angular2/testing_internal' ;
1414
1515import { Injector , provide } from 'angular2/core' ;
16- import { CONST_EXPR } from 'angular2/src/facade/lang' ;
1716
1817import { PlatformLocation } from 'angular2/src/router/platform_location' ;
19- import { LocationStrategy , APP_BASE_HREF } from 'angular2/src/router/location_strategy' ;
18+ import { APP_BASE_HREF } from 'angular2/src/router/location_strategy' ;
2019import { HashLocationStrategy } from 'angular2/src/router/hash_location_strategy' ;
2120import { SpyPlatformLocation } from './spies' ;
2221
2322export function main ( ) {
2423 describe ( 'HashLocationStrategy' , ( ) => {
25- var platformLocation , locationStrategy ;
24+ var platformLocation : SpyPlatformLocation ;
25+ var locationStrategy : HashLocationStrategy ;
2626
2727 beforeEachProviders (
2828 ( ) => [ HashLocationStrategy , provide ( PlatformLocation , { useClass : SpyPlatformLocation } ) ] ) ;
@@ -163,5 +163,25 @@ export function main() {
163163 expect ( platformLocation . spy ( 'pushState' ) ) . toHaveBeenCalledWith ( null , 'Title' , '#/app/' ) ;
164164 } ) ;
165165 } ) ;
166+
167+ describe ( 'hashLocationStrategy bugs' , ( ) => {
168+ beforeEach ( inject ( [ PlatformLocation , HashLocationStrategy ] , ( pl , ls ) => {
169+ platformLocation = pl ;
170+ locationStrategy = ls ;
171+ platformLocation . spy ( 'pushState' ) ;
172+ platformLocation . pathname = '' ;
173+ } ) ) ;
174+
175+ it ( 'should not include platform search' , ( ) => {
176+ platformLocation . search = '?donotinclude' ;
177+ expect ( locationStrategy . path ( ) ) . toEqual ( '' ) ;
178+ } ) ;
179+
180+ it ( 'should not include platform search even with hash' , ( ) => {
181+ platformLocation . hash = '#hashPath' ;
182+ platformLocation . search = '?donotinclude' ;
183+ expect ( locationStrategy . path ( ) ) . toEqual ( 'hashPath' ) ;
184+ } ) ;
185+ } ) ;
166186 } ) ;
167187}
0 commit comments