Skip to content

Commit

Permalink
feat(module:select): add tests for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-yangy committed Jun 22, 2019
1 parent 85d8337 commit 6e0171a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion components/select/nz-select.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,15 @@ describe('nz-select component', () => {
fixture.detectChanges();
expect(testComponent.selectedValue.length).toBe(0);
}));
it('should custom template work', fakeAsync(() => {
fixture.detectChanges();
selectComponent.nzSelectService.updateListOfSelectedValue(['jack'], true);
fixture.detectChanges();
flush();
fixture.detectChanges();
const selection = select.nativeElement.querySelector('.ant-select-selection') as HTMLElement;
expect(selection.innerText).toContain('Label: Jack\nValue: jack');
}));
});

describe('form', () => {
Expand Down Expand Up @@ -457,11 +466,15 @@ export class NzTestSelectDefaultComponent {

@Component({
template: `
<nz-select [(ngModel)]="selectedValue" [nzAllowClear]="true" [nzMode]="'tags'">
<nz-select [(ngModel)]="selectedValue" [nzAllowClear]="true" [nzMode]="'tags'" [nzCustomTemplate]="custom">
<nz-option nzValue="jack" nzLabel="Jack"></nz-option>
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
<nz-option nzValue="disabled" nzLabel="Disabled" nzDisabled nzCustomContent>Disabled</nz-option>
</nz-select>
<ng-template #custom let-selected>
<div>Label: {{ selected.nzLabel }}</div>
<div>Value: {{ selected.nzValue }}</div>
</ng-template>
`
})
export class NzTestSelectTagsComponent {
Expand Down

0 comments on commit 6e0171a

Please sign in to comment.