@@ -722,17 +722,39 @@ describe("UiView", function() {
722
722
beforeEach ( module ( function ( $stateProvider ) {
723
723
$stateProvider
724
724
. state ( 'main' , { abstract : true , views : { main : { } } } )
725
- . state ( 'main.home' , { views : { content : { template : 'home.html' } } } ) ;
725
+ . state ( 'main.home' , { views : { content : { template : 'HOME' } } } )
726
+ . state ( 'test' , { views : { 'nest' : { template : 'TEST' } } } ) ;
726
727
} ) ) ;
727
728
728
- it ( "shouldn't puke on weird view setups" , inject ( function ( $compile , $rootScope , $q , $state ) {
729
+ it ( "shouldn't puke on weird nested view setups" , inject ( function ( $compile , $rootScope , $q , $state ) {
729
730
$compile ( '<div ui-view="main"><div ui-view="content"></div></div>' ) ( $rootScope ) ;
730
731
731
732
$state . go ( 'main.home' ) ;
732
733
$q . flush ( ) ;
733
734
734
735
expect ( $state . current . name ) . toBe ( 'main.home' ) ;
735
736
} ) ) ;
737
+
738
+ // Test for https://github.com/angular-ui/ui-router/issues/3355
739
+ it ( "should target weird nested view setups using the view's simple name" , inject ( function ( $compile , $rootScope , $q , $state ) {
740
+ let tpl = `
741
+ <div>
742
+ <div ui-view="main">
743
+ MAIN-DEFAULT-
744
+ <div ui-view="content">
745
+ <div ui-view="nest"></div>
746
+ </div>
747
+ </div>
748
+ </div>
749
+ ` ;
750
+ let el = $compile ( tpl ) ( $rootScope ) ;
751
+
752
+ $state . go ( 'test' ) ;
753
+ $q . flush ( ) ;
754
+
755
+ expect ( $state . current . name ) . toBe ( 'test' ) ;
756
+ expect ( el . text ( ) . replace ( / \s * / g, "" ) ) . toBe ( 'MAIN-DEFAULT-TEST' ) ;
757
+ } ) ) ;
736
758
} ) ;
737
759
738
760
describe ( 'uiView transclusion' , function ( ) {
0 commit comments