Skip to content

Commit

Permalink
fix(module:sf:button): fix invalid button size (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Nov 23, 2018
1 parent 9df6f0e commit 96f8adc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions packages/form/spec/form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ describe('form: component', () => {
);
});
});
describe('#size', () => {
it('with small', () => {
context.button = { render: { size: 'small' } };
fixture.detectChanges();
page.checkCount('.ant-btn-sm', 2);
});
it('with large', () => {
context.button = { render: { size: 'large' } };
fixture.detectChanges();
page.checkCount('.ant-btn-lg', 2);
});
});
});

describe('properites', () => {
Expand Down
8 changes: 6 additions & 2 deletions packages/form/src/sf.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
[nzLg]="_btn.render.grid.lg" [nzXl]="_btn.render.grid.xl" [nzXXl]="_btn.render.grid.xxl">
<div class="ant-form-item-control">
<ng-container *ngIf="button; else con">
<button type="submit" nz-button [nzType]="_btn.submit_type" [disabled]="liveValidate && !valid">{{_btn.submit}}</button>
<button *ngIf="_btn.reset" (click)="reset(true)" type="button" nz-button [nzType]="_btn.reset_type">{{_btn.reset}}</button>
<button type="submit" nz-button [nzType]="_btn.submit_type" [nzSize]="_btn.render.size"
[disabled]="liveValidate && !valid">{{_btn.submit}}</button>
<button *ngIf="_btn.reset" type="button" nz-button
[nzType]="_btn.reset_type" [nzSize]="_btn.render.size" (click)="reset(true)">
{{_btn.reset}}
</button>
</ng-container>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/sf.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class SFComponent implements OnInit, OnChanges, OnDestroy {

private coverButtonProperty() {
this._btn = Object.assign(
{ render: {} },
<SFButton>{ render: { size: 'default' } },
this.locale,
this.options.button,
this.button,
Expand Down

0 comments on commit 96f8adc

Please sign in to comment.