1
- import { StateBuilder , StateMatcher , ng1ViewsBuilder , extend } from " ../src/index" ;
2
- import { Resolvable } from " @uirouter/core" ;
1
+ import { StateBuilder , StateMatcher , ng1ViewsBuilder , extend } from ' ../src/index' ;
2
+ import { Resolvable } from ' @uirouter/core' ;
3
3
declare var inject ;
4
4
5
5
describe ( 'Ng1 StateBuilder' , function ( ) {
6
- var parent = { name : "" } ;
7
- var builder , matcher , urlMatcherFactoryProvider : any = {
6
+ const parent = { name : '' } ;
7
+ let builder , matcher , urlMatcherFactoryProvider : any = {
8
8
compile : function ( ) { } ,
9
- isMatcher : function ( ) { }
9
+ isMatcher : function ( ) { } ,
10
10
} ;
11
11
12
12
beforeEach ( function ( ) {
@@ -16,32 +16,32 @@ describe('Ng1 StateBuilder', function() {
16
16
} ) ;
17
17
18
18
it ( 'should use the state object to build a default view, when no `views` property is found' , function ( ) {
19
- var config = { url : " /foo" , templateUrl : " /foo.html" , controller : " FooController" , parent : parent } ;
20
- var built = builder . builder ( 'views' ) ( config ) ;
19
+ const config = { url : ' /foo' , templateUrl : ' /foo.html' , controller : ' FooController' , parent : parent } ;
20
+ const built = builder . builder ( 'views' ) ( config ) ;
21
21
22
22
expect ( built . $default ) . not . toEqualData ( config ) ;
23
- expect ( built . $default ) . toEqualData ( { templateUrl : " /foo.html" , controller : " FooController" , resolveAs : '$resolve' } ) ;
23
+ expect ( built . $default ) . toEqualData ( { templateUrl : ' /foo.html' , controller : ' FooController' , resolveAs : '$resolve' } ) ;
24
24
} ) ;
25
25
26
26
it ( 'It should use the views object to build views, when defined' , function ( ) {
27
- var config = { a : { foo : " bar" , controller : " FooController" } } ;
28
- let builtViews = builder . builder ( 'views' ) ( { parent : parent , views : config } ) ;
27
+ const config = { a : { foo : ' bar' , controller : ' FooController' } } ;
28
+ const builtViews = builder . builder ( 'views' ) ( { parent : parent , views : config } ) ;
29
29
expect ( builtViews . a . foo ) . toEqualData ( config . a . foo ) ;
30
30
expect ( builtViews . a . controller ) . toEqualData ( config . a . controller ) ;
31
31
} ) ;
32
32
33
- it ( " should not allow a view config with both component and template keys" , inject ( function ( $injector ) {
34
- var config = { name : " foo" , url : " /foo" , template : " <h1>hey</h1>" , controller : " FooController" , parent : parent } ;
33
+ it ( ' should not allow a view config with both component and template keys' , inject ( function ( $injector ) {
34
+ const config = { name : ' foo' , url : ' /foo' , template : ' <h1>hey</h1>' , controller : ' FooController' , parent : parent } ;
35
35
expect ( ( ) => builder . builder ( 'views' ) ( config ) ) . not . toThrow ( ) ;
36
36
expect ( ( ) => builder . builder ( 'views' ) ( extend ( { component : 'fooComponent' } , config ) ) ) . toThrow ( ) ;
37
37
expect ( ( ) => builder . builder ( 'views' ) ( extend ( { componentProvider : ( ) => 'fooComponent' } , config ) ) ) . toThrow ( ) ;
38
- expect ( ( ) => builder . builder ( 'views' ) ( extend ( { bindings : { } } , config ) ) ) . toThrow ( ) ;
38
+ expect ( ( ) => builder . builder ( 'views' ) ( extend ( { bindings : { } } , config ) ) ) . toThrow ( ) ;
39
39
} ) ) ;
40
40
41
- it ( " should replace a resolve: string value with a function that injects the service of the same name" , inject ( function ( $injector ) {
42
- var config = { resolve : { foo : " bar" } } ;
41
+ it ( ' should replace a resolve: string value with a function that injects the service of the same name' , inject ( function ( $injector ) {
42
+ const config = { resolve : { foo : ' bar' } } ;
43
43
expect ( builder . builder ( 'resolvables' ) ) . toBeDefined ( ) ;
44
- var built : Resolvable [ ] = builder . builder ( 'resolvables' ) ( config ) ;
45
- expect ( built [ 0 ] . deps ) . toEqual ( [ " bar" ] ) ;
44
+ const built : Resolvable [ ] = builder . builder ( 'resolvables' ) ( config ) ;
45
+ expect ( built [ 0 ] . deps ) . toEqual ( [ ' bar' ] ) ;
46
46
} ) ) ;
47
47
} ) ;
0 commit comments