This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 11091109 if ( oldValue != newValue )
11101110 ngModel . $modelValue = null ; //Force scope model value and ngModel value to be out of sync to re-run formatters
11111111 } ) ;
1112+ $select . firstPass = true ; // so the form doesn't get dirty as soon as it loads
11121113 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 ;
1118+ }
11141119 } ) ;
11151120 focusser . prop ( 'disabled' , true ) ; //Focusser isn't needed if multiple
11161121 } else {
Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ describe('ui-select tests', function() {
404404 beforeEach ( function ( ) {
405405 disablePerson ( {
406406 disableAttr : 'inactive' ,
407- disableBool : true ,
407+ disableBool : true
408408 } ) ;
409409 this . el = createUiSelect ( {
410410 disabled : 'person.inactive'
@@ -437,7 +437,7 @@ describe('ui-select tests', function() {
437437 beforeEach ( function ( ) {
438438 disablePerson ( {
439439 disableAttr : 'active' ,
440- disableBool : false ,
440+ disableBool : false
441441 } ) ;
442442 this . el = createUiSelect ( {
443443 disabled : '!person.active'
@@ -1123,13 +1123,13 @@ describe('ui-select tests', function() {
11231123 expect ( el . find ( '.ui-select-match-item' ) . length ) . toBe ( 0 ) ;
11241124 } ) ;
11251125
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 ( ) {
11271127
11281128 // scope.selection.selectedMultiple = [];
11291129 var el = createUiSelectMultiple ( ) ;
1130-
1130+ expect ( scope . selection . selectedMultiple instanceof Array ) . toBe ( false ) ;
1131+ clickItem ( el , 'Samantha' ) ;
11311132 expect ( scope . selection . selectedMultiple instanceof Array ) . toBe ( true ) ;
1132-
11331133 } ) ;
11341134
11351135 it ( 'should render initial selected items' , function ( ) {
You can’t perform that action at this time.
0 commit comments