File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ "jasmine" : true ,
2
3
"bitwise" : true ,
3
4
"immed" : true ,
4
5
"newcap" : true ,
Original file line number Diff line number Diff line change 25
25
scope . $emptyElm . addClass ( config . emptyTreeClass ) ;
26
26
}
27
27
28
- scope . $watch ( '$nodesScope.$modelValue.length' , function ( ) {
29
- if ( ! scope . $nodesScope . $modelValue ) {
28
+ scope . $watch ( '$nodesScope.$modelValue.length' , function ( val ) {
29
+ if ( ! angular . isNumber ( val ) ) {
30
30
return ;
31
31
}
32
32
Original file line number Diff line number Diff line change 108
108
109
109
expect ( element . scope ( ) . dragDelay ) . toEqual ( 84 ) ;
110
110
} ) ;
111
+
112
+ describe ( '$nodesScope' , function ( ) {
113
+ var controller ;
114
+
115
+ beforeEach ( function ( ) {
116
+ $scope . items . push ( 'item1' ) ;
117
+ createElement ( ) ;
118
+ controller = element . controller ( 'uiTree' ) ;
119
+ spyOn ( controller , 'resetEmptyElement' ) ;
120
+ } ) ;
121
+
122
+ it ( 'should reset empty elements' , function ( ) {
123
+ $scope . items . pop ( ) ;
124
+ $scope . $digest ( ) ;
125
+ expect ( controller . resetEmptyElement ) . toHaveBeenCalled ( ) ;
126
+ } ) ;
127
+
128
+ it ( 'should not attempt to reset elements without a $nodesScope' , function ( ) {
129
+ element . scope ( ) . $nodesScope = null ;
130
+ $scope . $digest ( ) ;
131
+ expect ( controller . resetEmptyElement ) . not . toHaveBeenCalled ( ) ;
132
+ } ) ;
133
+ } ) ;
111
134
} ) ;
112
135
113
136
} ( ) ) ;
You can’t perform that action at this time.
0 commit comments