diff --git a/components/modal/nz-modal.component.html b/components/modal/nz-modal.component.html index e58510f9398..4a6873790b8 100644 --- a/components/modal/nz-modal.component.html +++ b/components/modal/nz-modal.component.html @@ -112,10 +112,20 @@
- -
diff --git a/components/modal/nz-modal.component.ts b/components/modal/nz-modal.component.ts index 894a169933c..92eea72bb5d 100644 --- a/components/modal/nz-modal.component.ts +++ b/components/modal/nz-modal.component.ts @@ -86,7 +86,7 @@ export class NzModalComponent extends NzModalRef @Input() nzBodyStyle: object; @Input() nzOkText: string | null; @Input() nzCancelText: string | null; - @Input() nzOkType = 'primary'; + @Input() nzOkType: string = 'primary'; @Input() nzIconType: string = 'question-circle'; // Confirm Modal ONLY @Input() nzModalType: ModalType = 'default'; diff --git a/components/modal/nz-modal.spec.ts b/components/modal/nz-modal.spec.ts index 99cadbc8115..509b3e0d8f7 100644 --- a/components/modal/nz-modal.spec.ts +++ b/components/modal/nz-modal.spec.ts @@ -317,6 +317,17 @@ describe('modal testing (legacy)', () => { ids.forEach(id => expectModalDestroyed(id, false)); })); + it('should disable buttons', fakeAsync(() => { + const modalRef = instance.createDisabledModal(); + fixture.detectChanges(); + flush(); + fixture.detectChanges(); + const buttons = modalRef.getElement().querySelectorAll('.ant-modal-confirm-btns button') as NodeListOf< + HTMLButtonElement + >; + buttons.forEach(button => expect(button.disabled).toBe(true)); + })); + it('should render content with component', fakeAsync(() => { const modalRef = instance.createCustomContentWithComponent(); const modalElement = modalRef.getElement(); @@ -931,6 +942,13 @@ export class TestConfirmModalComponent { nzContent: TestConfirmCustomComponent }); } + + createDisabledModal(): NzModalRef { + return this.modalService.confirm({ + nzCancelDisabled: true, + nzOkDisabled: true + }); + } } @Component({