Skip to content

Commit

Permalink
fix(sf:checkbox): fix invalid trigger check-all when click input (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Mar 25, 2019
1 parent 5e3ad9c commit 4ee3ca5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/form/src/widgets/checkbox/checkbox.widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
nz-checkbox
class="sf__checkbox-all mr-sm"
[(ngModel)]="allChecked"
[nzIndeterminate]="indeterminate"
(click)="onAllChecked($event)">{{ ui.checkAllText || l.checkAllText }}</label>
(ngModelChange)="onAllChecked()"
[nzIndeterminate]="indeterminate">{{ ui.checkAllText || l.checkAllText }}</label>
</ng-template>
<sf-item-wrap [id]="id"
[schema]="schema"
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/widgets/checkbox/checkbox.widget.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('form: widget: checkbox', () => {
},
});
const comp = page.getWidget<CheckboxWidget>('sf-checkbox');
const checkAllBtn = page.getEl('.sf__checkbox-list .ant-checkbox-wrapper');
const checkAllBtn = page.getEl('.sf__checkbox-list .ant-checkbox');
checkAllBtn.click();
expect(comp.allChecked).toBe(true);
checkAllBtn.click();
Expand Down
3 changes: 1 addition & 2 deletions packages/form/src/widgets/checkbox/checkbox.widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export class CheckboxWidget extends ControlWidget {
this.notifySet();
}

onAllChecked(e: Event) {
e.stopPropagation();
onAllChecked() {
this.data.forEach(item => (item.checked = this.allChecked));
this.notifySet();
}
Expand Down

0 comments on commit 4ee3ca5

Please sign in to comment.