@@ -15,17 +15,19 @@ describe('Ng1 StateBuilder', function() {
15
15
builder . builder ( 'views' , ng1ViewsBuilder ) ;
16
16
} ) ;
17
17
18
- it ( 'should return a new views object, and copy keys from state def, if no `views` is defined in the state def ' , function ( ) {
18
+ it ( 'should use the state object to build a default view, when no `views` property is found ' , function ( ) {
19
19
var config = { url : "/foo" , templateUrl : "/foo.html" , controller : "FooController" , parent : parent } ;
20
20
var built = builder . builder ( 'views' ) ( config ) ;
21
21
22
22
expect ( built . $default ) . not . toEqualData ( config ) ;
23
23
expect ( built . $default ) . toEqualData ( { templateUrl : "/foo.html" , controller : "FooController" , resolveAs : '$resolve' } ) ;
24
24
} ) ;
25
25
26
- it ( " should return modified view config object if ` views` is defined in the state def" , function ( ) {
26
+ it ( 'It should use the views object to build views, when defined, function() {
27
27
var config = { a : { foo : "bar" , controller : "FooController" } } ;
28
- expect ( builder . builder ( 'views' ) ( { parent : parent , views : config } ) ) . toEqual ( config ) ;
28
+ let builtViews = builder . builder ( 'views' ) ( { parent : parent , views : config } ) ;
29
+ expect ( builtViews . a . foo ) . toEqualData ( config . a . foo ) ;
30
+ expect ( builtViews . a . controller ) . toEqualData ( config . a . controller ) ;
29
31
} ) ;
30
32
31
33
it ( "should not allow a view config with both component and template keys" , inject ( function ( $injector ) {
0 commit comments