This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 3 files changed +23
-1
lines changed
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
### Bug Fixes
5
5
- Issue #449 : [ ng: options ] should support binding to a property of an item.
6
+ - Issue #464 : [ ng: options ] incorrectly re-grew options on datasource change
6
7
7
8
### Breaking changes
8
9
- no longer support MMMMM in filter.date as we need to follow UNICODE LOCALE DATA formats.
Original file line number Diff line number Diff line change @@ -783,10 +783,13 @@ angularWidget('select', function(element){
783
783
}
784
784
}
785
785
}
786
- if ( fragment ) select . append ( jqLite ( fragment ) ) ;
786
+ if ( fragment ) {
787
+ select . append ( jqLite ( fragment ) ) ;
788
+ }
787
789
// shrink children
788
790
while ( optionElements . length > index ) {
789
791
optionElements . pop ( ) . remove ( ) ;
792
+ optionTexts . pop ( ) ;
790
793
delete lastSelectValue [ optionElements . length ] ;
791
794
}
792
795
Original file line number Diff line number Diff line change @@ -672,6 +672,24 @@ describe("widget", function(){
672
672
expect ( select . find ( 'option' ) . length ) . toEqual ( 1 ) ; // we add back the special empty option
673
673
} ) ;
674
674
675
+ it ( 'should shrink and then grow list' , function ( ) {
676
+ createSingleSelect ( ) ;
677
+ scope . values = [ { name :'A' } , { name :'B' } , { name :'C' } ] ;
678
+ scope . selected = scope . values [ 0 ] ;
679
+ scope . $eval ( ) ;
680
+ expect ( select . find ( 'option' ) . length ) . toEqual ( 3 ) ;
681
+
682
+ scope . values = [ { name :'1' } , { name :'2' } ] ;
683
+ scope . selected = scope . values [ 0 ] ;
684
+ scope . $eval ( ) ;
685
+ expect ( select . find ( 'option' ) . length ) . toEqual ( 2 ) ;
686
+
687
+ scope . values = [ { name :'A' } , { name :'B' } , { name :'C' } ] ;
688
+ scope . selected = scope . values [ 0 ] ;
689
+ scope . $eval ( ) ;
690
+ expect ( select . find ( 'option' ) . length ) . toEqual ( 3 ) ;
691
+ } ) ;
692
+
675
693
it ( 'should update list' , function ( ) {
676
694
createSingleSelect ( ) ;
677
695
scope . values = [ { name :'A' } , { name :'B' } , { name :'C' } ] ;
You can’t perform that action at this time.
0 commit comments