@@ -55,21 +55,15 @@ describe('ui-select tests', function () {
5555 link : function ( scope , element , attrs , ngModel ) {
5656 ngModel . $validators . testValidator = function ( modelValue , viewValue ) {
5757 if ( isNil ( modelValue ) ) {
58- link : function link ( scope , element , attrs , ngModel ) {
59- ngModel . $validators . testValidator = function ( modelValue , viewValue ) {
60- if ( angular . isUndefined ( modelValue ) || modelValue === null ) {
61- return true ;
62- } else if ( angular . isArray ( modelValue ) ) {
63- var allValid = true , idx = modelValue . length ;
64- while ( idx -- > 0 && allValid ) {
65- allValid = allValid && modelValue [ idx ] . valid ;
66- }
67- return allValid ;
68- } else {
69- return ! ! modelValue . valid ;
70- }
71- } ;
58+ return true ;
59+ } else if ( angular . isArray ( modelValue ) ) {
60+ var allValid = true , idx = modelValue . length ;
61+ while ( idx -- > 0 && allValid ) {
62+ allValid = allValid && modelValue [ idx ] . valid ;
7263 }
64+ return allValid ;
65+ } else {
66+ return ! ! modelValue . valid ;
7367 }
7468 }
7569 }
@@ -3384,52 +3378,4 @@ describe('ui-select tests', function () {
33843378 expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
33853379 } ) ;
33863380 } ) ;
3387-
3388- describe ( 'Header & Footer' , function ( ) {
3389-
3390- var el ;
3391-
3392- function setupSelectComponent ( theme , isMulti ) {
3393- isMulti = ! ! isMulti ;
3394- var multi = isMulti ? ' multiple' : '' ;
3395- var selectedStr = isMulti ? '$select.selected[0]' : '$select.selected' ;
3396- scope . selection . selected = isMulti ? [ scope . people [ 0 ] ] : scope . people [ 0 ] ;
3397-
3398- el = compileTemplate (
3399- '<ui-select ng-model="selection.selected" theme="' + theme + '"' + multi + '> \
3400- <ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
3401- <ui-select-header>{{' + selectedStr + '.name}}</ui-select-header>\
3402- <ui-select-choices repeat="person in people | filter: $select.search"> \
3403- <div ng-bind-html="person.name | highlight: $select.search"></div> \
3404- <div ng-bind-html="person.email | highlight: $select.search"></div> \
3405- </ui-select-choices> \
3406- <ui-select-footer>{{' + selectedStr + '.name}}</ui-select-footer> \
3407- </ui-select>'
3408- ) ;
3409- }
3410-
3411- [ 'selectize' , 'bootstrap' , 'select2' ] . forEach ( function ( theme ) {
3412- describe ( theme + ' theme' , function ( ) {
3413- it ( 'should show the header' , function ( ) {
3414- setupSelectComponent ( theme ) ;
3415- expect ( $ ( el ) . find ( '.ui-select-header' ) . text ( ) . trim ( ) ) . toBe ( scope . selection . selected . name ) ;
3416- } ) ;
3417-
3418- it ( 'should show the header in multiple option' , function ( ) {
3419- setupSelectComponent ( theme , true ) ;
3420- expect ( $ ( el ) . find ( '.ui-select-header' ) . text ( ) . trim ( ) ) . toBe ( scope . selection . selected [ 0 ] . name ) ;
3421- } ) ;
3422-
3423- it ( 'should show the footer' , function ( ) {
3424- setupSelectComponent ( theme ) ;
3425- expect ( $ ( el ) . find ( '.ui-select-footer' ) . text ( ) . trim ( ) ) . toBe ( scope . selection . selected . name ) ;
3426- } ) ;
3427-
3428- it ( 'should show the footer in multiple option' , function ( ) {
3429- setupSelectComponent ( theme , true ) ;
3430- expect ( $ ( el ) . find ( '.ui-select-footer' ) . text ( ) . trim ( ) ) . toBe ( scope . selection . selected [ 0 ] . name ) ;
3431- } ) ;
3432- } ) ;
3433- } ) ;
3434- } ) ;
34353381} ) ;
0 commit comments