Skip to content

Commit

Permalink
Merge e68cd58 into 651e3fa
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendell committed Feb 23, 2019
2 parents 651e3fa + e68cd58 commit f4409f3
Show file tree
Hide file tree
Showing 141 changed files with 176 additions and 390 deletions.
15 changes: 4 additions & 11 deletions 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,
Expand Down Expand Up @@ -188,7 +188,6 @@ describe('affix', () => {

describe('[nzOffsetTop]', () => {
const offsetTop = 150;
const componentOffset = 160;

beforeEach(() => {
context.newOffset = offsetTop;
Expand Down Expand Up @@ -347,7 +346,7 @@ describe('affix', () => {
});
});

it(`emit true when is affixed`, fakeAsync((done) => {
it(`emit true when is affixed`, fakeAsync(() => {
setupInitialState();
emitScroll(window, defaultOffsetTop + startOffset + 1);

Expand All @@ -356,7 +355,7 @@ describe('affix', () => {
discardPeriodicTasks();
}));

it(`emit false when is unaffixed`, fakeAsync((done) => {
it(`emit false when is unaffixed`, fakeAsync(() => {
setupInitialState();
emitScroll(window, defaultOffsetTop + startOffset + 1);
emitScroll(window, defaultOffsetTop + startOffset - 1);
Expand Down Expand Up @@ -466,18 +465,15 @@ describe('affix-extra', () => {
let fixture: ComponentFixture<TestAffixComponent>;
let context: TestAffixComponent;
let dl: DebugElement;
let component: NzAffixComponent;
let page: PageObject;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [NzAffixModule],
declarations: [TestAffixComponent]
}).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);
Expand All @@ -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({
Expand Down
3 changes: 1 addition & 2 deletions components/affix/nz-affix.component.ts
@@ -1,7 +1,6 @@
import { DOCUMENT } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Expand Down Expand Up @@ -66,7 +65,7 @@ export class NzAffixComponent implements OnInit, OnDestroy {
readonly nzChange: EventEmitter<boolean> = 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;
}

Expand Down
4 changes: 2 additions & 2 deletions components/alert/nz-alert.spec.ts
Expand Up @@ -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`);
Expand Down
9 changes: 4 additions & 5 deletions 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;
Expand Down Expand Up @@ -32,9 +31,9 @@ describe('anchor', () => {
describe('[default]', () => {
it(`should scolling to target via click a link`, () => {
spyOn(srv, 'scrollTo').and.callFake((
containerEl: Element | Window,
targetTopValue: number = 0,
easing?: any,
_containerEl: Element | Window,
_targetTopValue: number = 0,
_easing?: any,
callback?: () => void
) => {
callback();
Expand Down
1 change: 0 additions & 1 deletion components/anchor/nz-anchor-link.component.ts
Expand Up @@ -4,7 +4,6 @@ import {
Component,
ContentChild,
ElementRef,
HostBinding,
Input,
OnDestroy,
OnInit, Renderer2,
Expand Down
2 changes: 1 addition & 1 deletion components/auto-complete/demo/uncertain-category.ts
Expand Up @@ -38,7 +38,7 @@ export class NzDemoAutoCompleteUncertainCategoryComponent {

onChange(value: string): void {
this.options = new Array(this.getRandomInt(15, 5)).join('.').split('.')
.map((item, idx) => ({
.map((_item, idx) => ({
value,
category: `${value}${idx}`,
count: this.getRandomInt(200, 100),
Expand Down
2 changes: 0 additions & 2 deletions components/auto-complete/nz-autocomplete.spec.ts
Expand Up @@ -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(() => {
Expand Down
14 changes: 4 additions & 10 deletions components/back-top/back-top.spec.ts
Expand Up @@ -20,7 +20,6 @@ import { NzBackTopModule } from './nz-back-top.module';
describe('Component:nz-back-top', () => {
let scrollService: MockNzScrollService;
let fixture: ComponentFixture<TestBackTopComponent>;
let context: TestBackTopComponent;
let debugElement: DebugElement;
let component: NzBackTopComponent;
let componentObject: NzBackTopPageObject;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -99,7 +97,7 @@ describe('Component:nz-back-top', () => {
componentObject.clickBackTop();
tick();

expect(scrollService.getScroll(window)).toEqual(0);
expect(scrollService.getScroll()).toEqual(0);
}));
});
});
Expand Down Expand Up @@ -199,9 +197,7 @@ describe('Component:nz-back-top', () => {
describe('#nzTemplate', () => {
it(`should show custom template`, fakeAsync(() => {
let fixtureTemplate: ComponentFixture<TestBackTopTemplateComponent>;
let contextTemplate: TestBackTopTemplateComponent;
fixtureTemplate = TestBed.createComponent(TestBackTopTemplateComponent);
contextTemplate = fixture.componentInstance;

componentObject.scrollTo(window, defaultVisibilityHeight + 1);
tick();
Expand Down Expand Up @@ -240,15 +236,13 @@ class TestBackTopTemplateComponent {
class MockNzScrollService {
mockTopOffset: number;

getScroll(el?: Element | Window, top: boolean = true): number {
getScroll(): number {
return this.mockTopOffset;
}

scrollTo(
containerEl: Element | Window,
targetTopValue: number = 0,
easing?: {},
callback?: {}
_containerEl: Element | Window,
targetTopValue: number = 0
): void {
this.mockTopOffset = targetTopValue;
}
Expand Down
2 changes: 1 addition & 1 deletion 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';

Expand Down
5 changes: 0 additions & 5 deletions components/breadcrumb/nz-breadcrumb.spec.ts
Expand Up @@ -15,7 +15,6 @@ import { NzBreadCrumbComponent } from './nz-breadcrumb.component';
import { NzBreadCrumbModule } from './nz-breadcrumb.module';

describe('breadcrumb', () => {
let testComponent;
let fixture;

describe('basic', () => {
Expand All @@ -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));
});
Expand All @@ -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));
});
Expand All @@ -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(() => {
Expand Down Expand Up @@ -125,7 +121,6 @@ describe('breadcrumb', () => {
expect(() => {
TestBed.compileComponents();
fixture = TestBed.createComponent(NzBreadcrumbAutoGenerateErrorDemoComponent);
testComponent = fixture.debugElement.componentInstance;
fixture.detectChanges();
}).toThrowError();
}));
Expand Down
2 changes: 1 addition & 1 deletion components/button/nz-button.spec.ts
Expand Up @@ -216,7 +216,7 @@ describe('button', () => {
beforeEach(() => {
fixture = TestBed.createComponent(NzDemoButtonSizeComponent);
testComponent = fixture.debugElement.componentInstance;
buttons = fixture.debugElement.queryAll(By.directive(NzButtonComponent)).filter((item, index) => index < 6);
buttons = fixture.debugElement.queryAll(By.directive(NzButtonComponent)).filter((_, index) => index < 6);
buttonGroup = fixture.debugElement.query(By.directive(NzButtonGroupComponent));
});

Expand Down
2 changes: 0 additions & 2 deletions components/calendar/nz-calendar-header.component.ts
Expand Up @@ -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) {
}

Expand Down
4 changes: 1 addition & 3 deletions components/calendar/nz-calendar-header.spec.ts
Expand Up @@ -109,11 +109,9 @@ describe('Calendar Header', () => {

describe('activeDate', () => {
let fixture: ComponentFixture<NzTestCalendarHeaderActiveDateComponent>;
let component: NzTestCalendarHeaderActiveDateComponent;

beforeEach(async(() => {
fixture = TestBed.createComponent(NzTestCalendarHeaderActiveDateComponent);
component = fixture.componentInstance;
}));

it('should be now by default', () => {
Expand Down Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion components/calendar/nz-calendar.component.ts
Expand Up @@ -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 = () => {};
Expand Down
8 changes: 0 additions & 8 deletions components/calendar/nz-calendar.spec.ts
Expand Up @@ -278,11 +278,9 @@ describe('Calendar', () => {

describe('dateCell', () => {
let fixture: ComponentFixture<NzTestCalendarDateCellComponent>;
let component: NzTestCalendarDateCellComponent;

beforeEach(async(() => {
fixture = TestBed.createComponent(NzTestCalendarDateCellComponent);
component = fixture.componentInstance;
}));

it('should work when passed via property', () => {
Expand All @@ -306,11 +304,9 @@ describe('Calendar', () => {

describe('dateFullCell', () => {
let fixture: ComponentFixture<NzTestCalendarDateFullCellComponent>;
let component: NzTestCalendarDateFullCellComponent;

beforeEach(async(() => {
fixture = TestBed.createComponent(NzTestCalendarDateFullCellComponent);
component = fixture.componentInstance;
}));

it('should work when passed via property', () => {
Expand All @@ -334,11 +330,9 @@ describe('Calendar', () => {

describe('monthCell', () => {
let fixture: ComponentFixture<NzTestCalendarMonthCellComponent>;
let component: NzTestCalendarMonthCellComponent;

beforeEach(async(() => {
fixture = TestBed.createComponent(NzTestCalendarMonthCellComponent);
component = fixture.componentInstance;
}));

it('should work when passed via property', () => {
Expand All @@ -362,11 +356,9 @@ describe('Calendar', () => {

describe('monthFullCell', () => {
let fixture: ComponentFixture<NzTestCalendarMonthFullCellComponent>;
let component: NzTestCalendarMonthFullCellComponent;

beforeEach(async(() => {
fixture = TestBed.createComponent(NzTestCalendarMonthFullCellComponent);
component = fixture.componentInstance;
}));

it('should work when passed via property', () => {
Expand Down
2 changes: 1 addition & 1 deletion components/cascader/demo/change-on-function.ts
Expand Up @@ -63,7 +63,7 @@ export class NzDemoCascaderChangeOnFunctionComponent {
console.log(values, this.values);
}

public validate(option: any, index: number): boolean {
public validate(option: any, _index: number): boolean {
const value = option.value;
return ['hangzhou', 'xihu', 'nanjing', 'zhonghuamen'].indexOf(value) >= 0;
}
Expand Down
2 changes: 1 addition & 1 deletion components/cascader/demo/custom-field-names.ts
Expand Up @@ -66,7 +66,7 @@ export class NzDemoCascaderCustomFieldNamesComponent {
console.log(values, this.values);
}

public validate(option: any, index: number): boolean {
public validate(option: any, _index: number): boolean {
const value = option.value;
return ['hangzhou', 'xihu', 'nanjing', 'zhonghuamen'].indexOf(value) >= 0;
}
Expand Down
2 changes: 1 addition & 1 deletion components/cascader/demo/modal.ts
Expand Up @@ -70,7 +70,7 @@ export class NzDemoCascaderModalComponent {
}

handleOk($event: MouseEvent): void {
console.log('Button ok clicked!', this.values);
console.log('Button ok clicked!', this.values, $event);
this.isVisible = false;
}

Expand Down
4 changes: 2 additions & 2 deletions components/cascader/nz-cascader.component.html
Expand Up @@ -17,8 +17,8 @@
[disabled]="nzDisabled"
[nzSize]="nzSize"
[(ngModel)]="inputValue"
(blur)="handleInputBlur($event)"
(focus)="handleInputFocus($event)"
(blur)="handleInputBlur()"
(focus)="handleInputFocus()"
(change)="$event.stopPropagation()">
<i *ngIf="clearIconVisible"
nz-icon
Expand Down

0 comments on commit f4409f3

Please sign in to comment.