@@ -6,8 +6,8 @@ import * as vanilla from "../src/vanilla"
6
6
describe ( 'browserHistory implementation' , ( ) => {
7
7
8
8
let router : UIRouter ;
9
+ let locationProvider ;
9
10
let makeMatcher ;
10
- let locationProvider = services . location ;
11
11
12
12
// Replace the `history` reference because PhantomJS does not support spying on it.
13
13
function mockHistoryObject ( ) {
@@ -26,6 +26,7 @@ describe('browserHistory implementation', () => {
26
26
router . plugin ( vanilla . servicesPlugin ) ;
27
27
router . plugin ( vanilla . pushStateLocationPlugin ) ;
28
28
router . stateRegistry . stateQueue . autoFlush ( router . stateService ) ;
29
+ locationProvider = router . urlService ;
29
30
makeMatcher = ( url , config ?) => {
30
31
return new UrlMatcher ( url , router . urlMatcherFactory . paramTypes , config )
31
32
} ;
@@ -38,7 +39,7 @@ describe('browserHistory implementation', () => {
38
39
39
40
it ( 'uses history.pushState when setting a url' , ( ) => {
40
41
let service = mockHistoryObject ( ) ;
41
- expect ( services . location . html5Mode ( ) ) . toBe ( true ) ;
42
+ expect ( router . urlService . html5Mode ( ) ) . toBe ( true ) ;
42
43
let stub = spyOn ( service . _history , 'pushState' ) ;
43
44
router . urlRouter . push ( makeMatcher ( '/hello/:name' ) , { name : 'world' } , { } ) ;
44
45
expect ( stub . calls . first ( ) . args [ 2 ] ) . toBe ( '/hello/world' ) ;
@@ -52,7 +53,7 @@ describe('browserHistory implementation', () => {
52
53
} ) ;
53
54
54
55
it ( 'returns the correct url query' , ( ) => {
55
- expect ( services . location . html5Mode ( ) ) . toBe ( true ) ;
56
+ expect ( router . urlService . html5Mode ( ) ) . toBe ( true ) ;
56
57
return router . stateService . go ( 'path' , { urlParam : 'bar' } ) . then ( ( ) => {
57
58
expect ( window . location . toString ( ) . includes ( '/path/bar' ) ) . toBe ( true ) ;
58
59
expect ( window . location . toString ( ) . includes ( '/#/path/bar' ) ) . toBe ( false ) ;
0 commit comments