@@ -22,7 +22,7 @@ describe('<md-virtual-repeat>', function() {
22
22
ITEM_SIZE = 10 ;
23
23
24
24
beforeEach ( inject ( function (
25
- _$$rAF_ , _$compile_ , _$document_ , _$mdUtil_ , $rootScope , _$timeout_ , _$ window_, _$material_ ) {
25
+ _$$rAF_ , _$compile_ , _$document_ , _$mdUtil_ , $rootScope , _$window_ , _$material_ ) {
26
26
repeater = angular . element ( REPEATER_HTML ) ;
27
27
container = angular . element ( CONTAINER_HTML ) . append ( repeater ) ;
28
28
component = null ;
@@ -31,7 +31,6 @@ describe('<md-virtual-repeat>', function() {
31
31
$mdUtil = _$mdUtil_ ;
32
32
$compile = _$compile_ ;
33
33
$document = _$document_ ;
34
- $timeout = _$timeout_ ;
35
34
$window = _$window_ ;
36
35
scope = $rootScope . $new ( ) ;
37
36
scope . startIndex = 0 ;
@@ -583,24 +582,20 @@ describe('<md-virtual-repeat>', function() {
583
582
expect ( offsetter . children ( ) . length ) . toBe ( 43 ) ;
584
583
} ) ;
585
584
586
- it ( 'makes a second attempt to measure the size if it starts out at 0' ,
587
- function ( ) {
588
- // Create the repeater before appending it to the body.
589
- scope . items = createItems ( 100 ) ;
590
- component = $compile ( container ) ( scope ) ;
591
- $material . flushOutstandingAnimations ( ) ;
592
- angular . element ( $document [ 0 ] . body ) . append ( container ) ;
593
- offsetter = angular . element ( component [ 0 ] . querySelector ( '.md-virtual-repeat-offsetter' ) ) ;
585
+ it ( 'should shrink when initial results require shrinking' , inject ( function ( ) {
586
+ scope . items = [
587
+ { value : 'alabama' , display : 'Alabama' } ,
588
+ { value : 'alaska' , display : 'Alaska' } ,
589
+ { value : 'arizona' , display : 'Arizona' }
590
+ ] ;
591
+ createRepeater ( ) ;
592
+ var controller = component . controller ( 'mdVirtualRepeatContainer' ) ;
593
+ controller . autoShrink = true ;
594
+ controller . autoShrink_ ( 200 ) ;
594
595
595
- // Expect 3 children (0 + 3 extra).
596
+ expect ( component [ 0 ] . getBoundingClientRect ( ) . height ) . toBe ( 200 ) ;
596
597
expect ( offsetter . children ( ) . length ) . toBe ( 3 ) ;
597
-
598
- // Expect it to remeasure using debounce.
599
- $timeout . flush ( ) ;
600
-
601
- // Expect 13 children (10 + 3 extra).
602
- expect ( offsetter . children ( ) . length ) . toBe ( 13 ) ;
603
- } ) ;
598
+ } ) ) ;
604
599
605
600
/**
606
601
* Facade to access transform properly even when jQuery is used;
0 commit comments