diff --git a/components/popconfirm/nz-popconfirm.component.html b/components/popconfirm/nz-popconfirm.component.html index 91da55e2f3..3157d1ab90 100644 --- a/components/popconfirm/nz-popconfirm.component.html +++ b/components/popconfirm/nz-popconfirm.component.html @@ -25,7 +25,7 @@ {{ nzCancelText }} {{ 'Modal.cancelText' | nzI18n }} - diff --git a/components/popconfirm/nz-popconfirm.component.ts b/components/popconfirm/nz-popconfirm.component.ts index 17a992b40a..9b737ad450 100644 --- a/components/popconfirm/nz-popconfirm.component.ts +++ b/components/popconfirm/nz-popconfirm.component.ts @@ -29,6 +29,7 @@ export class NzPopconfirmComponent extends NzToolTipComponent { _hasBackdrop = true; @Input() nzContent; @Input() nzOkText: string; + @Input() nzOkType: string = 'primary'; @Input() nzCancelText: string; @Input() diff --git a/components/popconfirm/nz-popconfirm.spec.ts b/components/popconfirm/nz-popconfirm.spec.ts index 4d4e4624a3..aeddbabdf7 100644 --- a/components/popconfirm/nz-popconfirm.spec.ts +++ b/components/popconfirm/nz-popconfirm.spec.ts @@ -58,6 +58,18 @@ describe('NzPopconfirm', () => { expect(overlayContainerElement.textContent).not.toContain(featureKey); })); + it('should support nzOkType', fakeAsync(() => { + demoAppComponent.nzOkType = 'danger'; + const triggerElement = demoAppComponent.normalTrigger.nativeElement; + + dispatchMouseEvent(triggerElement, 'mouseenter'); + demoAppFixture.detectChanges(); + tick(150); // wait for the default 100ms delay + demoAppFixture.detectChanges(); + tick(); + expect(!!overlayContainerElement.querySelector('button.ant-btn-danger')).toBeTruthy(); + })); + it('should show tooltip with custom template', fakeAsync(() => { const triggerElement = demoAppComponent.templateTrigger.nativeElement; @@ -144,7 +156,7 @@ describe('NzPopconfirm', () => { @Component({ selector: 'nz-demo-app', template: ` - Show + Show @@ -163,6 +175,8 @@ describe('NzPopconfirm', () => { ` }) export class DemoAppComponent { + nzOkType = 'primary'; + @ViewChild('normalTrigger') normalTrigger: ElementRef; @ViewChild('templateTrigger') templateTrigger: ElementRef;