Skip to content

Commit

Permalink
feat(module:table): fix selector error (NG-ZORRO#1742)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liyulun authored and wenqi73 committed Aug 27, 2018
1 parent afd56dd commit f7f7a39
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/table/nz-td.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { toBoolean } from '../core/util/convert';

@Component({
// tslint:disable-next-line:component-selector
selector : 'td',
selector : 'td:not(.nz-disable-td)',
templateUrl: './nz-td.component.html'
})
export class NzTdComponent {
Expand Down
15 changes: 15 additions & 0 deletions components/table/nz-td.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ describe('nz-td', () => {
expect(td.nativeElement.classList).toContain('ant-table-td-right-sticky');
expect(td.nativeElement.style.right).toBe('20px');
});
it('should be throw error when use specific class name', () => {
expect(() => {
TestBed.configureTestingModule({
declarations: [ NzTestDisableTdComponent ]
}).createComponent(NzTestDisableTdComponent);
}).toThrow();
});
});
});

Expand Down Expand Up @@ -155,3 +162,11 @@ export class NzTestTdComponent {
left;
right;
}

@Component({
selector: 'nz-disable-td',
template: `
<td class="nz-disable-td" [nzShowCheckbox]="true"></td>
`
})
export class NzTestDisableTdComponent {}
2 changes: 1 addition & 1 deletion components/table/nz-th.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface NzThItemInterface {

@Component({
// tslint:disable-next-line:component-selector
selector : 'th',
selector : 'th:not(.nz-disable-th)',
preserveWhitespaces: false,
templateUrl : './nz-th.component.html'
})
Expand Down
15 changes: 15 additions & 0 deletions components/table/nz-th.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ describe('nz-th', () => {
fixture.detectChanges();
expect(th.nativeElement.classList).toContain('ant-table-expand-icon-th');
});
it('should be throw error when use specific class name', () => {
expect(() => {
TestBed.configureTestingModule({
declarations: [ NzTestDisableThComponent ]
}).createComponent(NzTestDisableThComponent);
}).toThrow();
});
});
});

Expand Down Expand Up @@ -306,3 +313,11 @@ export class NzThTestNzTableComponent {
filterMultiple = true;
expand = false;
}

@Component({
selector: 'nz-disable-th',
template: `
<th class="nz-disable-th" [nzShowCheckbox]="true"></th>
`
})
export class NzTestDisableThComponent {}

0 comments on commit f7f7a39

Please sign in to comment.