@@ -1270,7 +1270,15 @@ describe('select', () => {
12701270 flushRefresh ( ) ;
12711271 expect ( component . value . length ) . toBe ( 1 ) ;
12721272 expect ( component . value [ 0 ] ) . toBe ( 'test_01' ) ;
1273+ expect ( listOfContainerItem [ 1 ] ) . toHaveClass ( 'ant-select-item-option-disabled' ) ;
12731274 } ) ) ;
1275+ it ( 'should show nzShowArrow component when having nzMaxMultipleCount' , ( ) => {
1276+ component . nzMaxMultipleCount = 0 ;
1277+ expect ( selectElement . querySelector ( 'nz-select-arrow' ) ) . toBeFalsy ( ) ;
1278+ component . nzMaxMultipleCount = 1 ;
1279+ fixture . detectChanges ( ) ;
1280+ expect ( selectElement . querySelector ( 'nz-select-arrow' ) ) . toBeTruthy ( ) ;
1281+ } ) ;
12741282 it ( 'should nzAutoClearSearchValue work' , fakeAsync ( ( ) => {
12751283 const flushRefresh = ( ) : void => {
12761284 fixture . detectChanges ( ) ;
@@ -1425,6 +1433,33 @@ describe('select', () => {
14251433 // expect(requestAnimationFrameSpy).toHaveBeenCalledTimes(2);
14261434 } ) ) ;
14271435
1436+ it ( 'should isMaxTagCountSet work correct' , ( ) => {
1437+ component . nzMaxMultipleCount = Infinity ;
1438+ fixture . detectChanges ( ) ;
1439+ let isMaxTagCountSet ;
1440+ isMaxTagCountSet = selectComponent [ 'isMaxTagCountSet' ] ;
1441+ expect ( isMaxTagCountSet ) . toBeFalsy ( ) ;
1442+
1443+ component . nzMaxMultipleCount = 1 ;
1444+ fixture . detectChanges ( ) ;
1445+ isMaxTagCountSet = selectComponent [ 'isMaxTagCountSet' ] ;
1446+ expect ( isMaxTagCountSet ) . toBeTruthy ( ) ;
1447+ } ) ;
1448+
1449+ it ( 'should isMaxLimitReached be set correctly' , ( ) => {
1450+ selectComponent . nzMaxMultipleCount = 2 ;
1451+ selectComponent . listOfValue = [ 'a' , 'b' ] ;
1452+ fixture . detectChanges ( ) ;
1453+ selectComponent . updateListOfValue ( [ 'a' , 'b' ] ) ;
1454+ expect ( selectComponent . isMaxLimitReached ) . toBeTruthy ( ) ;
1455+
1456+ selectComponent . nzMaxMultipleCount = 20 ;
1457+ selectComponent . listOfValue = [ 'a' , 'b' ] ;
1458+ fixture . detectChanges ( ) ;
1459+ selectComponent . updateListOfValue ( [ 'a' , 'b' ] ) ;
1460+ expect ( selectComponent . isMaxLimitReached ) . toBeFalsy ( ) ;
1461+ } ) ;
1462+
14281463 it ( 'should not run change detection when `nz-select-top-control` is clicked and should focus the `nz-select-search`' , ( ) => {
14291464 const appRef = TestBed . inject ( ApplicationRef ) ;
14301465 spyOn ( appRef , 'tick' ) ;
@@ -1625,6 +1660,7 @@ describe('select', () => {
16251660 [(nzOpen)]="nzOpen"
16261661 [nzPlacement]="nzPlacement"
16271662 [nzSelectOnTab]="nzSelectOnTab"
1663+ [nzMaxMultipleCount]="nzMaxMultipleCount"
16281664 (ngModelChange)="valueChange($event)"
16291665 (nzOnSearch)="searchValueChange($event)"
16301666 (nzOpenChange)="openChange($event)"
@@ -1671,6 +1707,7 @@ export class TestSelectTemplateDefaultComponent {
16711707 nzSuffixIcon : TemplateRef < NzSafeAny > | null = null ;
16721708 nzClearIcon : TemplateRef < NzSafeAny > | null = null ;
16731709 nzShowArrow = true ;
1710+ nzMaxMultipleCount : number = Infinity ;
16741711 nzFilterOption : NzFilterOptionType = ( searchValue : string , item : NzSelectItemInterface ) : boolean => {
16751712 if ( item && item . nzLabel ) {
16761713 return item . nzLabel . toString ( ) . toLowerCase ( ) . indexOf ( searchValue . toLowerCase ( ) ) > - 1 ;
0 commit comments