Skip to content

Commit 195ad26

Browse files
fix(module:transfer): not setting the move button disable state (#8824)
* fix(module:tabs): wrong cursor * fix(module:transfer): not setting the move btn disable state * fix(module:transfer): not setting the move btn disable state
1 parent 29827df commit 195ad26

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

components/transfer/transfer.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export class NzTransferComponent implements OnInit, OnChanges, OnDestroy {
246246
handleSelect(direction: TransferDirection, checked: boolean, item?: TransferItem): void {
247247
const list = this.getCheckedData(direction);
248248
if (list.every(i => i.disabled)) {
249+
this.updateOperationStatus(direction, 0);
249250
return;
250251
}
251252
this.updateOperationStatus(direction, list.length);

components/transfer/transfer.spec.ts

+10
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ describe('transfer', () => {
114114
expect(instance.comp.rightDataSource.filter(w => !w.hide).length).toBe(COUNT - LEFTCOUNT + 1);
115115
});
116116

117+
it('should have correct disable state on moving buttons', () => {
118+
const transferOperationButtons: DebugElement[] = dl.queryAll(By.css('.ant-transfer-operation > button'));
119+
const transferToRightButton: HTMLElement = transferOperationButtons[1].nativeNode;
120+
expect((transferToRightButton as NzSafeAny)['disabled']).toEqual(true);
121+
pageObject.checkItem('left', 0);
122+
expect((transferToRightButton as NzSafeAny)['disabled']).toEqual(false);
123+
pageObject.checkItem('left', 0);
124+
expect((transferToRightButton as NzSafeAny)['disabled']).toEqual(true);
125+
});
126+
117127
it('should be custom filter option', () => {
118128
instance.nzFilterOption = (inputValue: string, item: NzSafeAny): boolean =>
119129
item.description.indexOf(inputValue) > -1;

0 commit comments

Comments
 (0)