@@ -14,7 +14,7 @@ function animateFlush($animate) {
14
14
describe ( 'uiView' , function ( ) {
15
15
'use strict' ;
16
16
17
- var log , scope , $compile , elem ;
17
+ var scope , $compile , elem ;
18
18
19
19
beforeEach ( function ( ) {
20
20
var depends = [ 'ui.router' ] ;
@@ -37,10 +37,6 @@ describe('uiView', function () {
37
37
} ) ;
38
38
} ) ) ;
39
39
40
- beforeEach ( function ( ) {
41
- log = '' ;
42
- } ) ;
43
-
44
40
var aState = {
45
41
template : 'aState template'
46
42
} ,
@@ -112,9 +108,8 @@ describe('uiView', function () {
112
108
}
113
109
}
114
110
} ,
115
-
116
- oState = {
117
- template : 'oState' ,
111
+ mState = {
112
+ template : 'mState' ,
118
113
controller : function ( $scope , $element ) {
119
114
$scope . elementId = $element . attr ( 'id' ) ;
120
115
}
@@ -134,22 +129,7 @@ describe('uiView', function () {
134
129
. state ( 'j' , jState )
135
130
. state ( 'k' , kState )
136
131
. 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 )
153
133
} ) ) ;
154
134
155
135
beforeEach ( inject ( function ( $rootScope , _$compile_ ) {
@@ -160,23 +140,6 @@ describe('uiView', function () {
160
140
161
141
describe ( 'linking ui-directive' , function ( ) {
162
142
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
-
180
143
it ( 'anonymous ui-view should be replaced with the template of the current $state' , inject ( function ( $state , $q ) {
181
144
elem . append ( $compile ( '<div><ui-view></ui-view></div>' ) ( scope ) ) ;
182
145
@@ -362,11 +325,11 @@ describe('uiView', function () {
362
325
} ) ) ;
363
326
364
327
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 ) ;
367
330
$q . flush ( ) ;
368
331
369
- expect ( elem . text ( ) ) . toBe ( 'oState ' ) ;
332
+ expect ( elem . text ( ) ) . toBe ( 'mState ' ) ;
370
333
} ) ) ;
371
334
372
335
describe ( 'play nicely with other directives' , function ( ) {
0 commit comments