@@ -14,7 +14,7 @@ function animateFlush($animate) {
1414describe ( 'uiView' , function ( ) {
1515 'use strict' ;
1616
17- var log , scope , $compile , elem ;
17+ var scope , $compile , elem ;
1818
1919 beforeEach ( function ( ) {
2020 var depends = [ 'ui.router' ] ;
@@ -37,10 +37,6 @@ describe('uiView', function () {
3737 } ) ;
3838 } ) ) ;
3939
40- beforeEach ( function ( ) {
41- log = '' ;
42- } ) ;
43-
4440 var aState = {
4541 template : 'aState template'
4642 } ,
@@ -112,9 +108,8 @@ describe('uiView', function () {
112108 }
113109 }
114110 } ,
115-
116- oState = {
117- template : 'oState' ,
111+ mState = {
112+ template : 'mState' ,
118113 controller : function ( $scope , $element ) {
119114 $scope . elementId = $element . attr ( 'id' ) ;
120115 }
@@ -134,22 +129,7 @@ describe('uiView', function () {
134129 . state ( 'j' , jState )
135130 . state ( 'k' , kState )
136131 . state ( 'l' , lState )
137- . state ( 'm' , {
138- template : 'mState' ,
139- controller : function ( $scope ) {
140- log += 'm;' ;
141- $scope . $on ( '$destroy' , function ( ) {
142- log += '$destroy(m);' ;
143- } ) ;
144- } ,
145- } )
146- . state ( 'n' , {
147- template : 'nState' ,
148- controller : function ( $scope ) {
149- log += 'n;' ;
150- } ,
151- } )
152- . state ( 'o' , oState )
132+ . state ( 'm' , mState )
153133 } ) ) ;
154134
155135 beforeEach ( inject ( function ( $rootScope , _$compile_ ) {
@@ -160,23 +140,6 @@ describe('uiView', function () {
160140
161141 describe ( 'linking ui-directive' , function ( ) {
162142
163- it ( '$destroy event is triggered after animation ends' , inject ( function ( $state , $q , $animate ) {
164- elem . append ( $compile ( '<div><ui-view></ui-view></div>' ) ( scope ) ) ;
165-
166- $state . transitionTo ( 'm' ) ;
167- $q . flush ( ) ;
168- expect ( log ) . toBe ( 'm;' ) ;
169- $state . transitionTo ( 'n' ) ;
170- $q . flush ( ) ;
171- if ( $animate ) {
172- expect ( log ) . toBe ( 'm;n;' ) ;
173- animateFlush ( $animate ) ;
174- expect ( log ) . toBe ( 'm;n;$destroy(m);' ) ;
175- } else {
176- expect ( log ) . toBe ( 'm;$destroy(m);n;' ) ;
177- }
178- } ) ) ;
179-
180143 it ( 'anonymous ui-view should be replaced with the template of the current $state' , inject ( function ( $state , $q ) {
181144 elem . append ( $compile ( '<div><ui-view></ui-view></div>' ) ( scope ) ) ;
182145
@@ -362,11 +325,11 @@ describe('uiView', function () {
362325 } ) ) ;
363326
364327 it ( 'should instantiate a controller with both $scope and $element injections' , inject ( function ( $state , $q ) {
365- elem . append ( $compile ( '<div><ui-view id="oState ">{{elementId}}</ui-view></div>' ) ( scope ) ) ;
366- $state . transitionTo ( oState ) ;
328+ elem . append ( $compile ( '<div><ui-view id="mState ">{{elementId}}</ui-view></div>' ) ( scope ) ) ;
329+ $state . transitionTo ( mState ) ;
367330 $q . flush ( ) ;
368331
369- expect ( elem . text ( ) ) . toBe ( 'oState ' ) ;
332+ expect ( elem . text ( ) ) . toBe ( 'mState ' ) ;
370333 } ) ) ;
371334
372335 describe ( 'play nicely with other directives' , function ( ) {
0 commit comments