Skip to content

Commit

Permalink
fix(igx-ts): lint errors for generated projects and views #541 (PR #553)
Browse files Browse the repository at this point in the history
  • Loading branch information
PlamenaMiteva authored and damyanpetev committed Sep 12, 2019
1 parent 0f5d0e1 commit b2bbc2e
Show file tree
Hide file tree
Showing 35 changed files with 1,307 additions and 1,278 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class $(ClassName)Component {
public chartType = 'Auto';

data = [
{ 'CountryName': 'China', 'Pop1995': 1216, 'Pop2005': 1297, },
{ 'CountryName': 'India', 'Pop1995': 920, 'Pop2005': 1090, },
{ 'CountryName': 'United States', 'Pop1995': 266, 'Pop2005': 295, },
{ 'CountryName': 'Indonesia', 'Pop1995': 197, 'Pop2005': 229, },
{ 'CountryName': 'Brazil', 'Pop1995': 161, 'Pop2005': 186, }
{ CountryName: 'China', Pop1995: 1216, Pop2005: 1297, },
{ CountryName: 'India', Pop1995: 920, Pop2005: 1090, },
{ CountryName: 'United States', Pop1995: 266, Pop2005: 295, },
{ CountryName: 'Indonesia', Pop1995: 197, Pop2005: 229, },
{ CountryName: 'Brazil', Pop1995: 161, Pop2005: 186, }
];

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ export class $(ClassName)Component {

private dropDownOpened = false;

private _positionSettings = {
private positionSettings = {
horizontalStartPoint: HorizontalAlignment.Left,
verticalStartPoint: VerticalAlignment.Bottom
};

private _overlaySettings = {
private overlaySettings = {
closeOnOutsideClick: true,
modal: false,
positionStrategy: new ConnectedPositioningStrategy(this._positionSettings),
positionStrategy: new ConnectedPositioningStrategy(this.positionSettings),
scrollStrategy: new CloseScrollStrategy()
};

Expand All @@ -77,8 +77,8 @@ export class $(ClassName)Component {
}

public toggleDropDown(ev) {
this._overlaySettings.positionStrategy.settings.target = ev.target;
this.igxDropDown.toggle(this._overlaySettings);
this.overlaySettings.positionStrategy.settings.target = ev.target;
this.igxDropDown.toggle(this.overlaySettings);
}

public onDropDownOpen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const division = {
'East South Central 01': ['Alabama', 'Kentucky'],
'East South Central 02': ['Mississippi', 'Tennessee'],
'West South Central': ['Arkansas', 'Louisiana', 'Oklahoma', 'Texas'],
// tslint:disable-next-line:object-literal-key-quotes
'Mountain': ['Arizona', 'Colorado', 'Idaho', 'Montana', 'Nevada', 'New Mexico', 'Utah', 'Wyoming'],
'Pacific 01': ['Alaska', 'California'],
'Pacific 02': ['Hawaii', 'Oregon', 'Washington']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
OnInit,
ViewChild
} from '@angular/core';
import { IgxGridComponent, IgxNumberSummaryOperand, IgxStringFilteringOperand, IgxSummaryResult} from 'igniteui-angular';
import { athletesData } from './services/data';
import { IgxGridComponent, IgxNumberSummaryOperand, IgxStringFilteringOperand, IgxSummaryResult} from 'igniteui-angular';
import { athletesData } from './services/data';

// tslint:disable:no-use-before-declare

Expand All @@ -26,20 +26,20 @@ export class $(ClassName)Component implements OnInit, OnDestroy {
public bnpSummary = CustomBPMSummary;
public localData: any[];
public isFinished = false;
private _live = true;
private _timer;
private isLive = true;
private timer;
private windowWidth: any;

get live() {
return this._live;
return this.isLive;
}

set live(val) {
this._live = val;
if (this._live) {
this._timer = setInterval(() => this.ticker(), 3000);
this.isLive = val;
if (this.isLive) {
this.timer = setInterval(() => this.ticker(), 3000);
} else {
clearInterval(this._timer);
clearInterval(this.timer);
}
}

Expand All @@ -55,11 +55,11 @@ export class $(ClassName)Component implements OnInit, OnDestroy {
public ngOnInit() {
this.localData = athletesData;
this.windowWidth = window.innerWidth;
this._timer = setInterval(() => this.ticker(), 3000);
this.timer = setInterval(() => this.ticker(), 3000);
}

public ngOnDestroy() {
clearInterval(this._timer);
clearInterval(this.timer);
}

public isTop3(cell): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ export class $(ClassName)Component implements OnInit, AfterViewInit {
public searchText = '';
public caseSensitive = false;

public _positionSettings: PositionSettings = {
public positionSettings: PositionSettings = {
horizontalDirection: HorizontalAlignment.Left,
horizontalStartPoint: HorizontalAlignment.Right,
verticalStartPoint: VerticalAlignment.Bottom
};

public _overlaySettings: OverlaySettings = {
public overlaySettings: OverlaySettings = {
closeOnOutsideClick: true,
modal: false,
positionStrategy: new ConnectedPositioningStrategy(this._positionSettings),
positionStrategy: new ConnectedPositioningStrategy(this.positionSettings),
scrollStrategy: new CloseScrollStrategy()
};

Expand All @@ -75,13 +75,13 @@ export class $(ClassName)Component implements OnInit, AfterViewInit {
}

public toggleHiding() {
this._overlaySettings.positionStrategy.settings.target = this.hidingButton.nativeElement;
this.toggleRefHiding.toggle(this._overlaySettings);
this.overlaySettings.positionStrategy.settings.target = this.hidingButton.nativeElement;
this.toggleRefHiding.toggle(this.overlaySettings);
}

public togglePinning() {
this._overlaySettings.positionStrategy.settings.target = this.pinningButton.nativeElement;
this.toggleRefPinning.toggle(this._overlaySettings);
this.overlaySettings.positionStrategy.settings.target = this.pinningButton.nativeElement;
this.toggleRefPinning.toggle(this.overlaySettings);
}

public ngAfterViewInit() {
Expand Down Expand Up @@ -149,7 +149,7 @@ export class $(ClassName)Component implements OnInit, AfterViewInit {
}
}

function formatDate(val: Date) {
function formatDate(val: Date) {
return new Intl.DateTimeFormat('en-US').format(val);
}
class DealsSummary extends IgxNumberSummaryOperand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ import { IgxTreeGridModule, IgxCheckboxModule, IgxButtonModule, IgxSliderModule,

describe('$(ClassName)Component', () => {
let component: $(ClassName)Component;
let fixture: ComponentFixture<$(ClassName)Component>;
let fixture: ComponentFixture<$(ClassName)Component >;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ $(ClassName)Component, $(ClassName)TreeGridGroupingPipe ],
imports: [ FormsModule, BrowserAnimationsModule, IgxTreeGridModule, IgxCheckboxModule, IgxButtonModule, IgxSliderModule, IgxSwitchModule ]
declarations: [$(ClassName)Component, $(ClassName)TreeGridGroupingPipe],
imports: [
FormsModule,
BrowserAnimationsModule,
IgxTreeGridModule,
IgxCheckboxModule,
IgxButtonModule,
IgxSliderModule,
IgxSwitchModule]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ export class FinancialData {
return {data: currData, recordsUpdated: y };
}
private randomizeObjectData(dataObj) {
const changeP = "Change(%)";
const changeP = 'Change(%)';
const res = this.generateNewPrice(dataObj.Price);
dataObj.Change = res.Price - dataObj.Price;
dataObj.Price = res.Price;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { $(ClassName)Component } from './$(filePrefix).component';
import { IgxInputGroupModule, IgxIconModule, IgxButtonModule, IgxRippleModule } from 'igniteui-angular';

const MAIL_GROUP_NAME = 'email';
const PASSWORD_GROUP_NAME = 'password';
const NEW_MAIL_GROUP_NAME = 'newEmail';
const NEW_PASSWORD_GROUP_NAME = 'newPassword';
const FIRST_NAME_GROUP_NAME = 'firstName';
const LAST_NAME_GROUP_NAME = 'lastName';

describe('$(ClassName)Component', () => {
let component: $(ClassName)Component;
let fixture: ComponentFixture<$(ClassName)Component>;
Expand All @@ -28,21 +35,21 @@ describe('$(ClassName)Component', () => {

it('should not allow login until valid', async () => {
expect(component.loginForm.valid).toBeFalsy();
component.loginForm.controls['email'].setValue('test@example.com');
component.loginForm.controls[MAIL_GROUP_NAME].setValue('test@example.com');
expect(component.loginForm.valid).toBeFalsy();
component.loginForm.controls['password'].setValue('123456');
component.loginForm.controls[PASSWORD_GROUP_NAME].setValue('123456');
expect(component.loginForm.valid).toBeTruthy();
});

it('should not allow register until valid', async () => {
expect(component.registrationForm.valid).toBeFalsy();
component.registrationForm.controls['newEmail'].setValue('test@example.com');
component.registrationForm.controls[NEW_MAIL_GROUP_NAME].setValue('test@example.com');
expect(component.registrationForm.valid).toBeFalsy();
component.registrationForm.controls['firstName'].setValue('John');
component.registrationForm.controls[FIRST_NAME_GROUP_NAME].setValue('John');
expect(component.registrationForm.valid).toBeFalsy();
component.registrationForm.controls['lastName'].setValue('Doe');
component.registrationForm.controls[LAST_NAME_GROUP_NAME].setValue('Doe');
expect(component.registrationForm.valid).toBeFalsy();
component.registrationForm.controls['newPassword'].setValue('123456');
component.registrationForm.controls[NEW_PASSWORD_GROUP_NAME].setValue('123456');
expect(component.registrationForm.valid).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { Component, ViewChild } from '@angular/core';
import { IgxExpansionPanelComponent } from 'igniteui-angular';
import { data as weatherData } from './weather-data';

@Component({
@Component({
selector: 'app-$(filePrefix)',
templateUrl: './$(filePrefix).component.html',
styleUrls: ['./$(filePrefix).component.scss']
})
export class $(ClassName)Component {
})

export class $(ClassName)Component {

@ViewChild(IgxExpansionPanelComponent, { static: true })
public panel: IgxExpansionPanelComponent;
Expand Down
Loading

0 comments on commit b2bbc2e

Please sign in to comment.