Skip to content

Commit 1588199

Browse files
fix(module:button): add ant-btn-default class (#8501)
1 parent 886138d commit 1588199

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

components/button/button.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
SimpleChanges,
2323
ViewEncapsulation
2424
} from '@angular/core';
25-
import { fromEvent, Subject } from 'rxjs';
25+
import { Subject, fromEvent } from 'rxjs';
2626
import { filter, startWith, takeUntil } from 'rxjs/operators';
2727

2828
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
@@ -50,6 +50,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'button';
5050
`,
5151
host: {
5252
class: 'ant-btn',
53+
'[class.ant-btn-default]': `nzType === 'default'`,
5354
'[class.ant-btn-primary]': `nzType === 'primary'`,
5455
'[class.ant-btn-dashed]': `nzType === 'dashed'`,
5556
'[class.ant-btn-link]': `nzType === 'link'`,

components/button/button.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BidiModule, Dir } from '@angular/cdk/bidi';
22
import { ApplicationRef, Component, Input, OnInit, ViewChild } from '@angular/core';
3-
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
3+
import { TestBed, fakeAsync, tick } from '@angular/core/testing';
44
import { By } from '@angular/platform-browser';
55

66
import { ɵComponentBed as ComponentBed, ɵcreateComponentBed as createComponentBed } from 'ng-zorro-antd/core/testing';
@@ -51,6 +51,9 @@ describe('button', () => {
5151
expect(buttonElement.classList).toContain('ant-btn-block');
5252
});
5353
it('should apply classname based on nzType', () => {
54+
testBed.component.nzType = 'default';
55+
testBed.fixture.detectChanges();
56+
expect(buttonElement.classList).toContain('ant-btn-default');
5457
testBed.component.nzType = 'primary';
5558
testBed.fixture.detectChanges();
5659
expect(buttonElement.classList).toContain('ant-btn-primary');

0 commit comments

Comments
 (0)