diff --git a/components/affix/affix.spec.ts b/components/affix/affix.spec.ts index 29f015f63d9..589ad466774 100644 --- a/components/affix/affix.spec.ts +++ b/components/affix/affix.spec.ts @@ -1,4 +1,4 @@ -import { Component, DebugElement, ViewChild, ViewEncapsulation } from '@angular/core'; +import { Component, DebugElement, ViewChild } from '@angular/core'; import { discardPeriodicTasks, fakeAsync, @@ -188,7 +188,6 @@ describe('affix', () => { describe('[nzOffsetTop]', () => { const offsetTop = 150; - const componentOffset = 160; beforeEach(() => { context.newOffset = offsetTop; @@ -466,8 +465,7 @@ describe('affix-extra', () => { let fixture: ComponentFixture; let context: TestAffixComponent; let dl: DebugElement; - let component: NzAffixComponent; - let page: PageObject; + beforeEach(() => { TestBed.configureTestingModule({ imports: [NzAffixModule], @@ -475,9 +473,7 @@ describe('affix-extra', () => { }).compileComponents(); fixture = TestBed.createComponent(TestAffixComponent); context = fixture.componentInstance; - component = context.nzAffixComponent; dl = fixture.debugElement; - page = new PageObject(); }); it('#getOffset', () => { const ret = fixture.componentInstance.nzAffixComponent.getOffset(fixture.debugElement.query(By.css('#affix')).nativeElement, window); @@ -504,9 +500,6 @@ describe('affix-extra', () => { const ret = +(el.querySelector('.ant-affix') as HTMLElement).style.bottom.replace('px', ''); expect(ret).toBe(value); })); - class PageObject { - - } }); @Component({ diff --git a/components/affix/nz-affix.component.ts b/components/affix/nz-affix.component.ts index 22a13dba504..928d3615626 100644 --- a/components/affix/nz-affix.component.ts +++ b/components/affix/nz-affix.component.ts @@ -1,7 +1,6 @@ import { DOCUMENT } from '@angular/common'; import { ChangeDetectionStrategy, - ChangeDetectorRef, Component, ElementRef, EventEmitter, @@ -66,7 +65,7 @@ export class NzAffixComponent implements OnInit, OnDestroy { readonly nzChange: EventEmitter = new EventEmitter(); // tslint:disable-next-line:no-any - constructor(_el: ElementRef, private scrollSrv: NzScrollService, @Inject(DOCUMENT) private doc: any, private cd: ChangeDetectorRef) { + constructor(_el: ElementRef, private scrollSrv: NzScrollService, @Inject(DOCUMENT) private doc: any) { this.placeholderNode = _el.nativeElement; } diff --git a/components/alert/nz-alert.spec.ts b/components/alert/nz-alert.spec.ts index 3b4e799b87a..50286d46410 100644 --- a/components/alert/nz-alert.spec.ts +++ b/components/alert/nz-alert.spec.ts @@ -101,14 +101,14 @@ describe('alert', () => { }); describe('banner alert', () => { let fixture; - let testComponent; let alert; + beforeEach(() => { fixture = TestBed.createComponent(NzDemoTestBannerComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; alert = fixture.debugElement.query(By.directive(NzAlertComponent)); }); + it('should banner work', () => { fixture.detectChanges(); expect(alert.nativeElement.querySelector('.ant-alert').classList).toContain(`ant-alert-warning`); diff --git a/components/anchor/anchor.spec.ts b/components/anchor/anchor.spec.ts index 124860d5307..067b26d934a 100644 --- a/components/anchor/anchor.spec.ts +++ b/components/anchor/anchor.spec.ts @@ -1,10 +1,9 @@ // tslint:disable -import { fakeAsync, tick, TestBed, ComponentFixture, async } from '@angular/core/testing'; +import { fakeAsync, tick, TestBed, ComponentFixture } from '@angular/core/testing'; import { Component, DebugElement, ViewChild } from '@angular/core'; import { By } from '@angular/platform-browser'; import { NzAnchorModule } from './nz-anchor.module'; import { NzAnchorComponent } from './nz-anchor.component'; -import { NzAnchorLinkComponent } from './nz-anchor-link.component'; import { NzScrollService } from '../core/scroll/nz-scroll.service'; const throttleTime = 51; diff --git a/components/anchor/nz-anchor-link.component.ts b/components/anchor/nz-anchor-link.component.ts index b8f203177df..443449f4135 100644 --- a/components/anchor/nz-anchor-link.component.ts +++ b/components/anchor/nz-anchor-link.component.ts @@ -4,7 +4,6 @@ import { Component, ContentChild, ElementRef, - HostBinding, Input, OnDestroy, OnInit, Renderer2, diff --git a/components/auto-complete/nz-autocomplete.spec.ts b/components/auto-complete/nz-autocomplete.spec.ts index 954529910db..9cf4a0adbcb 100644 --- a/components/auto-complete/nz-autocomplete.spec.ts +++ b/components/auto-complete/nz-autocomplete.spec.ts @@ -831,12 +831,10 @@ describe('auto-complete', () => { describe('Fallback positions', () => { let fixture; - let input: HTMLInputElement; beforeEach(() => { fixture = TestBed.createComponent(NzTestSimpleAutocompleteComponent); fixture.detectChanges(); - input = fixture.debugElement.query(By.css('input')).nativeElement; }); it('should use bottom positioning by default', fakeAsync(() => { diff --git a/components/back-top/back-top.spec.ts b/components/back-top/back-top.spec.ts index cb7ceeab521..20642a2e3d1 100644 --- a/components/back-top/back-top.spec.ts +++ b/components/back-top/back-top.spec.ts @@ -20,7 +20,6 @@ import { NzBackTopModule } from './nz-back-top.module'; describe('Component:nz-back-top', () => { let scrollService: MockNzScrollService; let fixture: ComponentFixture; - let context: TestBackTopComponent; let debugElement: DebugElement; let component: NzBackTopComponent; let componentObject: NzBackTopPageObject; @@ -57,7 +56,6 @@ describe('Component:nz-back-top', () => { }).compileComponents(); fixture = TestBed.createComponent(TestBackTopComponent); - context = fixture.componentInstance; component = fixture.componentInstance.nzBackTopComponent; componentObject = new NzBackTopPageObject(); debugElement = fixture.debugElement; @@ -199,9 +197,7 @@ describe('Component:nz-back-top', () => { describe('#nzTemplate', () => { it(`should show custom template`, fakeAsync(() => { let fixtureTemplate: ComponentFixture; - let contextTemplate: TestBackTopTemplateComponent; fixtureTemplate = TestBed.createComponent(TestBackTopTemplateComponent); - contextTemplate = fixture.componentInstance; componentObject.scrollTo(window, defaultVisibilityHeight + 1); tick(); diff --git a/components/breadcrumb/nz-breadcrumb-item.component.ts b/components/breadcrumb/nz-breadcrumb-item.component.ts index a421cbea7fe..0fa2d4a49c4 100755 --- a/components/breadcrumb/nz-breadcrumb-item.component.ts +++ b/components/breadcrumb/nz-breadcrumb-item.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, TemplateRef, ViewEncapsulation } from '@angular/core'; +import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core'; import { NzBreadCrumbComponent } from './nz-breadcrumb.component'; diff --git a/components/breadcrumb/nz-breadcrumb.spec.ts b/components/breadcrumb/nz-breadcrumb.spec.ts index bfbd14decf0..6a0f3d65f0d 100644 --- a/components/breadcrumb/nz-breadcrumb.spec.ts +++ b/components/breadcrumb/nz-breadcrumb.spec.ts @@ -15,7 +15,6 @@ import { NzBreadCrumbComponent } from './nz-breadcrumb.component'; import { NzBreadCrumbModule } from './nz-breadcrumb.module'; describe('breadcrumb', () => { - let testComponent; let fixture; describe('basic', () => { @@ -31,7 +30,6 @@ describe('breadcrumb', () => { beforeEach(() => { fixture = TestBed.createComponent(NzDemoBreadcrumbBasicComponent); - testComponent = fixture.debugElement.componentInstance; items = fixture.debugElement.queryAll(By.directive(NzBreadCrumbItemComponent)); breadcrumb = fixture.debugElement.query(By.directive(NzBreadCrumbComponent)); }); @@ -56,7 +54,6 @@ describe('breadcrumb', () => { beforeEach(() => { fixture = TestBed.createComponent(NzDemoBreadcrumbSeparatorComponent); - testComponent = fixture.debugElement.componentInstance; items = fixture.debugElement.queryAll(By.directive(NzBreadCrumbItemComponent)); breadcrumbs = fixture.debugElement.queryAll(By.directive(NzBreadCrumbComponent)); }); @@ -83,7 +80,6 @@ describe('breadcrumb', () => { declarations: [ NzBreadcrumbAutoGenerateDemoComponent, NzBreadcrumbNullComponent ] }).compileComponents(); fixture = TestBed.createComponent(NzBreadcrumbAutoGenerateDemoComponent); - testComponent = fixture.debugElement.componentInstance; breadcrumb = fixture.debugElement.query(By.directive(NzBreadCrumbComponent)); fixture.ngZone.run(() => { @@ -125,7 +121,6 @@ describe('breadcrumb', () => { expect(() => { TestBed.compileComponents(); fixture = TestBed.createComponent(NzBreadcrumbAutoGenerateErrorDemoComponent); - testComponent = fixture.debugElement.componentInstance; fixture.detectChanges(); }).toThrowError(); })); diff --git a/components/calendar/nz-calendar-header.component.ts b/components/calendar/nz-calendar-header.component.ts index 7acf93799c4..4158779f5c6 100644 --- a/components/calendar/nz-calendar-header.component.ts +++ b/components/calendar/nz-calendar-header.component.ts @@ -58,8 +58,6 @@ export class NzCalendarHeaderComponent implements OnInit { return this.i18n.getLocale().Calendar.month; } - private prefixCls = 'ant-fullcalendar'; - constructor(private i18n: I18n, private dateHelper: DateHelperService) { } diff --git a/components/calendar/nz-calendar-header.spec.ts b/components/calendar/nz-calendar-header.spec.ts index 0ec7a98612d..6fedad67220 100644 --- a/components/calendar/nz-calendar-header.spec.ts +++ b/components/calendar/nz-calendar-header.spec.ts @@ -109,11 +109,9 @@ describe('Calendar Header', () => { describe('activeDate', () => { let fixture: ComponentFixture; - let component: NzTestCalendarHeaderActiveDateComponent; beforeEach(async(() => { fixture = TestBed.createComponent(NzTestCalendarHeaderActiveDateComponent); - component = fixture.componentInstance; })); it('should be now by default', () => { @@ -164,7 +162,7 @@ describe('Calendar Header', () => { it('should emit monthChange when month changed', () => { fixture.detectChanges(); const header = fixture.debugElement.queryAll(By.directive(CalendarHeader))[0]; - const [_, monthModel] = header.queryAll(By.directive(Select)).map(x => x.injector.get(NgModel)); + const monthModel = header.queryAll(By.directive(Select)).map(x => x.injector.get(NgModel))[1]; monthModel.viewToModelUpdate(2); diff --git a/components/calendar/nz-calendar.component.ts b/components/calendar/nz-calendar.component.ts index 0d27cd3d09e..f1a91c90e76 100644 --- a/components/calendar/nz-calendar.component.ts +++ b/components/calendar/nz-calendar.component.ts @@ -88,7 +88,6 @@ export class NzCalendarComponent implements ControlValueAccessor, OnInit { monthCell: TemplateRef<{$implicit: Date}>|null = null; monthFullCell: TemplateRef<{$implicit: Date}>|null = null; - private prefixCls = 'ant-fullcalendar'; private currentDate = new Date(); private onChangeFn: (date: Date) => void = () => {}; private onTouchFn: () => void = () => {}; diff --git a/components/calendar/nz-calendar.spec.ts b/components/calendar/nz-calendar.spec.ts index 71af14b759b..1b15c9c482e 100644 --- a/components/calendar/nz-calendar.spec.ts +++ b/components/calendar/nz-calendar.spec.ts @@ -278,11 +278,9 @@ describe('Calendar', () => { describe('dateCell', () => { let fixture: ComponentFixture; - let component: NzTestCalendarDateCellComponent; beforeEach(async(() => { fixture = TestBed.createComponent(NzTestCalendarDateCellComponent); - component = fixture.componentInstance; })); it('should work when passed via property', () => { @@ -306,11 +304,9 @@ describe('Calendar', () => { describe('dateFullCell', () => { let fixture: ComponentFixture; - let component: NzTestCalendarDateFullCellComponent; beforeEach(async(() => { fixture = TestBed.createComponent(NzTestCalendarDateFullCellComponent); - component = fixture.componentInstance; })); it('should work when passed via property', () => { @@ -334,11 +330,9 @@ describe('Calendar', () => { describe('monthCell', () => { let fixture: ComponentFixture; - let component: NzTestCalendarMonthCellComponent; beforeEach(async(() => { fixture = TestBed.createComponent(NzTestCalendarMonthCellComponent); - component = fixture.componentInstance; })); it('should work when passed via property', () => { @@ -362,11 +356,9 @@ describe('Calendar', () => { describe('monthFullCell', () => { let fixture: ComponentFixture; - let component: NzTestCalendarMonthFullCellComponent; beforeEach(async(() => { fixture = TestBed.createComponent(NzTestCalendarMonthFullCellComponent); - component = fixture.componentInstance; })); it('should work when passed via property', () => { diff --git a/components/cascader/nz-cascader.spec.ts b/components/cascader/nz-cascader.spec.ts index de43ebfaf7d..d95cc68402b 100644 --- a/components/cascader/nz-cascader.spec.ts +++ b/components/cascader/nz-cascader.spec.ts @@ -126,7 +126,6 @@ describe('cascader', () => { it('should showArrow work', () => { testComponent.nzShowArrow = true; fixture.detectChanges(); - const arrow: HTMLElement = cascader.nativeElement.querySelector('.ant-cascader-picker-arrow'); expect(cascader.nativeElement.querySelector('.ant-cascader-picker-arrow')).toBeDefined(); expect(cascader.nativeElement.querySelector('.ant-cascader-picker-arrow').classList).toContain('anticon-down'); testComponent.nzShowArrow = false; @@ -135,7 +134,6 @@ describe('cascader', () => { }); it('should allowClear work', () => { fixture.detectChanges(); - const input: HTMLElement = cascader.nativeElement.querySelector('.ant-cascader-input'); testComponent.values = [ 'zhejiang', 'hangzhou', 'xihu' ]; fixture.detectChanges(); expect(cascader.nativeElement.querySelector('.ant-cascader-picker-clear')).toBeDefined(); diff --git a/components/collapse/nz-collapse.spec.ts b/components/collapse/nz-collapse.spec.ts index 124edbd8d8d..9be43a68485 100644 --- a/components/collapse/nz-collapse.spec.ts +++ b/components/collapse/nz-collapse.spec.ts @@ -139,14 +139,10 @@ describe('collapse', () => { }); describe('collapse template', () => { let fixture; - let testComponent; - let collapse; let panels; beforeEach(() => { fixture = TestBed.createComponent(NzTestCollapseTemplateComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; - collapse = fixture.debugElement.query(By.directive(NzCollapseComponent)); panels = fixture.debugElement.queryAll(By.directive(NzCollapsePanelComponent)); }); it('should header work', () => { diff --git a/components/core/scroll/nz-scroll.service.spec.ts b/components/core/scroll/nz-scroll.service.spec.ts index 28ccb3b06b3..b4d4b1b20f4 100644 --- a/components/core/scroll/nz-scroll.service.spec.ts +++ b/components/core/scroll/nz-scroll.service.spec.ts @@ -9,7 +9,6 @@ describe('NzScrollService', () => { const TOP: number = 10; let injector: ReflectiveInjector; let document: MockDocument; - let location: MockPlatformLocation; let scrollService: NzScrollService; class MockDocument { @@ -39,7 +38,6 @@ describe('NzScrollService', () => { { provide: DOCUMENT, useClass: MockDocument }, { provide: PlatformLocation, useClass: MockPlatformLocation } ]); - location = injector.get(PlatformLocation); document = injector.get(DOCUMENT); scrollService = injector.get(NzScrollService); }); diff --git a/components/core/wave/nz-wave.spec.ts b/components/core/wave/nz-wave.spec.ts index 123c27460b3..88fc9fdb6e7 100644 --- a/components/core/wave/nz-wave.spec.ts +++ b/components/core/wave/nz-wave.spec.ts @@ -11,7 +11,6 @@ const EXTRA_NODE_CLASS_NAME = '.ant-click-animating-node'; describe('nz-wave', () => { let fixture: ComponentFixture; let waveTarget: HTMLElement; - let waveDirective: NzWaveDirective; beforeEach(() => { TestBed.configureTestingModule({ @@ -29,7 +28,6 @@ describe('nz-wave', () => { fixture = TestBed.createComponent(WaveContainerWithButtonComponent); fixture.detectChanges(); waveTarget = fixture.componentInstance.trigger.nativeElement; - waveDirective = fixture.componentInstance.wave; }); it('should create wave on click', () => { @@ -114,7 +112,6 @@ describe('nz-wave', () => { fixture = TestBed.createComponent(WaveContainerWithExtraNodeComponent); fixture.detectChanges(); waveTarget = fixture.componentInstance.trigger.nativeElement; - waveDirective = fixture.componentInstance.wave; }); it('should create wave on click', () => { diff --git a/components/date-picker/date-picker.component.spec.ts b/components/date-picker/date-picker.component.spec.ts index 884b2283917..b5101f7acef 100644 --- a/components/date-picker/date-picker.component.spec.ts +++ b/components/date-picker/date-picker.component.spec.ts @@ -9,9 +9,7 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import isSameDay from 'date-fns/is_same_day'; -import en from 'date-fns/locale/en'; import { dispatchKeyboardEvent, dispatchMouseEvent } from '../core/testing'; -import { NZ_DATE_CONFIG } from '../i18n/date-config'; import en_US from '../i18n/languages/en_US'; import { NzI18nModule } from '../i18n/nz-i18n.module'; import { NzI18nService } from '../i18n/nz-i18n.service'; @@ -527,7 +525,6 @@ describe('NzDatePickerComponent', () => { })); it('should support nzShowTime', fakeAsync(() => { - const nzOnChange = spyOn(fixtureInstance, 'nzOnChange'); fixtureInstance.nzValue = new Date('2018-11-11 11:22:33'); fixtureInstance.nzShowTime = true; fixture.detectChanges(); diff --git a/components/date-picker/demo/extra-footer.ts b/components/date-picker/demo/extra-footer.ts index b3bd9f02b96..b545c3b5ccb 100644 --- a/components/date-picker/demo/extra-footer.ts +++ b/components/date-picker/demo/extra-footer.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; @Component({ selector: 'nz-demo-date-picker-extra-footer', diff --git a/components/date-picker/month-picker.component.spec.ts b/components/date-picker/month-picker.component.spec.ts index 19478506088..e07295b90ab 100644 --- a/components/date-picker/month-picker.component.spec.ts +++ b/components/date-picker/month-picker.component.spec.ts @@ -20,7 +20,6 @@ describe('NzMonthPickerComponent', () => { let fixture: ComponentFixture; let fixtureInstance: NzTestMonthPickerComponent; let debugElement: DebugElement; - let overlayContainer: OverlayContainer; let overlayContainerElement: HTMLElement; beforeEach(fakeAsync(() => { @@ -42,7 +41,6 @@ describe('NzMonthPickerComponent', () => { }); beforeEach(inject([ OverlayContainer ], (oc: OverlayContainer) => { - overlayContainer = oc; overlayContainerElement = oc.getContainerElement(); })); diff --git a/components/date-picker/range-picker.component.spec.ts b/components/date-picker/range-picker.component.spec.ts index da9f2e306ce..e703b8ef079 100644 --- a/components/date-picker/range-picker.component.spec.ts +++ b/components/date-picker/range-picker.component.spec.ts @@ -305,7 +305,6 @@ describe('NzRangePickerComponent', () => { })); it('should support nzShowTime', fakeAsync(() => { - const nzOnChange = spyOn(fixtureInstance, 'modelValueChange'); fixtureInstance.modelValue = [ new Date('2018-11-11 11:22:33'), new Date('2018-12-12 11:22:33') ]; fixtureInstance.nzShowTime = true; fixture.detectChanges(); diff --git a/components/date-picker/year-picker.component.spec.ts b/components/date-picker/year-picker.component.spec.ts index a8d791c8da4..ae57144d2f2 100644 --- a/components/date-picker/year-picker.component.spec.ts +++ b/components/date-picker/year-picker.component.spec.ts @@ -15,7 +15,6 @@ describe('NzYearPickerComponent', () => { let fixture: ComponentFixture; let fixtureInstance: NzTestYearPickerComponent; let debugElement: DebugElement; - let overlayContainer: OverlayContainer; let overlayContainerElement: HTMLElement; beforeEach(fakeAsync(() => { @@ -37,7 +36,6 @@ describe('NzYearPickerComponent', () => { }); beforeEach(inject([ OverlayContainer ], (oc: OverlayContainer) => { - overlayContainer = oc; overlayContainerElement = oc.getContainerElement(); })); diff --git a/components/drawer/nz-drawer.component.ts b/components/drawer/nz-drawer.component.ts index 1743bee5a8d..0a6aab850ce 100644 --- a/components/drawer/nz-drawer.component.ts +++ b/components/drawer/nz-drawer.component.ts @@ -4,7 +4,6 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, - ElementRef, EventEmitter, Inject, Injector, @@ -150,7 +149,6 @@ export class NzDrawerComponent extends NzDrawerRef @Optional() @Inject(DOCUMENT) private document: any, private renderer: Renderer2, private overlay: Overlay, - private elementRef: ElementRef, private injector: Injector, private changeDetectorRef: ChangeDetectorRef, private focusTrapFactory: FocusTrapFactory, diff --git a/components/drawer/nz-drawer.service.ts b/components/drawer/nz-drawer.service.ts index 40a256a0d87..a6abcd689da 100644 --- a/components/drawer/nz-drawer.service.ts +++ b/components/drawer/nz-drawer.service.ts @@ -14,7 +14,7 @@ export class DrawerBuilderForService { constructor(private overlay: Overlay, private options: NzDrawerOptions) { this.createDrawer(); - this.updateOptions(options); + this.updateOptions(this.options); // Prevent repeatedly open drawer when tap focus element. this.drawerRef.instance.savePreviouslyFocusedElement(); this.drawerRef.instance.nzOnViewInit diff --git a/components/drawer/nz-drawer.spec.ts b/components/drawer/nz-drawer.spec.ts index 0c7b94353fb..de675834536 100644 --- a/components/drawer/nz-drawer.spec.ts +++ b/components/drawer/nz-drawer.spec.ts @@ -1,8 +1,4 @@ -import { - Component, Input, - TemplateRef, - ViewChild -} from '@angular/core'; +import { Component, Input, TemplateRef, ViewChild } from '@angular/core'; import { async, fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; diff --git a/components/dropdown/nz-dropdown-a.directive.ts b/components/dropdown/nz-dropdown-a.directive.ts index 6506de8d74a..0f931d8d6fd 100644 --- a/components/dropdown/nz-dropdown-a.directive.ts +++ b/components/dropdown/nz-dropdown-a.directive.ts @@ -5,6 +5,6 @@ import { Directive, ElementRef, Renderer2 } from '@angular/core'; }) export class NzDropDownADirective { constructor(private elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-dropdown-link'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-dropdown-link'); } } diff --git a/components/dropdown/nz-dropdown-button.component.ts b/components/dropdown/nz-dropdown-button.component.ts index 7b0e552b384..161243cd8c3 100644 --- a/components/dropdown/nz-dropdown-button.component.ts +++ b/components/dropdown/nz-dropdown-button.component.ts @@ -8,7 +8,6 @@ import { OnChanges, OnDestroy, Output, - Renderer2, ViewChild, ViewEncapsulation } from '@angular/core'; @@ -49,8 +48,8 @@ export class NzDropDownButtonComponent extends NzDropDownComponent implements On @Output() readonly nzClick = new EventEmitter(); @ViewChild(NzDropDownDirective) nzDropDownDirective: NzDropDownDirective; - constructor(renderer: Renderer2, cdr: ChangeDetectorRef, nzMenuDropdownService: NzMenuDropdownService) { - super(renderer, cdr, nzMenuDropdownService); + constructor(cdr: ChangeDetectorRef, nzMenuDropdownService: NzMenuDropdownService) { + super(cdr, nzMenuDropdownService); } /** rewrite afterViewInit hook */ diff --git a/components/dropdown/nz-dropdown.component.ts b/components/dropdown/nz-dropdown.component.ts index dd91909a51c..6f8a2225e95 100644 --- a/components/dropdown/nz-dropdown.component.ts +++ b/components/dropdown/nz-dropdown.component.ts @@ -10,7 +10,6 @@ import { OnChanges, OnDestroy, Output, - Renderer2, SimpleChanges, ViewChild, ViewEncapsulation @@ -104,7 +103,7 @@ export class NzDropDownComponent implements OnDestroy, AfterContentInit, OnChang } } - constructor(private renderer: Renderer2, protected cdr: ChangeDetectorRef, private nzMenuDropdownService: NzMenuDropdownService) { + constructor(protected cdr: ChangeDetectorRef, private nzMenuDropdownService: NzMenuDropdownService) { } ngOnDestroy(): void { diff --git a/components/dropdown/nz-dropdown.spec.ts b/components/dropdown/nz-dropdown.spec.ts index 7a305e7db96..c4c31ba9ea6 100644 --- a/components/dropdown/nz-dropdown.spec.ts +++ b/components/dropdown/nz-dropdown.spec.ts @@ -328,7 +328,6 @@ describe('dropdown', () => { testComponent.nzDropdownService.create(fakeEvent, testComponent.template); fixture.detectChanges(); expect(overlayContainerElement.textContent).not.toBe(''); - const overlayPane = overlayContainerElement.querySelector('.cdk-overlay-pane') as HTMLElement; // https://github.com/angular/material2/pull/12119 // TODO: fix // expect(window.getComputedStyle(overlayPane, null).top).toBe(`${300 - overlayContainerElement.getBoundingClientRect().top}px`); diff --git a/components/empty/demo/config.ts b/components/empty/demo/config.ts index f29a4e6e481..08adb6c4822 100644 --- a/components/empty/demo/config.ts +++ b/components/empty/demo/config.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, TemplateRef, ViewChild } from '@angular/core'; +import { Component, TemplateRef, ViewChild } from '@angular/core'; import { NzEmptyService } from 'ng-zorro-antd'; @Component({ diff --git a/components/empty/nz-embed-empty.component.ts b/components/empty/nz-embed-empty.component.ts index d6781cf6111..1392c8da97f 100644 --- a/components/empty/nz-embed-empty.component.ts +++ b/components/empty/nz-embed-empty.component.ts @@ -17,7 +17,6 @@ import { DomSanitizer } from '@angular/platform-browser'; import { Subscription } from 'rxjs'; import { simpleEmptyImage, NzEmptyCustomContent, NzEmptySize, NZ_EMPTY_COMPONENT_NAME } from './nz-empty-config'; -import { getEmptyContentTypeError } from './nz-empty-error'; import { NzEmptyService } from './nz-empty.service'; @Component({ diff --git a/components/form/demo/coordinated.ts b/components/form/demo/coordinated.ts index 3d62d59b2ef..8e00adfa16e 100644 --- a/components/form/demo/coordinated.ts +++ b/components/form/demo/coordinated.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core'; import { - AbstractControl, FormBuilder, FormGroup, Validators diff --git a/components/form/demo/normal-login.ts b/components/form/demo/normal-login.ts index ea12cd1af8c..709208f211c 100644 --- a/components/form/demo/normal-login.ts +++ b/components/form/demo/normal-login.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core'; import { - AbstractControl, FormBuilder, FormGroup, Validators diff --git a/components/form/demo/time-related-controls.ts b/components/form/demo/time-related-controls.ts index d23795129a1..f0fe99424a6 100644 --- a/components/form/demo/time-related-controls.ts +++ b/components/form/demo/time-related-controls.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, - Validators } from '@angular/forms'; @Component({ diff --git a/components/form/nz-form-control.spec.ts b/components/form/nz-form-control.spec.ts index 715fedaabce..fbc0a394374 100644 --- a/components/form/nz-form-control.spec.ts +++ b/components/form/nz-form-control.spec.ts @@ -143,12 +143,10 @@ describe('nz-form-control', () => { }); describe('reactive init status', () => { let fixture; - let testComponent; let formControl; beforeEach(() => { fixture = TestBed.createComponent(NzTestReactiveFormControlInitStatusComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; formControl = fixture.debugElement.query(By.directive(NzFormControlComponent)); }); it('should init status correct', fakeAsync(() => { diff --git a/components/form/nz-form-explain.component.ts b/components/form/nz-form-explain.component.ts index ee0be0d41f9..c7953b0e061 100644 --- a/components/form/nz-form-explain.component.ts +++ b/components/form/nz-form-explain.component.ts @@ -16,6 +16,6 @@ import { helpMotion } from '../core/animation/help'; }) export class NzFormExplainComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-form-explain'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-form-explain'); } } diff --git a/components/form/nz-form-extra.component.ts b/components/form/nz-form-extra.component.ts index 982f8229f94..9a05cbb1f37 100644 --- a/components/form/nz-form-extra.component.ts +++ b/components/form/nz-form-extra.component.ts @@ -16,6 +16,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzFormExtraComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-form-extra'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-form-extra'); } } diff --git a/components/form/nz-form-split.component.ts b/components/form/nz-form-split.component.ts index 9da9ac00b18..e36ae85fc0e 100644 --- a/components/form/nz-form-split.component.ts +++ b/components/form/nz-form-split.component.ts @@ -9,6 +9,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzFormSplitComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-form-split'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-form-split'); } } diff --git a/components/form/nz-form-split.spec.ts b/components/form/nz-form-split.spec.ts index 5f286ce1762..567fbc8b4d2 100644 --- a/components/form/nz-form-split.spec.ts +++ b/components/form/nz-form-split.spec.ts @@ -14,12 +14,10 @@ describe('nz-form-split', () => { })); describe('default', () => { let fixture; - let testComponent; let split; beforeEach(() => { fixture = TestBed.createComponent(NzTestFormSplitComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; split = fixture.debugElement.query(By.directive(NzFormSplitComponent)); }); it('should className correct', () => { diff --git a/components/form/nz-form-text.component.ts b/components/form/nz-form-text.component.ts index 65843ce2a4f..eaa602ae6b9 100644 --- a/components/form/nz-form-text.component.ts +++ b/components/form/nz-form-text.component.ts @@ -9,6 +9,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzFormTextComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-form-text'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-form-text'); } } diff --git a/components/form/nz-form-text.spec.ts b/components/form/nz-form-text.spec.ts index 97389658baf..cc6c111b706 100644 --- a/components/form/nz-form-text.spec.ts +++ b/components/form/nz-form-text.spec.ts @@ -14,12 +14,10 @@ describe('nz-form-text', () => { })); describe('default', () => { let fixture; - let testComponent; let text; beforeEach(() => { fixture = TestBed.createComponent(NzTestFormTextComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; text = fixture.debugElement.query(By.directive(NzFormTextComponent)); }); it('should className correct', () => { diff --git a/components/form/nz-form.directive.ts b/components/form/nz-form.directive.ts index 0d376c3ebf9..e59acadfd7f 100644 --- a/components/form/nz-form.directive.ts +++ b/components/form/nz-form.directive.ts @@ -15,7 +15,7 @@ export class NzFormDirective implements OnInit, OnChanges { } constructor(private elementRef: ElementRef, private renderer: Renderer2, private nzUpdateHostClassService: NzUpdateHostClassService) { - renderer.addClass(elementRef.nativeElement, 'ant-form'); + this.renderer.addClass(elementRef.nativeElement, 'ant-form'); } ngOnInit(): void { diff --git a/components/icon/nz-icon.spec.ts b/components/icon/nz-icon.spec.ts index fd49e056657..a053e594cb6 100644 --- a/components/icon/nz-icon.spec.ts +++ b/components/icon/nz-icon.spec.ts @@ -131,13 +131,11 @@ describe('nz icon', () => { }); describe('custom', () => { - let testComponent: NzTestIconCustomComponent; let fixture: ComponentFixture; let icons: DebugElement[]; beforeEach(() => { fixture = TestBed.createComponent(NzTestIconCustomComponent); - testComponent = fixture.debugElement.componentInstance; }); it('should support custom svg element', () => { @@ -151,13 +149,11 @@ describe('nz icon', () => { }); describe('iconfont', () => { - let testComponent: NzTestIconIconfontComponent; let fixture: ComponentFixture; let icons: DebugElement[]; beforeEach(() => { fixture = TestBed.createComponent(NzTestIconIconfontComponent); - testComponent = fixture.debugElement.componentInstance; }); it('should support iconfont', async(() => { @@ -174,13 +170,11 @@ describe('nz icon', () => { }); describe('old api', () => { - let testComponent: NzTestIconOldApiComponent; let fixture: ComponentFixture; let icons: DebugElement[]; beforeEach(() => { fixture = TestBed.createComponent(NzTestIconOldApiComponent); - testComponent = fixture.debugElement.componentInstance; icons = fixture.debugElement.queryAll(By.directive(NzIconDirective)); }); @@ -192,13 +186,11 @@ describe('nz icon', () => { }); describe('prefix', () => { - let testComponent: NzTestIconPrefixComponent; let fixture: ComponentFixture; let icons: DebugElement[]; beforeEach(() => { fixture = TestBed.createComponent(NzTestIconPrefixComponent); - testComponent = fixture.debugElement.componentInstance; icons = fixture.debugElement.queryAll(By.directive(NzIconDirective)); }); @@ -212,7 +204,6 @@ describe('nz icon', () => { }); describe('nz icon twotone color injection', () => { - let testComponent: NzTestIconExtensionsComponent; let fixture: ComponentFixture; let icons: DebugElement[]; @@ -233,7 +224,6 @@ describe('nz icon twotone color injection', () => { }); fixture = TestBed.createComponent(NzTestIconExtensionsComponent); - testComponent = fixture.debugElement.componentInstance; fixture.detectChanges(); icons = fixture.debugElement.queryAll(By.directive(NzIconDirective)); @@ -258,7 +248,6 @@ describe('nz icon twotone color injection', () => { }); fixture = TestBed.createComponent(NzTestIconExtensionsComponent); - testComponent = fixture.debugElement.componentInstance; icons = fixture.debugElement.queryAll(By.directive(NzIconDirective)); fixture.detectChanges(); diff --git a/components/input-number/nz-input-number.spec.ts b/components/input-number/nz-input-number.spec.ts index 53a13805150..0334a5198a9 100644 --- a/components/input-number/nz-input-number.spec.ts +++ b/components/input-number/nz-input-number.spec.ts @@ -406,9 +406,7 @@ describe('input number', () => { let fixture; let testComponent; let inputNumber; - let inputElement; let upHandler; - let downHandler; beforeEach(fakeAsync(() => { fixture = TestBed.createComponent(NzTestInputNumberFormComponent); fixture.detectChanges(); @@ -416,9 +414,7 @@ describe('input number', () => { fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; inputNumber = fixture.debugElement.query(By.directive(NzInputNumberComponent)); - inputElement = inputNumber.nativeElement.querySelector('input') as HTMLInputElement; upHandler = inputNumber.nativeElement.querySelector('.ant-input-number-handler-up'); - downHandler = inputNumber.nativeElement.querySelector('.ant-input-number-handler-down'); })); it('should be in pristine, untouched, and valid states initially', fakeAsync(() => { flush(); diff --git a/components/input/nz-input-group.spec.ts b/components/input/nz-input-group.spec.ts index 47564900b1c..4e98ce293bd 100644 --- a/components/input/nz-input-group.spec.ts +++ b/components/input/nz-input-group.spec.ts @@ -4,7 +4,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzInputGroupComponent } from './nz-input-group.component'; -import { NzInputDirective } from './nz-input.directive'; import { NzInputModule } from './nz-input.module'; describe('input-group', () => { @@ -131,13 +130,11 @@ describe('input-group', () => { }); describe('multiple', () => { let inputGroupElement; - let inputs; beforeEach(() => { fixture = TestBed.createComponent(NzTestInputGroupMultipleComponent); testComponent = fixture.debugElement.componentInstance; fixture.detectChanges(); inputGroupElement = fixture.debugElement.query(By.directive(NzInputGroupComponent)).nativeElement; - inputs = fixture.debugElement.queryAll(By.directive(NzInputDirective)); }); it('should compact work', () => { expect(inputGroupElement.classList).not.toContain('ant-input-group-compact'); diff --git a/components/karma.conf.js b/components/karma.conf.js index 851a3a05f32..58ce76f8c82 100644 --- a/components/karma.conf.js +++ b/components/karma.conf.js @@ -13,7 +13,7 @@ module.exports = function (config) { require('@angular-devkit/build-angular/plugins/karma') ], client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser + clearContext: true // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: require('path').join(__dirname, '../coverage'), diff --git a/components/layout/nz-content.component.ts b/components/layout/nz-content.component.ts index 8fc7d461bd9..3519857425f 100644 --- a/components/layout/nz-content.component.ts +++ b/components/layout/nz-content.component.ts @@ -14,6 +14,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzContentComponent { constructor(private elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-layout-content'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-layout-content'); } } diff --git a/components/layout/nz-footer.component.ts b/components/layout/nz-footer.component.ts index 83bfe7576c4..cdd96640655 100644 --- a/components/layout/nz-footer.component.ts +++ b/components/layout/nz-footer.component.ts @@ -14,6 +14,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzFooterComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-layout-footer'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-layout-footer'); } } diff --git a/components/layout/nz-header.component.ts b/components/layout/nz-header.component.ts index fa391a00ec5..2fca0ec9233 100644 --- a/components/layout/nz-header.component.ts +++ b/components/layout/nz-header.component.ts @@ -14,6 +14,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzHeaderComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-layout-header'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-layout-header'); } } diff --git a/components/layout/nz-layout.spec.ts b/components/layout/nz-layout.spec.ts index cc7cbb0eb3c..b9dedf0c452 100644 --- a/components/layout/nz-layout.spec.ts +++ b/components/layout/nz-layout.spec.ts @@ -144,8 +144,6 @@ describe('layout', () => { }); }); describe('custom-trigger', () => { - let sider; - beforeEach(async(() => { TestBed.configureTestingModule({ imports : [ NzLayoutModule, NzIconTestModule ], @@ -158,7 +156,6 @@ describe('layout', () => { beforeEach(() => { fixture = TestBed.createComponent(NzDemoLayoutCustomTriggerComponent); testComponent = fixture.debugElement.componentInstance; - sider = fixture.debugElement.query(By.directive(NzSiderComponent)).injector.get(NzSiderComponent); }); it('should not display trigger', () => { fixture.detectChanges(); diff --git a/components/list/nz-list-item-meta.component.ts b/components/list/nz-list-item-meta.component.ts index 1b0a8c78866..4ca667529e5 100644 --- a/components/list/nz-list-item-meta.component.ts +++ b/components/list/nz-list-item-meta.component.ts @@ -35,6 +35,6 @@ export class NzListItemMetaComponent { @Input() nzDescription: string | TemplateRef; constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-list-item-meta'); + this.renderer.addClass(elementRef.nativeElement, 'ant-list-item-meta'); } } diff --git a/components/list/nz-list-item.component.ts b/components/list/nz-list-item.component.ts index 0d4cc54fdf6..06e5b3eeb24 100644 --- a/components/list/nz-list-item.component.ts +++ b/components/list/nz-list-item.component.ts @@ -25,6 +25,6 @@ export class NzListItemComponent { @Input() nzExtra: TemplateRef; constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-list-item'); + this.renderer.addClass(this.elementRef.nativeElement, 'ant-list-item'); } } diff --git a/components/list/nz-list.component.ts b/components/list/nz-list.component.ts index b1b98777cfb..dde78e89875 100644 --- a/components/list/nz-list.component.ts +++ b/components/list/nz-list.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, - ChangeDetectorRef, Component, ElementRef, Input, @@ -82,7 +81,7 @@ export class NzListComponent implements OnInit, OnChanges { // #endregion - constructor(private el: ElementRef, private cd: ChangeDetectorRef, private updateHostClassService: NzUpdateHostClassService) { + constructor(private el: ElementRef, private updateHostClassService: NzUpdateHostClassService) { } ngOnInit(): void { diff --git a/components/mention/nz-mention.component.ts b/components/mention/nz-mention.component.ts index ccd02047fa8..add62c34714 100644 --- a/components/mention/nz-mention.component.ts +++ b/components/mention/nz-mention.component.ts @@ -18,7 +18,6 @@ import { EventEmitter, Inject, Input, - NgZone, OnChanges, OnDestroy, Optional, @@ -110,7 +109,6 @@ export class NzMentionComponent implements OnDestroy, AfterContentInit, OnChange constructor(@Optional() @Inject(DOCUMENT) private ngDocument: any, // tslint:disable-line:no-any private changeDetectorRef: ChangeDetectorRef, - private ngZone: NgZone, private overlay: Overlay, private viewContainerRef: ViewContainerRef) { } diff --git a/components/mention/nz-mention.spec.ts b/components/mention/nz-mention.spec.ts index c1c54f71a19..d8ef9c3f99e 100644 --- a/components/mention/nz-mention.spec.ts +++ b/components/mention/nz-mention.spec.ts @@ -1,5 +1,5 @@ import { Directionality } from '@angular/cdk/bidi'; -import { DOWN_ARROW, ENTER, ESCAPE, LEFT_ARROW, RIGHT_ARROW, TAB, UP_ARROW } from '@angular/cdk/keycodes'; +import { DOWN_ARROW, ENTER, ESCAPE, RIGHT_ARROW, TAB, UP_ARROW } from '@angular/cdk/keycodes'; import { OverlayContainer } from '@angular/cdk/overlay'; import { ScrollDispatcher } from '@angular/cdk/scrolling'; import { @@ -166,7 +166,7 @@ describe('mention', () => { let DOWN_ARROW_EVENT: KeyboardEvent; let UP_ARROW_EVENT: KeyboardEvent; let ENTER_EVENT: KeyboardEvent; - let LEFT_EVENT: KeyboardEvent; + // let LEFT_EVENT: KeyboardEvent; let RIGHT_EVENT: KeyboardEvent; beforeEach(fakeAsync(() => { @@ -177,7 +177,7 @@ describe('mention', () => { DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW); UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW); ENTER_EVENT = createKeyboardEvent('keydown', ENTER); - LEFT_EVENT = createKeyboardEvent('keydown', LEFT_ARROW); + // LEFT_EVENT = createKeyboardEvent('keydown', LEFT_ARROW); RIGHT_EVENT = createKeyboardEvent('keydown', RIGHT_ARROW); fixture.detectChanges(); diff --git a/components/menu/nz-menu-divider.directive.ts b/components/menu/nz-menu-divider.directive.ts index df3a1ca7fb4..13b784d9247 100644 --- a/components/menu/nz-menu-divider.directive.ts +++ b/components/menu/nz-menu-divider.directive.ts @@ -5,6 +5,6 @@ import { Directive, ElementRef, Renderer2 } from '@angular/core'; }) export class NzMenuDividerDirective { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-dropdown-menu-item-divider'); + this.renderer.addClass(elementRef.nativeElement, 'ant-dropdown-menu-item-divider'); } } diff --git a/components/menu/nz-menu-group.component.ts b/components/menu/nz-menu-group.component.ts index 3f5e4266a7d..58bdca8c9fb 100644 --- a/components/menu/nz-menu-group.component.ts +++ b/components/menu/nz-menu-group.component.ts @@ -9,6 +9,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul }) export class NzMenuGroupComponent { constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-menu-item-group'); + this.renderer.addClass(elementRef.nativeElement, 'ant-menu-item-group'); } } diff --git a/components/menu/nz-menu.spec.ts b/components/menu/nz-menu.spec.ts index a5ded3e401a..625aad91a04 100644 --- a/components/menu/nz-menu.spec.ts +++ b/components/menu/nz-menu.spec.ts @@ -52,13 +52,11 @@ describe('menu', () => { describe('demo', () => { describe('horizontal', () => { let fixture; - let testComponent; let items; let submenu; let menu; beforeEach(() => { fixture = TestBed.createComponent(NzDemoMenuHorizontalComponent); - testComponent = fixture.debugElement.componentInstance; items = fixture.debugElement.queryAll(By.directive(NzMenuItemDirective)); submenu = fixture.debugElement.query(By.directive(NzSubMenuComponent)); menu = fixture.debugElement.query(By.directive(NzMenuDirective)); @@ -86,13 +84,11 @@ describe('menu', () => { }); describe('inline', () => { let fixture; - let testComponent; let items; let submenus; let menu; beforeEach(() => { fixture = TestBed.createComponent(NzDemoMenuInlineComponent); - testComponent = fixture.debugElement.componentInstance; items = fixture.debugElement.queryAll(By.directive(NzMenuItemDirective)); menu = fixture.debugElement.query(By.directive(NzMenuDirective)); submenus = fixture.debugElement.queryAll(By.directive(NzSubMenuComponent)); @@ -130,13 +126,11 @@ describe('menu', () => { describe('inline-collapsed', () => { let fixture; let testComponent; - let items; let submenus; let menu; beforeEach(() => { fixture = TestBed.createComponent(NzDemoMenuInlineCollapsedComponent); testComponent = fixture.debugElement.componentInstance; - items = fixture.debugElement.queryAll(By.directive(NzMenuItemDirective)); submenus = fixture.debugElement.queryAll(By.directive(NzSubMenuComponent)); menu = fixture.debugElement.query(By.directive(NzMenuDirective)); }); @@ -173,16 +167,10 @@ describe('menu', () => { }); describe('slider-current', () => { let fixture; - let testComponent; - let items; let submenus; - let menu; beforeEach(() => { fixture = TestBed.createComponent(NzDemoMenuSiderCurrentComponent); - testComponent = fixture.debugElement.componentInstance; - items = fixture.debugElement.queryAll(By.directive(NzMenuItemDirective)); submenus = fixture.debugElement.queryAll(By.directive(NzSubMenuComponent)); - menu = fixture.debugElement.query(By.directive(NzMenuDirective)); }); it('should collapsed self work', fakeAsync(() => { fixture.detectChanges(); @@ -219,14 +207,10 @@ describe('menu', () => { describe('theme', () => { let fixture; let testComponent; - let items; - let submenus; let menu; beforeEach(() => { fixture = TestBed.createComponent(NzDemoMenuThemeComponent); testComponent = fixture.debugElement.componentInstance; - items = fixture.debugElement.queryAll(By.directive(NzMenuItemDirective)); - submenus = fixture.debugElement.queryAll(By.directive(NzSubMenuComponent)); menu = fixture.debugElement.query(By.directive(NzMenuDirective)); }); it('should className correct', () => { @@ -240,13 +224,11 @@ describe('menu', () => { describe('swich-mode', () => { let fixture; let testComponent; - let items; let submenus; let menu; beforeEach(() => { fixture = TestBed.createComponent(NzDemoMenuSwitchModeComponent); testComponent = fixture.debugElement.componentInstance; - items = fixture.debugElement.queryAll(By.directive(NzMenuItemDirective)); submenus = fixture.debugElement.queryAll(By.directive(NzSubMenuComponent)); menu = fixture.debugElement.query(By.directive(NzMenuDirective)); }); diff --git a/components/message/nz-message.service.ts b/components/message/nz-message.service.ts index 042d5dc8b89..b3ecd9acde3 100644 --- a/components/message/nz-message.service.ts +++ b/components/message/nz-message.service.ts @@ -1,5 +1,4 @@ import { Overlay } from '@angular/cdk/overlay'; -import { ComponentPortal } from '@angular/cdk/portal'; import { ApplicationRef, ComponentFactoryResolver, EmbeddedViewRef, Injectable, Injector, Type } from '@angular/core'; import { NzMessageConfig } from './nz-message-config'; diff --git a/components/message/nz-message.spec.ts b/components/message/nz-message.spec.ts index 433f732afb3..e29cd25dfdb 100644 --- a/components/message/nz-message.spec.ts +++ b/components/message/nz-message.spec.ts @@ -1,7 +1,7 @@ import { OverlayContainer } from '@angular/cdk/overlay'; import { Component } from '@angular/core'; -import { fakeAsync, flush, flushMicrotasks, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; +import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { dispatchMouseEvent } from '../core/testing'; diff --git a/components/modal/demo/service.ts b/components/modal/demo/service.ts index adffca54408..0f9151b1e96 100644 --- a/components/modal/demo/service.ts +++ b/components/modal/demo/service.ts @@ -1,6 +1,6 @@ /* entryComponents: NzModalCustomComponent */ -import { Component, Input, TemplateRef, ViewChild } from '@angular/core'; +import { Component, Input, TemplateRef } from '@angular/core'; import { NzModalRef, NzModalService } from 'ng-zorro-antd'; @Component({ diff --git a/components/modal/nz-modal.component.ts b/components/modal/nz-modal.component.ts index a35d0bfa88d..cbc09ce54de 100644 --- a/components/modal/nz-modal.component.ts +++ b/components/modal/nz-modal.component.ts @@ -19,7 +19,6 @@ import { OnDestroy, OnInit, Output, - Renderer2, SimpleChanges, TemplateRef, Type, @@ -30,8 +29,6 @@ import { import { fromEvent, Observable, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar.service'; - import { InputBoolean } from '../core/util/convert'; import { isPromise } from '../core/util/is-promise'; import { NzI18nService } from '../i18n/nz-i18n.service'; @@ -129,11 +126,9 @@ export class NzModalComponent extends NzModalRef impleme constructor( private overlay: Overlay, private i18n: NzI18nService, - private renderer: Renderer2, private cfr: ComponentFactoryResolver, private elementRef: ElementRef, private viewContainer: ViewContainerRef, - private nzMeasureScrollbarService: NzMeasureScrollbarService, private modalControl: NzModalControlService, private focusTrapFactory: FocusTrapFactory, private cdr: ChangeDetectorRef, diff --git a/components/notification/nz-notification.spec.ts b/components/notification/nz-notification.spec.ts index 42c9bb1a3b6..9119c0163b5 100644 --- a/components/notification/nz-notification.spec.ts +++ b/components/notification/nz-notification.spec.ts @@ -1,6 +1,6 @@ import { OverlayContainer } from '@angular/cdk/overlay'; import { Component, TemplateRef, ViewChild } from '@angular/core'; -import { fakeAsync, flush, flushMicrotasks, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; +import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { dispatchMouseEvent } from '../core/testing'; diff --git a/components/pagination/nz-pagination.spec.ts b/components/pagination/nz-pagination.spec.ts index 9a2d1c1f5a6..607cebb72d7 100644 --- a/components/pagination/nz-pagination.spec.ts +++ b/components/pagination/nz-pagination.spec.ts @@ -236,12 +236,10 @@ describe('pagination', () => { }); describe('pagination render items', () => { let fixture; - let testComponent; let pagination; let paginationElement; beforeEach(() => { fixture = TestBed.createComponent(NzTestPaginationRenderComponent); - testComponent = fixture.debugElement.componentInstance; pagination = fixture.debugElement.query(By.directive(NzPaginationComponent)); fixture.detectChanges(); paginationElement = pagination.nativeElement.firstElementChild; diff --git a/components/popover/nz-popover.spec.ts b/components/popover/nz-popover.spec.ts index 586aae245e9..62bf19fb286 100644 --- a/components/popover/nz-popover.spec.ts +++ b/components/popover/nz-popover.spec.ts @@ -5,7 +5,6 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { dispatchMouseEvent } from '../core/testing'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; -import { NZ_ICONS } from '../icon/nz-icon.service'; import { NzToolTipModule } from '../tooltip/nz-tooltip.module'; import { NzPopoverDirective } from './nz-popover.directive'; import { NzPopoverModule } from './nz-popover.module'; diff --git a/components/radio/nz-radio-button.component.ts b/components/radio/nz-radio-button.component.ts index 2ef1ef9e521..239b0c6cca2 100644 --- a/components/radio/nz-radio-button.component.ts +++ b/components/radio/nz-radio-button.component.ts @@ -1,11 +1,9 @@ -import { DOCUMENT } from '@angular/common'; import { forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, - Inject, Renderer2, ViewEncapsulation } from '@angular/core'; @@ -38,8 +36,8 @@ import { NzRadioComponent } from './nz-radio.component'; }) export class NzRadioButtonComponent extends NzRadioComponent { /* tslint:disable-next-line:no-any */ - constructor(elementRef: ElementRef, renderer: Renderer2, @Inject(DOCUMENT) document: any, cdr: ChangeDetectorRef, focusMonitor: FocusMonitor) { - super(elementRef, renderer, document, cdr, focusMonitor); + constructor(elementRef: ElementRef, renderer: Renderer2, cdr: ChangeDetectorRef, focusMonitor: FocusMonitor) { + super(elementRef, renderer, cdr, focusMonitor); renderer.removeClass(elementRef.nativeElement, 'ant-radio-wrapper'); renderer.addClass(elementRef.nativeElement, 'ant-radio-button-wrapper'); } diff --git a/components/radio/nz-radio.component.ts b/components/radio/nz-radio.component.ts index bfa8f2679c1..894f5671a3c 100644 --- a/components/radio/nz-radio.component.ts +++ b/components/radio/nz-radio.component.ts @@ -1,5 +1,4 @@ import { FocusMonitor } from '@angular/cdk/a11y'; -import { DOCUMENT } from '@angular/common'; import { forwardRef, AfterViewInit, @@ -8,7 +7,6 @@ import { Component, ElementRef, HostListener, - Inject, Input, OnChanges, Renderer2, @@ -89,8 +87,8 @@ export class NzRadioComponent implements ControlValueAccessor, AfterViewInit, On } /* tslint:disable-next-line:no-any */ - constructor(private elementRef: ElementRef, private renderer: Renderer2, @Inject(DOCUMENT) private document: any, private cdr: ChangeDetectorRef, private focusMonitor: FocusMonitor) { - renderer.addClass(elementRef.nativeElement, 'ant-radio-wrapper'); + constructor(private elementRef: ElementRef, private renderer: Renderer2, private cdr: ChangeDetectorRef, private focusMonitor: FocusMonitor) { + this.renderer.addClass(elementRef.nativeElement, 'ant-radio-wrapper'); } setDisabledState(isDisabled: boolean): void { diff --git a/components/radio/nz-radio.spec.ts b/components/radio/nz-radio.spec.ts index a468e7bcead..e6692f8b626 100644 --- a/components/radio/nz-radio.spec.ts +++ b/components/radio/nz-radio.spec.ts @@ -86,12 +86,10 @@ describe('radio', () => { }); describe('single radio button', () => { let fixture; - let testComponent; let radio; beforeEach(() => { fixture = TestBed.createComponent(NzTestRadioButtonComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; radio = fixture.debugElement.query(By.directive(NzRadioButtonComponent)); }); it('should className correct', () => { @@ -163,13 +161,11 @@ describe('radio', () => { let fixture; let testComponent; let radios; - let radioGroup; beforeEach(() => { fixture = TestBed.createComponent(NzTestRadioGroupDisabledComponent); fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; radios = fixture.debugElement.queryAll(By.directive(NzRadioButtonComponent)); - radioGroup = fixture.debugElement.query(By.directive(NzRadioGroupComponent)); }); it('should group disable work', fakeAsync(() => { testComponent.disabled = true; diff --git a/components/rate/nz-rate.spec.ts b/components/rate/nz-rate.spec.ts index 79349815225..fb34a9d035a 100644 --- a/components/rate/nz-rate.spec.ts +++ b/components/rate/nz-rate.spec.ts @@ -1,9 +1,9 @@ -import { Component, DebugElement, ViewChild } from '@angular/core'; +import { Component, ViewChild } from '@angular/core'; import { fakeAsync, flush, TestBed } from '@angular/core/testing'; import { FormsModule, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { dispatchEvent, dispatchFakeEvent, dispatchKeyboardEvent } from '../core/testing'; +import { dispatchFakeEvent, dispatchKeyboardEvent } from '../core/testing'; import { LEFT_ARROW, RIGHT_ARROW } from '@angular/cdk/keycodes'; import { NzRateComponent } from './nz-rate.component'; diff --git a/components/select/nz-select-unselectable.spec.ts b/components/select/nz-select-unselectable.spec.ts index e425d2a4020..20683757bb2 100644 --- a/components/select/nz-select-unselectable.spec.ts +++ b/components/select/nz-select-unselectable.spec.ts @@ -13,12 +13,10 @@ describe('select unselectable', () => { })); describe('basic select unselectable', () => { let fixture; - let testComponent; let unselectable; beforeEach(() => { fixture = TestBed.createComponent(NzTestSelectUnselectableComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; unselectable = fixture.debugElement.query(By.directive(NzSelectUnselectableDirective)); }); it('should unselectable style work', () => { diff --git a/components/select/nz-select.component.spec.ts b/components/select/nz-select.component.spec.ts index e5bb8889b32..3a338e1790e 100644 --- a/components/select/nz-select.component.spec.ts +++ b/components/select/nz-select.component.spec.ts @@ -278,13 +278,11 @@ describe('nz-select component', () => { let fixture; let testComponent; let select; - let selectComponent; beforeEach(() => { fixture = TestBed.createComponent(NzTestSelectFormComponent); fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; select = fixture.debugElement.query(By.directive(NzSelectComponent)); - selectComponent = select.injector.get(NzSelectComponent); }); it('should set disabled work', fakeAsync(() => { fixture.detectChanges(); diff --git a/components/slider/nz-slider-handle.component.ts b/components/slider/nz-slider-handle.component.ts index 9a202867f0f..5623d81debf 100644 --- a/components/slider/nz-slider-handle.component.ts +++ b/components/slider/nz-slider-handle.component.ts @@ -2,9 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, - ElementRef, Input, - NgZone, OnChanges, OnDestroy, SimpleChanges, @@ -47,8 +45,6 @@ export class NzSliderHandleComponent implements OnChanges, OnDestroy { constructor( private sliderComponent: NzSliderComponent, - private ngZone: NgZone, - private el: ElementRef, private cdr: ChangeDetectorRef ) { } diff --git a/components/slider/nz-slider.spec.ts b/components/slider/nz-slider.spec.ts index 0dd2bc28585..992ef78e792 100644 --- a/components/slider/nz-slider.spec.ts +++ b/components/slider/nz-slider.spec.ts @@ -131,14 +131,11 @@ describe('NzSlider', () => { let fixture: ComponentFixture; let sliderDebugElement: DebugElement; let sliderNativeElement: HTMLElement; - let trackFillElement: HTMLElement; let sliderInstance: NzSliderComponent; let testComponent: SliderShowTooltipComponent; - let overlayContainer: OverlayContainer; let overlayContainerElement: HTMLElement; beforeEach(inject([ OverlayContainer ], (oc: OverlayContainer) => { - overlayContainer = oc; overlayContainerElement = oc.getContainerElement(); })); @@ -150,12 +147,9 @@ describe('NzSlider', () => { sliderDebugElement = fixture.debugElement.query(By.directive(NzSliderComponent)); sliderInstance = sliderDebugElement.injector.get(NzSliderComponent); sliderNativeElement = sliderInstance.sliderDOM; - trackFillElement = sliderNativeElement.querySelector('.ant-slider-track') as HTMLElement; }); it('should always display tooltips if set to `always`', fakeAsync(() => { - const handlerHost = sliderNativeElement.querySelector('nz-slider-handle'); - testComponent.show = 'always'; fixture.detectChanges(); tick(400); @@ -196,7 +190,6 @@ describe('NzSlider', () => { let sliderDebugElement: DebugElement; let sliderNativeElement: HTMLElement; let sliderInstance: NzSliderComponent; - let trackFillElement: HTMLElement; let testComponent: DisableSliderComponent; beforeEach(() => { @@ -207,7 +200,6 @@ describe('NzSlider', () => { sliderDebugElement = fixture.debugElement.query(By.directive(NzSliderComponent)); sliderInstance = sliderDebugElement.componentInstance; sliderNativeElement = sliderInstance.sliderDOM; - trackFillElement = sliderNativeElement.querySelector('.ant-slider-track') as HTMLElement; }); it('should/shouldn\'t be disabled', () => { @@ -254,7 +246,6 @@ describe('NzSlider', () => { let sliderDebugElement: DebugElement; let sliderNativeElement: HTMLElement; let sliderInstance: NzSliderComponent; - let testComponent: SliderWithMinAndMaxComponent; let trackFillElement: HTMLElement; beforeEach(() => { @@ -262,7 +253,6 @@ describe('NzSlider', () => { fixture.detectChanges(); sliderDebugElement = fixture.debugElement.query(By.directive(NzSliderComponent)); - testComponent = fixture.debugElement.componentInstance; sliderInstance = sliderDebugElement.componentInstance; sliderNativeElement = sliderInstance.sliderDOM; trackFillElement = sliderNativeElement.querySelector('.ant-slider-track') as HTMLElement; @@ -489,13 +479,11 @@ describe('NzSlider', () => { let sliderNativeElement: HTMLElement; let trackFillElement: HTMLElement; let sliderInstance: NzSliderComponent; - let testComponent: VerticalSliderComponent; beforeEach(() => { fixture = TestBed.createComponent(VerticalSliderComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; sliderDebugElement = fixture.debugElement.query(By.directive(NzSliderComponent)); sliderInstance = sliderDebugElement.injector.get(NzSliderComponent); sliderNativeElement = sliderInstance.sliderDOM; @@ -531,7 +519,6 @@ describe('NzSlider', () => { let trackFillElement: HTMLElement; let sliderInstance: NzSliderComponent; let testComponent: MixedSliderComponent; - let overlayContainer: OverlayContainer; let overlayContainerElement: HTMLElement; beforeEach(() => { @@ -546,7 +533,6 @@ describe('NzSlider', () => { }); beforeEach(inject([ OverlayContainer ], (oc: OverlayContainer) => { - overlayContainer = oc; overlayContainerElement = oc.getContainerElement(); })); diff --git a/components/spin/nz-spin.component.ts b/components/spin/nz-spin.component.ts index e4814ebddc3..0001d1cc92c 100644 --- a/components/spin/nz-spin.component.ts +++ b/components/spin/nz-spin.component.ts @@ -9,7 +9,7 @@ import { BehaviorSubject, Observable, Subscription } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { NzSizeLDSType } from '../core/types/size'; -import { toBoolean, InputBoolean, InputNumber } from '../core/util/convert'; +import { InputBoolean, InputNumber } from '../core/util/convert'; @Component({ selector : 'nz-spin', diff --git a/components/steps/nz-steps.spec.ts b/components/steps/nz-steps.spec.ts index 76ff2978a6c..ed7551f4fb6 100644 --- a/components/steps/nz-steps.spec.ts +++ b/components/steps/nz-steps.spec.ts @@ -163,12 +163,10 @@ describe('steps', () => { describe('inner step string', () => { let fixture; let testComponent; - let outStep; let innerSteps; beforeEach(() => { fixture = TestBed.createComponent(NzTestInnerStepStringComponent); testComponent = fixture.debugElement.componentInstance; - outStep = fixture.debugElement.query(By.directive(NzStepsComponent)); innerSteps = fixture.debugElement.queryAll(By.directive(NzStepComponent)); }); it('should status display correct', () => { @@ -203,13 +201,9 @@ describe('steps', () => { }); describe('inner step template', () => { let fixture; - let testComponent; - let outStep; let innerSteps; beforeEach(() => { fixture = TestBed.createComponent(NzTestInnerStepTemplateComponent); - testComponent = fixture.debugElement.componentInstance; - outStep = fixture.debugElement.query(By.directive(NzStepsComponent)); innerSteps = fixture.debugElement.queryAll(By.directive(NzStepComponent)); }); it('should title display correct', () => { diff --git a/components/switch/nz-switch.spec.ts b/components/switch/nz-switch.spec.ts index d553dac3596..c53299592f7 100644 --- a/components/switch/nz-switch.spec.ts +++ b/components/switch/nz-switch.spec.ts @@ -167,12 +167,10 @@ describe('switch', () => { }); describe('template switch', () => { let fixture; - let testComponent; let switchElement; beforeEach(() => { fixture = TestBed.createComponent(NzTestSwitchTemplateComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; switchElement = fixture.debugElement.query(By.directive(NzSwitchComponent)); }); it('should children template work', fakeAsync(() => { diff --git a/components/table/nz-tbody.spec.ts b/components/table/nz-tbody.spec.ts index 59deb09e531..88e18b389fd 100644 --- a/components/table/nz-tbody.spec.ts +++ b/components/table/nz-tbody.spec.ts @@ -16,12 +16,10 @@ describe('nz-tbody', () => { })); describe('nz-tbody in table', () => { let fixture; - let testComponent; let tbody; beforeEach(() => { fixture = TestBed.createComponent(NzTbodyTestTableComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; tbody = fixture.debugElement.query(By.directive(NzTbodyDirective)); }); it('should not add class', () => { @@ -31,12 +29,10 @@ describe('nz-tbody', () => { }); describe('nz-tbody in nz-table', () => { let fixture; - let testComponent; let tbody; beforeEach(() => { fixture = TestBed.createComponent(NzTbodyTestNzTableComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; tbody = fixture.debugElement.query(By.directive(NzTbodyDirective)); }); it('should not add class', () => { diff --git a/components/table/nz-td.component.ts b/components/table/nz-td.component.ts index 4ad9ba2ea38..714d174e59e 100644 --- a/components/table/nz-td.component.ts +++ b/components/table/nz-td.component.ts @@ -6,7 +6,6 @@ import { Input, OnChanges, Output, - Renderer2, SimpleChanges, ViewEncapsulation } from '@angular/core'; @@ -58,7 +57,7 @@ export class NzTdComponent implements OnChanges { }); } - constructor(private elementRef: ElementRef, private renderer: Renderer2, private nzUpdateHostClassService: NzUpdateHostClassService) { + constructor(private elementRef: ElementRef, private nzUpdateHostClassService: NzUpdateHostClassService) { } ngOnChanges(changes: SimpleChanges): void { diff --git a/components/table/nz-th.spec.ts b/components/table/nz-th.spec.ts index 594d3984065..6d7f02b29fd 100644 --- a/components/table/nz-th.spec.ts +++ b/components/table/nz-th.spec.ts @@ -252,14 +252,10 @@ describe('nz-th', () => { describe('nz-th with default filter in nz-table', () => { let fixture; let testComponent; - let th; - let table; beforeEach(() => { fixture = TestBed.createComponent(NzThTestTableDefaultFilterComponent); fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; - th = fixture.debugElement.query(By.directive(NzThComponent)); - table = fixture.debugElement.query(By.directive(NzTableComponent)); }); // It's a fake test to pass codecov, because default displayData should be configured by user. it('should default filter work', () => { diff --git a/components/table/nz-thead.spec.ts b/components/table/nz-thead.spec.ts index 39707376c27..e2f6653657d 100644 --- a/components/table/nz-thead.spec.ts +++ b/components/table/nz-thead.spec.ts @@ -5,7 +5,6 @@ import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzTableComponent } from './nz-table.component'; import { NzTableModule } from './nz-table.module'; -import { NzTheadComponent } from './nz-thead.component'; describe('nz-thead', () => { beforeEach(fakeAsync(() => { @@ -19,13 +18,11 @@ describe('nz-thead', () => { describe('nz-thead in nz-table', () => { let fixture; let testComponent; - let thead; let table; beforeEach(() => { fixture = TestBed.createComponent(NzTheadTestNzTableComponent); fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; - thead = fixture.debugElement.query(By.directive(NzTheadComponent)); table = fixture.debugElement.query(By.directive(NzTableComponent)); }); it('should sort change', () => { diff --git a/components/table/nz-tr.spec.ts b/components/table/nz-tr.spec.ts index 93a57237235..91d6d2282cf 100644 --- a/components/table/nz-tr.spec.ts +++ b/components/table/nz-tr.spec.ts @@ -16,12 +16,10 @@ describe('nz-tr', () => { })); describe('nz-tr in table', () => { let fixture; - let testComponent; let tr; beforeEach(() => { fixture = TestBed.createComponent(NzTrTestTableComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; tr = fixture.debugElement.query(By.directive(NzTrDirective)); }); it('should not add class', () => { diff --git a/components/tabs/nz-tab.component.ts b/components/tabs/nz-tab.component.ts index 7a533088cdd..b135fd476c8 100644 --- a/components/tabs/nz-tab.component.ts +++ b/components/tabs/nz-tab.component.ts @@ -26,7 +26,7 @@ export class NzTabComponent implements OnChanges, OnDestroy { origin: number = null; isActive = false; readonly stateChanges = new Subject(); - @ViewChild(TemplateRef) private content: TemplateRef; + @ViewChild(TemplateRef) content: TemplateRef; @Input() nzTitle: string | TemplateRef; @Input() @InputBoolean() nzForceRender = false; @Input() @InputBoolean() nzDisabled = false; @@ -35,7 +35,7 @@ export class NzTabComponent implements OnChanges, OnDestroy { @Output() readonly nzDeselect = new EventEmitter(); constructor(public elementRef: ElementRef, private renderer: Renderer2) { - renderer.addClass(elementRef.nativeElement, 'ant-tabs-tabpane'); + this.renderer.addClass(elementRef.nativeElement, 'ant-tabs-tabpane'); } ngOnChanges(changes: SimpleChanges): void { diff --git a/components/tabs/nz-tabset.component.ts b/components/tabs/nz-tabset.component.ts index 78b3b8e3a93..14d84453aad 100644 --- a/components/tabs/nz-tabset.component.ts +++ b/components/tabs/nz-tabset.component.ts @@ -1,6 +1,5 @@ /** get some code from https://github.com/angular/material2 */ -import { DOCUMENT } from '@angular/common'; import { AfterContentChecked, AfterContentInit, AfterViewInit, @@ -10,11 +9,9 @@ import { ContentChildren, ElementRef, EventEmitter, - Inject, Input, OnChanges, OnDestroy, OnInit, - Optional, Output, QueryList, Renderer2, @@ -168,9 +165,7 @@ export class NzTabSetComponent implements AfterContentChecked, OnInit, AfterView private renderer: Renderer2, private nzUpdateHostClassService: NzUpdateHostClassService, private elementRef: ElementRef, - private cdr: ChangeDetectorRef, - // tslint:disable-next-line:no-any - @Optional() @Inject(DOCUMENT) private document: any) { + private cdr: ChangeDetectorRef) { } ngOnChanges(changes: SimpleChanges): void { diff --git a/components/tag/nz-tag.component.ts b/components/tag/nz-tag.component.ts index 4f3911ebdc1..454c9726a11 100644 --- a/components/tag/nz-tag.component.ts +++ b/components/tag/nz-tag.component.ts @@ -1,6 +1,6 @@ import { AnimationEvent } from '@angular/animations'; import { - ChangeDetectionStrategy, ChangeDetectorRef, + ChangeDetectionStrategy, Component, ElementRef, EventEmitter, diff --git a/components/tag/nz-tag.spec.ts b/components/tag/nz-tag.spec.ts index 5b44026a02e..b14ad4fe439 100644 --- a/components/tag/nz-tag.spec.ts +++ b/components/tag/nz-tag.spec.ts @@ -88,12 +88,10 @@ describe('tag', () => { }); describe('prevent tag', () => { let fixture; - let testComponent; let tag; beforeEach(() => { fixture = TestBed.createComponent(NzTestTagPreventComponent); fixture.detectChanges(); - testComponent = fixture.debugElement.componentInstance; tag = fixture.debugElement.query(By.directive(NzTagComponent)); }); it('should close prevent default', fakeAsync(() => { diff --git a/components/time-picker/nz-time-picker-panel.component.ts b/components/time-picker/nz-time-picker-panel.component.ts index 3839282ee55..163bf1b976d 100644 --- a/components/time-picker/nz-time-picker-panel.component.ts +++ b/components/time-picker/nz-time-picker-panel.component.ts @@ -3,11 +3,9 @@ import { ChangeDetectorRef, Component, ElementRef, - EventEmitter, Input, OnDestroy, OnInit, - Output, TemplateRef, ViewChild, ViewEncapsulation diff --git a/components/time-picker/nz-time-picker.component.spec.ts b/components/time-picker/nz-time-picker.component.spec.ts index 3f96a4411d1..23405aad2b5 100644 --- a/components/time-picker/nz-time-picker.component.spec.ts +++ b/components/time-picker/nz-time-picker.component.spec.ts @@ -14,7 +14,6 @@ registerLocaleData(zh); describe('time-picker', () => { let overlayContainer: OverlayContainer; - let overlayContainerElement: HTMLElement; let testComponent; let fixture; beforeEach(async(() => { @@ -26,7 +25,6 @@ describe('time-picker', () => { TestBed.compileComponents(); inject([ OverlayContainer ], (oc: OverlayContainer) => { overlayContainer = oc; - overlayContainerElement = oc.getContainerElement(); })(); })); afterEach(inject([ OverlayContainer ], (currentOverlayContainer: OverlayContainer) => { diff --git a/components/timeline/nz-timeline.spec.ts b/components/timeline/nz-timeline.spec.ts index ba200264075..c89849c4cf3 100644 --- a/components/timeline/nz-timeline.spec.ts +++ b/components/timeline/nz-timeline.spec.ts @@ -96,13 +96,9 @@ describe('timeline', () => { }); describe('custom color timeline', () => { let fixture; - let testComponent; - let timeline; let items; beforeEach(() => { fixture = TestBed.createComponent(NzTestTimelineCustomColorComponent); - testComponent = fixture.debugElement.componentInstance; - timeline = fixture.debugElement.query(By.directive(NzTimelineComponent)); items = fixture.debugElement.queryAll(By.directive(NzTimelineItemComponent)); }); it('should support custom color', () => { @@ -115,14 +111,10 @@ describe('timeline', () => { }); describe('pending timeline', () => { let fixture; - let testComponent; let timeline; - let items; beforeEach(() => { fixture = TestBed.createComponent(NzTestTimelinePendingComponent); - testComponent = fixture.debugElement.componentInstance; timeline = fixture.debugElement.query(By.directive(NzTimelineComponent)); - items = fixture.debugElement.queryAll(By.directive(NzTimelineItemComponent)); }); it('should pending work', () => { fixture.detectChanges(); diff --git a/components/tooltip/nz-tooltip.spec.ts b/components/tooltip/nz-tooltip.spec.ts index 02613069c51..0cce8550408 100644 --- a/components/tooltip/nz-tooltip.spec.ts +++ b/components/tooltip/nz-tooltip.spec.ts @@ -4,7 +4,6 @@ import { fakeAsync, inject, tick, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { dispatchMouseEvent } from '../core/testing'; -import { NZ_ICONS } from '../icon'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzToolTipComponent } from './nz-tooltip.component'; import { NzTooltipDirective } from './nz-tooltip.directive'; diff --git a/components/transfer/demo/can-move.ts b/components/transfer/demo/can-move.ts index b36dc00295b..72425448c4e 100644 --- a/components/transfer/demo/can-move.ts +++ b/components/transfer/demo/can-move.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzMessageService, TransferCanMove, TransferItem } from 'ng-zorro-antd'; +import { TransferCanMove, TransferItem } from 'ng-zorro-antd'; import { of, Observable } from 'rxjs'; import { delay } from 'rxjs/operators'; diff --git a/components/transfer/demo/search.ts b/components/transfer/demo/search.ts index 5cddcb46c28..5cb87da1f9e 100644 --- a/components/transfer/demo/search.ts +++ b/components/transfer/demo/search.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-transfer-search', diff --git a/components/tree-select/demo/async.ts b/components/tree-select/demo/async.ts index b46c8277a54..4266e5c70d3 100755 --- a/components/tree-select/demo/async.ts +++ b/components/tree-select/demo/async.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatEmitEvent } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-select-async', diff --git a/components/tree-select/demo/basic.ts b/components/tree-select/demo/basic.ts index b6a7ef5518c..80afd6d2c38 100755 --- a/components/tree-select/demo/basic.ts +++ b/components/tree-select/demo/basic.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-select-basic', diff --git a/components/tree-select/demo/checkable.ts b/components/tree-select/demo/checkable.ts index 4fbb8472a1e..2abd210c879 100755 --- a/components/tree-select/demo/checkable.ts +++ b/components/tree-select/demo/checkable.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-select-checkable', diff --git a/components/tree-select/demo/multiple.ts b/components/tree-select/demo/multiple.ts index 4cda4262f52..cf6a81c8153 100755 --- a/components/tree-select/demo/multiple.ts +++ b/components/tree-select/demo/multiple.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-select-multiple', diff --git a/components/tree/demo/basic-controlled.ts b/components/tree/demo/basic-controlled.ts index c3e73357bd9..09efd658bfa 100644 --- a/components/tree/demo/basic-controlled.ts +++ b/components/tree/demo/basic-controlled.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatEmitEvent } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-basic-controlled', diff --git a/components/tree/demo/basic.ts b/components/tree/demo/basic.ts index 754d6ca007a..fa3249c0cb5 100644 --- a/components/tree/demo/basic.ts +++ b/components/tree/demo/basic.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd'; +import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-basic', diff --git a/components/tree/demo/customized-icon.ts b/components/tree/demo/customized-icon.ts index 94c092c1e45..f6d8077e6f4 100644 --- a/components/tree/demo/customized-icon.ts +++ b/components/tree/demo/customized-icon.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-customized-icon', diff --git a/components/tree/demo/draggable-confirm.ts b/components/tree/demo/draggable-confirm.ts index 215ca0d1276..873239d8c8f 100644 --- a/components/tree/demo/draggable-confirm.ts +++ b/components/tree/demo/draggable-confirm.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatBeforeDropEvent, NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatBeforeDropEvent, NzFormatEmitEvent } from 'ng-zorro-antd'; import { of, Observable } from 'rxjs'; import { delay } from 'rxjs/operators'; diff --git a/components/tree/demo/draggable.ts b/components/tree/demo/draggable.ts index f368066f79a..f2515260c6e 100644 --- a/components/tree/demo/draggable.ts +++ b/components/tree/demo/draggable.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatEmitEvent } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-draggable', diff --git a/components/tree/demo/dynamic.ts b/components/tree/demo/dynamic.ts index e9bf67263e6..57926ad1234 100644 --- a/components/tree/demo/dynamic.ts +++ b/components/tree/demo/dynamic.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatEmitEvent } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-dynamic', diff --git a/components/tree/demo/line.ts b/components/tree/demo/line.ts index cbe34b7a74e..596f85fba16 100644 --- a/components/tree/demo/line.ts +++ b/components/tree/demo/line.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatEmitEvent } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-line', diff --git a/components/tree/demo/search.ts b/components/tree/demo/search.ts index aed1ab20a3b..080e7eec1f5 100644 --- a/components/tree/demo/search.ts +++ b/components/tree/demo/search.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd'; +import { NzFormatEmitEvent } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-tree-search', diff --git a/components/tree/nz-tree.spec.ts b/components/tree/nz-tree.spec.ts index ed3d65b99c5..9ac76077bb9 100644 --- a/components/tree/nz-tree.spec.ts +++ b/components/tree/nz-tree.spec.ts @@ -449,7 +449,6 @@ describe('nz-tree', () => { it('test wrong drag event', fakeAsync(() => { // drop node self fixture.detectChanges(); - const dragStartSpy = spyOn(treeInstance, 'onDragStart'); const dropSpy = spyOn(treeInstance, 'onDrop'); const dragEndSpy = spyOn(treeInstance, 'onDragEnd'); const dragNode = treeElement.querySelector('[title=\'0-1\']'); @@ -480,7 +479,6 @@ describe('nz-tree', () => { })); it('test drag event nzBeforeDrop', () => { - const dropSpy = spyOn(treeInstance, 'onDrop'); const dragNode = treeElement.querySelector('[title=\'0-2\']'); let dropNode = treeElement.querySelector('[title=\'0-1\']'); treeInstance.beforeDrop = (arg: NzFormatBeforeDropEvent): Observable => { diff --git a/components/upload/demo/custom-request.ts b/components/upload/demo/custom-request.ts index 4eeb34f4268..9f8a96c349c 100644 --- a/components/upload/demo/custom-request.ts +++ b/components/upload/demo/custom-request.ts @@ -1,6 +1,6 @@ +import { HttpClient, HttpEvent, HttpEventType, HttpRequest, HttpResponse } from '@angular/common/http'; import { Component } from '@angular/core'; -import { HttpRequest, HttpClient, HttpEventType, HttpEvent, HttpResponse } from '@angular/common/http'; -import { NzMessageService, UploadXHRArgs } from 'ng-zorro-antd'; +import { UploadXHRArgs } from 'ng-zorro-antd'; import { forkJoin } from 'rxjs'; @Component({ @@ -17,7 +17,7 @@ import { forkJoin } from 'rxjs'; }) export class NzDemoUploadCustomRequestComponent { - constructor(private http: HttpClient, private msg: NzMessageService) {} + constructor(private http: HttpClient) {} customReq = (item: UploadXHRArgs) => { // 构建一个 FormData 对象,用于存储文件或其他参数 diff --git a/components/upload/demo/drag.ts b/components/upload/demo/drag.ts index adcabecdae3..96143c78a8a 100644 --- a/components/upload/demo/drag.ts +++ b/components/upload/demo/drag.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { NzMessageService, UploadFile } from 'ng-zorro-antd'; +import { NzMessageService } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-upload-drag', diff --git a/components/upload/demo/picture-card.ts b/components/upload/demo/picture-card.ts index f40d105e871..1d779915305 100644 --- a/components/upload/demo/picture-card.ts +++ b/components/upload/demo/picture-card.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { NzMessageService, UploadFile } from 'ng-zorro-antd'; +import { UploadFile } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-upload-picture-card', @@ -52,7 +52,7 @@ export class NzDemoUploadPictureCardComponent { previewImage = ''; previewVisible = false; - constructor(private msg: NzMessageService) {} + constructor() {} handlePreview = (file: UploadFile) => { this.previewImage = file.url || file.thumbUrl; diff --git a/components/upload/demo/picture-style.ts b/components/upload/demo/picture-style.ts index daf9d66a872..446193d791d 100644 --- a/components/upload/demo/picture-style.ts +++ b/components/upload/demo/picture-style.ts @@ -1,5 +1,4 @@ import { Component } from '@angular/core'; -import { NzMessageService, UploadFile } from 'ng-zorro-antd'; @Component({ selector: 'nz-demo-upload-picture-style', @@ -56,6 +55,4 @@ export class NzDemoUploadPictureStyleComponent { fileList1 = [...this.defaultFileList]; fileList2 = [...this.defaultFileList]; - - constructor(private msg: NzMessageService) {} } diff --git a/package.json b/package.json index caa72cbafd6..23c6519aa2a 100644 --- a/package.json +++ b/package.json @@ -75,12 +75,12 @@ "hammerjs": "^2.0.8", "husky": "^1.0.1", "jasmine-core": "~2.99.1", - "jasmine-spec-reporter": "~4.2.1", "karma": "~3.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", + "karma-spec-reporter": "0.0.32", "less": "^3.9.0", "less-plugin-clean-css": "^1.5.1", "marked": "^0.5.1", diff --git a/scripts/site/template/demo-module.template.ts b/scripts/site/template/demo-module.template.ts index fb799505d46..824ce265739 100644 --- a/scripts/site/template/demo-module.template.ts +++ b/scripts/site/template/demo-module.template.ts @@ -1,5 +1,4 @@ import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { ShareModule } from '../share/share.module'; diff --git a/tsconfig.json b/tsconfig.json index a2a679a38ef..2d511e71e27 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,8 @@ "lib": [ "es2017", "dom" - ] + ], + "noUnusedLocals": true, + "skipLibCheck": true } }