File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class QueryList<T>/* implements Iterable<T> */ {
41
41
private _results : Array < T > = [ ] ;
42
42
public readonly changes : Observable < any > = new EventEmitter ( ) ;
43
43
44
- readonly length : number ;
44
+ readonly length : number = 0 ;
45
45
readonly first : T ;
46
46
readonly last : T ;
47
47
Original file line number Diff line number Diff line change @@ -23,6 +23,22 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
23
23
24
24
function logAppend ( item : any /** TODO #9100 */ ) { log += ( log . length == 0 ? '' : ', ' ) + item ; }
25
25
26
+ describe ( 'dirty and reset' , ( ) => {
27
+
28
+ it ( 'should initially be dirty and empty' , ( ) => {
29
+ expect ( queryList . dirty ) . toBeTruthy ( ) ;
30
+ expect ( queryList . length ) . toBe ( 0 ) ;
31
+ } ) ;
32
+
33
+ it ( 'should be not dirty after reset' , ( ) => {
34
+ expect ( queryList . dirty ) . toBeTruthy ( ) ;
35
+ queryList . reset ( [ 'one' , 'two' ] ) ;
36
+ expect ( queryList . dirty ) . toBeFalsy ( ) ;
37
+ expect ( queryList . length ) . toBe ( 2 ) ;
38
+ } ) ;
39
+
40
+ } ) ;
41
+
26
42
it ( 'should support resetting and iterating over the new objects' , ( ) => {
27
43
queryList . reset ( [ 'one' ] ) ;
28
44
queryList . reset ( [ 'two' ] ) ;
You can’t perform that action at this time.
0 commit comments