File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1109
1109
if ( oldValue != newValue )
1110
1110
ngModel . $modelValue = null ; //Force scope model value and ngModel value to be out of sync to re-run formatters
1111
1111
} ) ;
1112
+ $select . firstPass = true ; // so the form doesn't get dirty as soon as it loads
1112
1113
scope . $watchCollection ( '$select.selected' , function ( ) {
1113
- ngModel . $setViewValue ( Date . now ( ) ) ; //Set timestamp as a unique string to force changes
1114
+ if ( ! $select . firstPass )
1115
+ ngModel . $setViewValue ( Date . now ( ) ) ; //Set timestamp as a unique string to force changes
1116
+ else
1117
+ $select . firstPass = false ;
1114
1118
} ) ;
1115
1119
focusser . prop ( 'disabled' , true ) ; //Focusser isn't needed if multiple
1116
1120
} else {
Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ describe('ui-select tests', function() {
404
404
beforeEach ( function ( ) {
405
405
disablePerson ( {
406
406
disableAttr : 'inactive' ,
407
- disableBool : true ,
407
+ disableBool : true
408
408
} ) ;
409
409
this . el = createUiSelect ( {
410
410
disabled : 'person.inactive'
@@ -437,7 +437,7 @@ describe('ui-select tests', function() {
437
437
beforeEach ( function ( ) {
438
438
disablePerson ( {
439
439
disableAttr : 'active' ,
440
- disableBool : false ,
440
+ disableBool : false
441
441
} ) ;
442
442
this . el = createUiSelect ( {
443
443
disabled : '!person.active'
@@ -1123,13 +1123,13 @@ describe('ui-select tests', function() {
1123
1123
expect ( el . find ( '.ui-select-match-item' ) . length ) . toBe ( 0 ) ;
1124
1124
} ) ;
1125
1125
1126
- it ( 'should set model as an empty array if ngModel isnt defined' , function ( ) {
1126
+ it ( 'should set model as an empty array if ngModel isnt defined after an item is selected ' , function ( ) {
1127
1127
1128
1128
// scope.selection.selectedMultiple = [];
1129
1129
var el = createUiSelectMultiple ( ) ;
1130
-
1130
+ expect ( scope . selection . selectedMultiple instanceof Array ) . toBe ( false ) ;
1131
+ clickItem ( el , 'Samantha' ) ;
1131
1132
expect ( scope . selection . selectedMultiple instanceof Array ) . toBe ( true ) ;
1132
-
1133
1133
} ) ;
1134
1134
1135
1135
it ( 'should render initial selected items' , function ( ) {
You can’t perform that action at this time.
0 commit comments