From 4e58b3bd017ae95b4beb8e6835f22bc04aed41d8 Mon Sep 17 00:00:00 2001 From: Liyulun <466214245@qq.com> Date: Wed, 27 Jun 2018 23:41:44 +0800 Subject: [PATCH 1/3] fix issue 1736 --- components/table/nz-td.component.ts | 2 +- components/table/nz-th.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/table/nz-td.component.ts b/components/table/nz-td.component.ts index ba2f7d8b7a3..373d6899cf4 100644 --- a/components/table/nz-td.component.ts +++ b/components/table/nz-td.component.ts @@ -12,7 +12,7 @@ import { toBoolean } from '../core/util/convert'; @Component({ // tslint:disable-next-line:component-selector - selector : 'td', + selector : 'td:not(.custom-tag)', templateUrl: './nz-td.component.html' }) export class NzTdComponent { diff --git a/components/table/nz-th.component.ts b/components/table/nz-th.component.ts index 3ded5366468..5da2753f67e 100644 --- a/components/table/nz-th.component.ts +++ b/components/table/nz-th.component.ts @@ -26,7 +26,7 @@ export interface NzThItemInterface { @Component({ // tslint:disable-next-line:component-selector - selector : 'th', + selector : 'th:not(.custom-tag)', preserveWhitespaces: false, templateUrl : './nz-th.component.html' }) From 538645bda1c897908747c89fb1863902beab1124 Mon Sep 17 00:00:00 2001 From: Liyulun <466214245@qq.com> Date: Thu, 28 Jun 2018 09:44:34 +0800 Subject: [PATCH 2/3] change to specific class name --- components/table/nz-td.component.ts | 2 +- components/table/nz-th.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/table/nz-td.component.ts b/components/table/nz-td.component.ts index 373d6899cf4..8023230e53c 100644 --- a/components/table/nz-td.component.ts +++ b/components/table/nz-td.component.ts @@ -12,7 +12,7 @@ import { toBoolean } from '../core/util/convert'; @Component({ // tslint:disable-next-line:component-selector - selector : 'td:not(.custom-tag)', + selector : 'td:not(.nz-disable-td)', templateUrl: './nz-td.component.html' }) export class NzTdComponent { diff --git a/components/table/nz-th.component.ts b/components/table/nz-th.component.ts index 5da2753f67e..715b145d977 100644 --- a/components/table/nz-th.component.ts +++ b/components/table/nz-th.component.ts @@ -26,7 +26,7 @@ export interface NzThItemInterface { @Component({ // tslint:disable-next-line:component-selector - selector : 'th:not(.custom-tag)', + selector : 'th:not(.nz-disable-th)', preserveWhitespaces: false, templateUrl : './nz-th.component.html' }) From 38cf0759885e131f1b489678bd2d278f2f2e4efd Mon Sep 17 00:00:00 2001 From: Liyulun <466214245@qq.com> Date: Thu, 28 Jun 2018 14:57:42 +0800 Subject: [PATCH 3/3] add test file --- components/table/nz-td.spec.ts | 15 +++++++++++++++ components/table/nz-th.spec.ts | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/components/table/nz-td.spec.ts b/components/table/nz-td.spec.ts index f46c4e6ce70..ea251d0a5f4 100644 --- a/components/table/nz-td.spec.ts +++ b/components/table/nz-td.spec.ts @@ -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(); + }); }); }); @@ -155,3 +162,11 @@ export class NzTestTdComponent { left; right; } + +@Component({ + selector: 'nz-disable-td', + template: ` + + ` +}) +export class NzTestDisableTdComponent {} diff --git a/components/table/nz-th.spec.ts b/components/table/nz-th.spec.ts index c72d2dee7ff..96e20097a83 100644 --- a/components/table/nz-th.spec.ts +++ b/components/table/nz-th.spec.ts @@ -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(); + }); }); }); @@ -306,3 +313,11 @@ export class NzThTestNzTableComponent { filterMultiple = true; expand = false; } + +@Component({ + selector: 'nz-disable-th', + template: ` + + ` +}) +export class NzTestDisableThComponent {}