diff --git a/package-lock.json b/package-lock.json index 6e5609c5d24..17f3d5e4fc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -402,6 +402,12 @@ "normalize-path": "2.1.1" } }, + "app-root-path": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.0.1.tgz", + "integrity": "sha1-zWLc+OT9WkF+/GZNLlsQZTxlG0Y=", + "dev": true + }, "append-transform": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", @@ -2010,6 +2016,20 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, + "codelyzer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/codelyzer/-/codelyzer-4.1.0.tgz", + "integrity": "sha512-a3FCIAS3FNQIACvj7KA4iKvH3c6r7X6t6zXsrtV797QGYPQyCwD1fIEd9yV+ZDamijF3YaZ5fbB7QbUMOJGC/g==", + "dev": true, + "requires": { + "app-root-path": "2.0.1", + "css-selector-tokenizer": "0.7.0", + "cssauron": "1.4.0", + "semver-dsl": "1.0.1", + "source-map": "0.5.6", + "sprintf-js": "1.0.3" + } + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -2499,6 +2519,15 @@ "regexpu-core": "1.0.0" } }, + "cssauron": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssauron/-/cssauron-1.4.0.tgz", + "integrity": "sha1-pmAt/34EqDBtwNuaVR6S6LVmKtg=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, "cssesc": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", @@ -9329,6 +9358,23 @@ "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", "dev": true }, + "semver-dsl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/semver-dsl/-/semver-dsl-1.0.1.tgz", + "integrity": "sha1-02eN5VVeimH2Ke7QJTZq5fJzQKA=", + "dev": true, + "requires": { + "semver": "5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + } + } + }, "sequencify": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", diff --git a/package.json b/package.json index 55e895737f6..587fb1fde66 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "angular2-template-loader": "^0.6.2", "autoprefixer": "^7.2.5", "awesome-typescript-loader": "^3.4.1", + "codelyzer": "^4.1.0", "coveralls": "^3.0.0", "concurrently": "^3.5.1", "css-loader": "^0.28.8", diff --git a/src/avatar/avatar.component.spec.ts b/src/avatar/avatar.component.spec.ts index 7b082bfe218..1cdccb3e4e1 100644 --- a/src/avatar/avatar.component.spec.ts +++ b/src/avatar/avatar.component.spec.ts @@ -4,27 +4,27 @@ import { TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxIcon, IgxIconModule } from "../icon/icon.component"; -import { IgxAvatar, IgxAvatarModule } from "./avatar.component"; +import { IgxIconComponent, IgxIconModule } from "../icon/icon.component"; +import { IgxAvatarComponent, IgxAvatarModule } from "./avatar.component"; describe("Avatar", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitAvatar, - AvatarWithAttribs, - IgxAvatar, - IgxIcon, - InitIconAvatar, - InitImageAvatar, - InitAvatarWithAria + InitAvatarComponent, + AvatarWithAttribsComponent, + IgxAvatarComponent, + IgxIconComponent, + InitIconAvatarComponent, + InitImageAvatarComponent, + InitAvatarWithAriaComponent ] }) .compileComponents(); })); it("Initializes avatar with initials", () => { - const fixture = TestBed.createComponent(InitAvatar); + const fixture = TestBed.createComponent(InitAvatarComponent); fixture.detectChanges(); const avatar = fixture.componentInstance.avatar; @@ -35,7 +35,7 @@ describe("Avatar", () => { }); it("Initializes bound avatar with initials", () => { - const fixture = TestBed.createComponent(AvatarWithAttribs); + const fixture = TestBed.createComponent(AvatarWithAttribsComponent); fixture.detectChanges(); const avatar = fixture.componentInstance.avatar; @@ -45,7 +45,7 @@ describe("Avatar", () => { expect(avatar.isRounded).toBeTruthy(); }); it("Initializes icon avatar", () => { - const fixture = TestBed.createComponent(InitIconAvatar); + const fixture = TestBed.createComponent(InitIconAvatarComponent); fixture.detectChanges(); const avatar = fixture.componentInstance.avatar; const spanEl = avatar.elementRef.nativeElement.getElementsByClassName("igx-avatar--icon"); @@ -64,7 +64,7 @@ describe("Avatar", () => { }); it("Initializes image avatar with src element", () => { - const fixture = TestBed.createComponent(InitImageAvatar); + const fixture = TestBed.createComponent(InitImageAvatarComponent); fixture.detectChanges(); const avatar = fixture.componentInstance.avatar; @@ -82,7 +82,7 @@ describe("Avatar", () => { }); it("Should set ARIA attributes.", () => { - const fixture = TestBed.createComponent(InitAvatarWithAria); + const fixture = TestBed.createComponent(InitAvatarWithAriaComponent); fixture.detectChanges(); const avatar = fixture.componentInstance.avatar; @@ -97,44 +97,44 @@ describe("Avatar", () => { template: ` `}) -class InitAvatar { - @ViewChild(IgxAvatar) public avatar: IgxAvatar; +class InitAvatarComponent { + @ViewChild(IgxAvatarComponent) public avatar: IgxAvatarComponent; } @Component({ template: ``}) -class AvatarWithAttribs { - @ViewChild(IgxAvatar) public avatar: IgxAvatar; +class AvatarWithAttribsComponent { + @ViewChild(IgxAvatarComponent) public avatar: IgxAvatarComponent; - public initials: string = "ZK"; - public bgColor: string = "lightblue"; - public roundShape: string = "true"; + public initials = "ZK"; + public bgColor = "lightblue"; + public roundShape = "true"; } @Component({ template: ` `}) -class InitIconAvatar { - @ViewChild(IgxAvatar) public avatar: IgxAvatar; +class InitIconAvatarComponent { + @ViewChild(IgxAvatarComponent) public avatar: IgxAvatarComponent; } @Component({ template: ` `}) -class InitImageAvatar { - @ViewChild(IgxAvatar) public avatar: IgxAvatar; +class InitImageAvatarComponent { + @ViewChild(IgxAvatarComponent) public avatar: IgxAvatarComponent; // tslint:disable-next-line:max-line-length - public source: string = "data:image/jpeg;base64,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"; + public source = "data:image/jpeg;base64,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"; } @Component({ template: ` `}) -class InitAvatarWithAria { - @ViewChild(IgxAvatar) public avatar: IgxAvatar; +class InitAvatarWithAriaComponent { + @ViewChild(IgxAvatarComponent) public avatar: IgxAvatarComponent; } diff --git a/src/avatar/avatar.component.ts b/src/avatar/avatar.component.ts index 7ba6e714e63..95854b2daae 100644 --- a/src/avatar/avatar.component.ts +++ b/src/avatar/avatar.component.ts @@ -1,5 +1,7 @@ import { CommonModule } from "@angular/common"; import { + AfterContentChecked, + AfterViewInit, Component, ElementRef, Input, @@ -22,12 +24,12 @@ export enum Size { styleUrls: ["./avatar.component.scss"], templateUrl: "avatar.component.html" }) -export class IgxAvatar { +export class IgxAvatarComponent implements AfterViewInit, AfterContentChecked { @ViewChild("image") public image: ElementRef; @Input() public initials: string; @Input() public src: string; - @Input("roundShape") public roundShape: string = "false"; - @Input() public color: string = "white"; + @Input("roundShape") public roundShape = "false"; + @Input() public color = "white"; public sizeEnum = Size; public roleDescription: string; @@ -36,7 +38,7 @@ export class IgxAvatar { private _size: string; private _bgColor: string; - private _icon: string = "android"; + private _icon = "android"; @Input() get size(): string { @@ -133,8 +135,8 @@ export class IgxAvatar { } @NgModule({ - declarations: [IgxAvatar], - exports: [IgxAvatar], + declarations: [IgxAvatarComponent], + exports: [IgxAvatarComponent], imports: [CommonModule, IgxIconModule] }) export class IgxAvatarModule { } diff --git a/src/badge/badge.component.spec.ts b/src/badge/badge.component.spec.ts index 812b418c40f..42f20082c41 100644 --- a/src/badge/badge.component.spec.ts +++ b/src/badge/badge.component.spec.ts @@ -4,25 +4,25 @@ import { TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxIcon, IgxIconModule } from "../icon/icon.component"; -import { IgxBadge, IgxBadgeModule } from "./badge.component"; +import { IgxIconComponent, IgxIconModule } from "../icon/icon.component"; +import { IgxBadgeComponent, IgxBadgeModule } from "./badge.component"; describe("Badge", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitBadge, - InitBadgeWithDefaults, - InitBadgeWithIcon, - IgxBadge, - InitBadgeWithIconARIA, - IgxIcon + InitBadgeComponent, + InitBadgeWithDefaultsComponent, + InitBadgeWithIconComponent, + IgxBadgeComponent, + InitBadgeWithIconARIAComponent, + IgxIconComponent ] }).compileComponents(); })); it("Initializes badge ", () => { - const fixture = TestBed.createComponent(InitBadge); + const fixture = TestBed.createComponent(InitBadgeComponent); fixture.detectChanges(); const badge = fixture.componentInstance.badge; @@ -36,7 +36,7 @@ describe("Badge", () => { }); it("Initializes badge defaults", () => { - const fixture = TestBed.createComponent(InitBadgeWithDefaults); + const fixture = TestBed.createComponent(InitBadgeWithDefaultsComponent); fixture.detectChanges(); const badge = fixture.componentInstance.badge; @@ -48,7 +48,7 @@ describe("Badge", () => { }); it("Initializes badge with icon", () => { - const fixture = TestBed.createComponent(InitBadgeWithIcon); + const fixture = TestBed.createComponent(InitBadgeWithIconComponent); fixture.detectChanges(); const badge = fixture.componentInstance.badge; const divContainer = fixture.elementRef.nativeElement.querySelectorAll("div.igx-badge__circle"); @@ -64,7 +64,7 @@ describe("Badge", () => { }); it("Initializes badge with icon ARIA", () => { - const fixture = TestBed.createComponent(InitBadgeWithIconARIA); + const fixture = TestBed.createComponent(InitBadgeWithIconARIAComponent); fixture.detectChanges(); const badge = fixture.componentInstance.badge; const divContainer = fixture.elementRef.nativeElement.querySelectorAll("div.igx-badge__circle"); @@ -76,21 +76,21 @@ describe("Badge", () => { }); @Component({ template: `` }) -class InitBadge { - @ViewChild(IgxBadge) public badge: IgxBadge; +class InitBadgeComponent { + @ViewChild(IgxBadgeComponent) public badge: IgxBadgeComponent; } @Component({ template: `` }) -class InitBadgeWithDefaults { - @ViewChild(IgxBadge) public badge: IgxBadge; +class InitBadgeWithDefaultsComponent { + @ViewChild(IgxBadgeComponent) public badge: IgxBadgeComponent; } @Component({ template: `` }) -class InitBadgeWithIcon { - @ViewChild(IgxBadge) public badge: IgxBadge; +class InitBadgeWithIconComponent { + @ViewChild(IgxBadgeComponent) public badge: IgxBadgeComponent; } @Component({ template: `` }) -class InitBadgeWithIconARIA { - @ViewChild(IgxBadge) public badge: IgxBadge; +class InitBadgeWithIconARIAComponent { + @ViewChild(IgxBadgeComponent) public badge: IgxBadgeComponent; } diff --git a/src/badge/badge.component.ts b/src/badge/badge.component.ts index 0c23ddca961..261a398bcdc 100644 --- a/src/badge/badge.component.ts +++ b/src/badge/badge.component.ts @@ -11,10 +11,10 @@ export enum Position { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT } styleUrls: ["./badge.component.scss"], templateUrl: "badge.component.html" }) -export class IgxBadge { +export class IgxBadgeComponent { public typeEnum = Type; public positionEnum = Position; - private _type: string = ""; + private _type = ""; private _value: string; private _iconBdg: string; private _position; @@ -137,8 +137,8 @@ export class IgxBadge { } @NgModule({ - declarations: [IgxBadge], - exports: [IgxBadge], + declarations: [IgxBadgeComponent], + exports: [IgxBadgeComponent], imports: [CommonModule, IgxIconModule] }) export class IgxBadgeModule { diff --git a/src/buttonGroup/buttonGroup.component.ts b/src/buttonGroup/buttonGroup.component.ts index 2335b892ee6..16ee4112f65 100644 --- a/src/buttonGroup/buttonGroup.component.ts +++ b/src/buttonGroup/buttonGroup.component.ts @@ -8,8 +8,8 @@ import { forwardRef, Inject, Input, NgModule, Output, QueryList, Renderer2, ViewChildren } from "@angular/core"; -import { IgxButton, IgxButtonModule } from "../button/button.directive"; -import { IgxRippleModule } from "../directives/ripple.directive"; +import { IgxButtonDirective, IgxButtonModule } from "../directives/button/button.directive"; +import { IgxRippleModule } from "../directives/ripple/ripple.directive"; import { IgxIconModule } from "../icon/icon.component"; export enum ButtonGroupAlignment { horizontal, vertical } @@ -22,17 +22,17 @@ export enum ButtonGroupAlignment { horizontal, vertical } templateUrl: "buttongroup-content.component.html" }) -export class IgxButtonGroup implements AfterViewInit { - @ViewChildren(IgxButton) public buttons: QueryList; +export class IgxButtonGroupComponent implements AfterViewInit { + @ViewChildren(IgxButtonDirective) public buttons: QueryList; @Input() set itemContentCssClass(value: string) { this._itemContentCssClass = value || this._itemContentCssClass; } get itemContentCssClass(): string { return this._itemContentCssClass; } - @Input() public multiSelection: boolean = false; + @Input() public multiSelection = false; @Input() public values: any; - @Input() public disabled: boolean = false; + @Input() public disabled = false; public selectedIndexes: number[] = []; @@ -55,7 +55,7 @@ export class IgxButtonGroup implements AfterViewInit { constructor(private _el: ElementRef, private _renderer: Renderer2, cdr: ChangeDetectorRef) { } - get selectedButtons(): IgxButtonGroup[] { + get selectedButtons(): IgxButtonGroupComponent[] { return this.buttons.filter((b, i) => { return this.selectedIndexes.indexOf(i) !== -1; }); @@ -116,8 +116,8 @@ export class IgxButtonGroup implements AfterViewInit { } @NgModule({ - declarations: [IgxButtonGroup], - exports: [IgxButtonGroup], + declarations: [IgxButtonGroupComponent], + exports: [IgxButtonGroupComponent], imports: [IgxButtonModule, CommonModule, IgxRippleModule, IgxIconModule] }) diff --git a/src/buttonGroup/buttongroup.component.spec.ts b/src/buttonGroup/buttongroup.component.spec.ts index 9cdc2a38e65..59819a1c3a8 100644 --- a/src/buttonGroup/buttongroup.component.spec.ts +++ b/src/buttonGroup/buttongroup.component.spec.ts @@ -1,10 +1,10 @@ -import { ChangeDetectorRef, Component, ViewChild } from "@angular/core"; +import { ChangeDetectorRef, Component, OnInit, ViewChild } from "@angular/core"; import { async, TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { ButtonGroupAlignment, IgxButtonGroup, IgxButtonGroupModule } from "./buttonGroup.component"; +import { ButtonGroupAlignment, IgxButtonGroupComponent, IgxButtonGroupModule } from "./buttonGroup.component"; interface IButton { type?: string; @@ -45,21 +45,21 @@ class Button { describe("IgxButtonGroup", () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ InitButtonGroup, InitButtonGroupWithValues], + declarations: [ InitButtonGroupComponent, InitButtonGroupWithValuesComponent], imports: [IgxButtonGroupModule] }) .compileComponents(); })); it("should initialize buttonGroup with default values", () => { - const fixture = TestBed.createComponent(InitButtonGroup); + const fixture = TestBed.createComponent(InitButtonGroupComponent); fixture.detectChanges(); const instance = fixture.componentInstance; const buttongroup = fixture.componentInstance.buttonGroup; expect(instance.buttonGroup).toBeDefined(); - expect(buttongroup instanceof IgxButtonGroup).toBe(true); + expect(buttongroup instanceof IgxButtonGroupComponent).toBe(true); expect(buttongroup.disabled).toBeFalsy(); expect(buttongroup.alignment).toBe(ButtonGroupAlignment.horizontal); expect(buttongroup.multiSelection).toBeFalsy(); @@ -69,14 +69,14 @@ describe("IgxButtonGroup", () => { }); it("should initialize buttonGroup with passed values", () => { - const fixture = TestBed.createComponent(InitButtonGroupWithValues); + const fixture = TestBed.createComponent(InitButtonGroupWithValuesComponent); fixture.detectChanges(); const instance = fixture.componentInstance; const buttongroup = fixture.componentInstance.buttonGroup; expect(instance.buttonGroup).toBeDefined(); - expect(buttongroup instanceof IgxButtonGroup).toBe(true); + expect(buttongroup instanceof IgxButtonGroupComponent).toBe(true); expect(buttongroup.disabled).toBeFalsy(); expect(buttongroup.alignment).toBe(ButtonGroupAlignment.vertical); expect(buttongroup.multiSelection).toBeTruthy(); @@ -86,7 +86,7 @@ describe("IgxButtonGroup", () => { }); it("Button Group single selection", () => { - const fixture = TestBed.createComponent(InitButtonGroup); + const fixture = TestBed.createComponent(InitButtonGroupComponent); fixture.detectChanges(); const buttongroup = fixture.componentInstance.buttonGroup; @@ -98,7 +98,7 @@ describe("IgxButtonGroup", () => { }); it("Button Group multiple selection", () => { - const fixture = TestBed.createComponent(InitButtonGroupWithValues); + const fixture = TestBed.createComponent(InitButtonGroupWithValuesComponent); fixture.detectChanges(); const buttongroup = fixture.componentInstance.buttonGroup; @@ -117,8 +117,8 @@ describe("IgxButtonGroup", () => { }); @Component({ template: `` }) -class InitButtonGroup { - @ViewChild(IgxButtonGroup) public buttonGroup: IgxButtonGroup; +class InitButtonGroupComponent implements OnInit { + @ViewChild(IgxButtonGroupComponent) public buttonGroup: IgxButtonGroupComponent; private buttons: Button[]; @@ -147,8 +147,8 @@ class InitButtonGroup { @Component({ template: ` ` }) -class InitButtonGroupWithValues { - @ViewChild(IgxButtonGroup) public buttonGroup: IgxButtonGroup; +class InitButtonGroupWithValuesComponent implements OnInit { + @ViewChild(IgxButtonGroupComponent) public buttonGroup: IgxButtonGroupComponent; private cities: Button[]; @@ -187,8 +187,8 @@ class InitButtonGroupWithValues { @Component({ template: ` ` }) -class ButtonGroupWithValues { - @ViewChild(IgxButtonGroup) public buttonGroup: IgxButtonGroup; +class ButtonGroupWithValuesComponent implements OnInit { + @ViewChild(IgxButtonGroupComponent) public buttonGroup: IgxButtonGroupComponent; private buttons: Button[]; diff --git a/src/calendar/calendar.component.ts b/src/calendar/calendar.component.ts index 29528f5a379..466f113730c 100644 --- a/src/calendar/calendar.component.ts +++ b/src/calendar/calendar.component.ts @@ -74,7 +74,7 @@ export class IgxCalendarComponent implements OnInit, ControlValueAccessor { public set weekStart(value: WEEKDAYS | number) { this.calendarModel.firstWeekDay = value; } - @Input() public locale: string = "en"; + @Input() public locale = "en"; @Input() public get selection(): string { return this._selection; } @@ -133,7 +133,7 @@ export class IgxCalendarComponent implements OnInit, ControlValueAccessor { private _activeView = CalendarView.DEFAULT; private selectedDates; private _selection: "single" | "multi" | "range" = "single"; - private _rangeStarted: boolean = false; + private _rangeStarted = false; private _monthAction = ""; constructor(private elementRef: ElementRef) { diff --git a/src/card/card.component.ts b/src/card/card.component.ts index fe47acbbbb6..d3f8e60c477 100644 --- a/src/card/card.component.ts +++ b/src/card/card.component.ts @@ -1,40 +1,46 @@ -import { Component, Directive, NgModule, ViewEncapsulation } from "@angular/core"; -import { IgxButtonModule } from "../button/button.directive"; +import { Component, Directive, Input, NgModule, ViewEncapsulation } from "@angular/core"; +import { IgxButtonModule } from "../directives/button/button.directive"; /** * IgxCardHeader is container for the card header */ @Directive({ + // tslint:disable-next-line:directive-selector selector: "igx-card-header" }) -export class IgxCardHeader { } +export class IgxCardHeaderDirective { } /** * IgxCardContent is container for the card content */ @Directive({ + // tslint:disable-next-line:directive-selector selector: "igx-card-content" }) -export class IgxCardContent { } +export class IgxCardContentDirective { } /** * IgxCardActions is container for the card actions */ @Directive({ + // tslint:disable-next-line:directive-selector selector: "igx-card-actions" }) -export class IgxCardActions { } +export class IgxCardActionsDirective { } /** * IgxCardFooter is container for the card footer */ @Directive({ - host: { +/* host: { role: "footer" - }, + }, */ + // tslint:disable-next-line:directive-selector selector: "igx-card-footer" }) -export class IgxCardFooter { } +export class IgxCardFooterDirective { + @Input() public role = "footer"; + } /** * IgxCardComponent is a sheet of material that serves as an entry point to more detailed information. @@ -48,8 +54,10 @@ export class IgxCardFooter { } export class IgxCardComponent { } @NgModule({ - declarations: [IgxCardComponent, IgxCardHeader, IgxCardContent, IgxCardActions, IgxCardFooter], - exports: [IgxCardComponent, IgxCardHeader, IgxCardContent, IgxCardActions, IgxCardFooter], + declarations: [IgxCardComponent, IgxCardHeaderDirective, + IgxCardContentDirective, IgxCardActionsDirective, IgxCardFooterDirective], + exports: [IgxCardComponent, IgxCardHeaderDirective, + IgxCardContentDirective, IgxCardActionsDirective, IgxCardFooterDirective], imports: [IgxButtonModule] }) export class IgxCardModule { } diff --git a/src/carousel/carousel.component.spec.ts b/src/carousel/carousel.component.spec.ts index 67c712a0093..720b4931973 100644 --- a/src/carousel/carousel.component.spec.ts +++ b/src/carousel/carousel.component.spec.ts @@ -4,7 +4,7 @@ import { TestBed } from "@angular/core/testing"; import {By} from "@angular/platform-browser"; -import {IgxCarousel, IgxCarouselModule, IgxSlide} from "./carousel.component"; +import {IgxCarouselComponent, IgxCarouselModule, IgxSlideComponent} from "./carousel.component"; function dispatchEv(element: HTMLElement, eventType: string) { const event = new Event(eventType); @@ -28,8 +28,8 @@ describe("Carousel", () => { fixture.detectChanges(); expect(instance.carousel).toBeDefined(); - expect(instance.carousel instanceof IgxCarousel).toBe(true); - expect(instance.carousel.slides[0] instanceof IgxSlide).toBe(true); + expect(instance.carousel instanceof IgxCarouselComponent).toBe(true); + expect(instance.carousel.slides[0] instanceof IgxSlideComponent).toBe(true); expect(instance.carousel.slides instanceof Array).toBe(true); expect(instance.carousel.loop).toBe(true); @@ -235,7 +235,7 @@ describe("Carousel", () => { }) class CarouselTestComponent { - @ViewChild("carousel") public carousel: IgxCarousel; + @ViewChild("carousel") public carousel: IgxCarouselComponent; public loop = true; public pause = true; diff --git a/src/carousel/carousel.component.ts b/src/carousel/carousel.component.ts index 9fabf3dfbc1..794f9024d0c 100644 --- a/src/carousel/carousel.component.ts +++ b/src/carousel/carousel.component.ts @@ -25,22 +25,20 @@ export enum Direction { NONE, NEXT, PREV } * * ``` * @export - * @class IgxCarousel + * @class IgxCarouselComponent * @implements {OnDestroy} */ @Component({ encapsulation: ViewEncapsulation.None, - host: { - role: "region" - }, selector: "igx-carousel", styleUrls: ["./carousel.component.scss"], templateUrl: "carousel.component.html" }) -export class IgxCarousel implements OnDestroy { +export class IgxCarouselComponent implements OnDestroy { + @HostBinding("attr.role") public role = "region"; /** * Sets whether the carousel should loop back to the first slide * after reaching the last slide. @@ -48,9 +46,9 @@ export class IgxCarousel implements OnDestroy { * Default value is true * * @type {boolean} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - @Input() public loop: boolean = true; + @Input() public loop = true; /** * Sets whether the carousel can pause the slide transitions. @@ -58,9 +56,9 @@ export class IgxCarousel implements OnDestroy { * Default value is true * * @type {boolean} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - @Input() public pause: boolean = true; + @Input() public pause = true; @Input() get interval(): number { @@ -78,16 +76,16 @@ export class IgxCarousel implements OnDestroy { * Default value is true * * @type {boolean} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - @Input() public navigation: boolean = true; + @Input() public navigation = true; /** * An event that is emitted after a slide transition has happened. - * Provides a reference to the IgxCarousel as an event argument. + * Provides a reference to the IgxCarouselComponent as an event argument. * * @type {EventEmitter} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ @Output() public onSlideChanged = new EventEmitter(); @@ -96,16 +94,16 @@ export class IgxCarousel implements OnDestroy { * Provides a reference to the IgxCarousel as an event argument. * * @type {EventEmitter} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ @Output() public onSlideAdded = new EventEmitter(); /** * An event that is emitted after a slide has been removed from the carousel. - * Provides a reference to the IgxCarousel as an event argument. + * Provides a reference to the IgxCarouselComponent as an event argument. * * @type {EventEmitter} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ @Output() public onSlideRemoved = new EventEmitter(); @@ -114,7 +112,7 @@ export class IgxCarousel implements OnDestroy { * Provides a reference to the IgxCarousel as an event argument. * * @type {EventEmitter} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ @Output() public onCarouselPaused = new EventEmitter(); @@ -123,7 +121,7 @@ export class IgxCarousel implements OnDestroy { * Provides a reference to the IgxCarousel as an event argument. * * @type {EventEmitter} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ @Output() public onCarouselPlaying = new EventEmitter(); @@ -131,15 +129,15 @@ export class IgxCarousel implements OnDestroy { * The collection of slides currently in the carousel * * @type {Array} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - public slides: IgxSlide[] = []; + public slides: IgxSlideComponent[] = []; private _interval: number; private _lastInterval: any; private _playing: boolean; - private _currentSlide: IgxSlide; + private _currentSlide: IgxSlideComponent; private _destroyed: boolean; - private _total: number = 0; + private _total = 0; public ngOnDestroy() { this._destroyed = true; @@ -157,7 +155,7 @@ export class IgxCarousel implements OnDestroy { * * @readonly * @type {number} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public get total(): number { return this._total; @@ -168,7 +166,7 @@ export class IgxCarousel implements OnDestroy { * * @readonly * @type {number} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public get current(): number { return !this._currentSlide ? 0 : this._currentSlide.index; @@ -179,7 +177,7 @@ export class IgxCarousel implements OnDestroy { * * @readonly * @type {boolean} - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public get isPlaying(): boolean { return this._playing; @@ -190,7 +188,7 @@ export class IgxCarousel implements OnDestroy { * * @readonly * @type {boolean} - * @memberOf Carousel + * @memberOf IgxCarouselComponent */ public get isDestroyed(): boolean { return this._destroyed; @@ -200,11 +198,11 @@ export class IgxCarousel implements OnDestroy { * Returns the slide corresponding to the provided index or null. * * @param {number} index - * @returns {IgxSlide} + * @returns {IgxSlideComponent} * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - public get(index: number): IgxSlide { + public get(index: number): IgxSlideComponent { for (const each of this.slides) { if (each.index === index) { return each; @@ -215,11 +213,11 @@ export class IgxCarousel implements OnDestroy { /** * Adds a new slide to the carousel. * - * @param {IgxSlide} slide + * @param {IgxSlideComponent} slide * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - public add(slide: IgxSlide) { + public add(slide: IgxSlideComponent) { slide.index = this.total; this.slides.push(slide); this._total += 1; @@ -239,12 +237,12 @@ export class IgxCarousel implements OnDestroy { /** * Removes the given slide from the carousel. * - * @param {IgxSlide} slide + * @param {IgxSlideComponent} slide * @returns * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - public remove(slide: IgxSlide) { + public remove(slide: IgxSlideComponent) { this.slides.splice(slide.index, 1); this._total -= 1; @@ -263,12 +261,12 @@ export class IgxCarousel implements OnDestroy { /** * Kicks in a transition for a given slide with a given direction. * - * @param {IgxSlide} slide + * @param {IgxSlideComponent} slide * @param {Direction} [direction=Direction.NONE] * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ - public select(slide: IgxSlide, direction: Direction = Direction.NONE) { + public select(slide: IgxSlideComponent, direction: Direction = Direction.NONE) { const newIndex = slide.index; if (direction === Direction.NONE) { direction = newIndex > this.current ? Direction.NEXT : Direction.PREV; @@ -284,7 +282,7 @@ export class IgxCarousel implements OnDestroy { * * @returns * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public next() { const index = (this.current + 1) % this.total; @@ -301,7 +299,7 @@ export class IgxCarousel implements OnDestroy { * * @returns * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public prev() { const index = this.current - 1 < 0 ? @@ -319,7 +317,7 @@ export class IgxCarousel implements OnDestroy { * No-op otherwise. * * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public play() { if (!this._playing) { @@ -334,7 +332,7 @@ export class IgxCarousel implements OnDestroy { * No-op otherwise. * * - * @memberOf IgxCarousel + * @memberOf IgxCarouselComponent */ public stop() { if (this.pause) { @@ -357,7 +355,7 @@ export class IgxCarousel implements OnDestroy { } } - private _moveTo(slide: IgxSlide, direction: Direction) { + private _moveTo(slide: IgxSlideComponent, direction: Direction) { if (this._destroyed) { return; } @@ -401,7 +399,7 @@ export class IgxCarousel implements OnDestroy { /** * A slide component that usually holds an image and/or a caption text. - * IgxSlide is usually a child component of an IgxCarousel. + * IgxSlideComponent is usually a child component of an IgxCarouselComponent. * * ``` * @@ -410,22 +408,22 @@ export class IgxCarousel implements OnDestroy { * ``` * * @export - * @class IgxSlide + * @class IgxSlideComponent * @implements {OnInit} * @implements {OnDestroy} */ @Component({ selector: "igx-slide", - templateUrl: "slide.html" + templateUrl: "slide.component.html" }) -export class IgxSlide implements OnInit, OnDestroy { +export class IgxSlideComponent implements OnInit, OnDestroy { /** * The current index of the slide inside the carousel * * @type {number} - * @memberOf IgxSlide + * @memberOf IgxSlideComponent */ @Input() public index: number; @@ -433,14 +431,14 @@ export class IgxSlide implements OnInit, OnDestroy { * The target direction for the slide * * @type {Direction} - * @memberOf IgxSlide + * @memberOf IgxSlideComponent */ @Input() public direction: Direction; @HostBinding("class.active") @Input() public active: boolean; - constructor(private carousel: IgxCarousel) { } + constructor(private carousel: IgxCarouselComponent) { } public ngOnInit() { this.carousel.add(this); @@ -452,8 +450,8 @@ export class IgxSlide implements OnInit, OnDestroy { } @NgModule({ - declarations: [IgxCarousel, IgxSlide], - exports: [IgxCarousel, IgxSlide], + declarations: [IgxCarouselComponent, IgxSlideComponent], + exports: [IgxCarouselComponent, IgxSlideComponent], imports: [CommonModule, IgxIconModule] }) export class IgxCarouselModule { diff --git a/src/carousel/slide.html b/src/carousel/slide.component.html similarity index 100% rename from src/carousel/slide.html rename to src/carousel/slide.component.html diff --git a/src/checkbox/checkbox.component.spec.ts b/src/checkbox/checkbox.component.spec.ts index 494fea5af11..18bfdc20d72 100644 --- a/src/checkbox/checkbox.component.spec.ts +++ b/src/checkbox/checkbox.component.spec.ts @@ -5,16 +5,16 @@ import { } from "@angular/core/testing"; import { FormsModule } from "@angular/forms"; import { By } from "@angular/platform-browser"; -import { IgxCheckbox } from "./checkbox.component"; +import { IgxCheckboxComponent } from "./checkbox.component"; describe("IgxCheckbox", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitCheckbox, - CheckboxSimple, - CheckboxDisabled, - IgxCheckbox + InitCheckboxComponent, + CheckboxSimpleComponent, + CheckboxDisabledComponent, + IgxCheckboxComponent ], imports: [FormsModule] }) @@ -22,7 +22,7 @@ describe("IgxCheckbox", () => { })); it("Initializes a checkbox", () => { - const fixture = TestBed.createComponent(InitCheckbox); + const fixture = TestBed.createComponent(InitCheckboxComponent); fixture.detectChanges(); const nativeCheckbox = fixture.debugElement.query(By.css("input")).nativeElement; @@ -34,7 +34,7 @@ describe("IgxCheckbox", () => { }); it("Initialize with a ngModel", () => { - const fixture = TestBed.createComponent(CheckboxSimple); + const fixture = TestBed.createComponent(CheckboxSimpleComponent); fixture.detectChanges(); const nativeCheckbox = fixture.debugElement.query(By.css("input")).nativeElement; @@ -54,7 +54,7 @@ describe("IgxCheckbox", () => { }); it("Disabled state", () => { - const fixture = TestBed.createComponent(CheckboxDisabled); + const fixture = TestBed.createComponent(CheckboxDisabledComponent); fixture.detectChanges(); const nativeCheckbox = fixture.debugElement.query(By.css("input")).nativeElement; @@ -75,7 +75,7 @@ describe("IgxCheckbox", () => { }); it("Event handling", () => { - const fixture = TestBed.createComponent(CheckboxSimple); + const fixture = TestBed.createComponent(CheckboxSimpleComponent); fixture.detectChanges(); const nativeCheckbox = fixture.debugElement.query(By.css("input")).nativeElement; @@ -102,21 +102,21 @@ describe("IgxCheckbox", () => { }); @Component({ template: `Init`}) -class InitCheckbox {} +class InitCheckboxComponent {} @Component({ template: `Simple`}) -class CheckboxSimple { - @ViewChild("cb") public cb: IgxCheckbox; +class CheckboxSimpleComponent { + @ViewChild("cb") public cb: IgxCheckboxComponent; - public subscribed: boolean = false; + public subscribed = false; } @Component({ template: `Disabled`}) -class CheckboxDisabled { - @ViewChild("cb") public cb: IgxCheckbox; +class CheckboxDisabledComponent { + @ViewChild("cb") public cb: IgxCheckboxComponent; - public subscribed: boolean = false; + public subscribed = false; } diff --git a/src/checkbox/checkbox.component.ts b/src/checkbox/checkbox.component.ts index b37898a4a09..bd6c645a85c 100644 --- a/src/checkbox/checkbox.component.ts +++ b/src/checkbox/checkbox.component.ts @@ -13,20 +13,20 @@ const noop = () => { }; let nextId = 0; @Component({ - providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxCheckbox, multi: true }], + providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxCheckboxComponent, multi: true }], selector: "igx-checkbox", styleUrls: ["./checkbox.component.scss"], templateUrl: "checkbox.component.html" }) -export class IgxCheckbox implements ControlValueAccessor { - public focused: boolean = false; +export class IgxCheckboxComponent implements ControlValueAccessor { + public focused = false; @Input() public value: any; - @Input() public id: string = `igx-checkbox-${nextId++}`; + @Input() public id = `igx-checkbox-${nextId++}`; @Input() public name: string; - @Input() public disabled: boolean = false; + @Input() public disabled = false; @Input() public tabindex: number = null; - @Input() public checked: boolean = false; + @Input() public checked = false; @Output() public change = new EventEmitter(); @@ -69,7 +69,7 @@ export class IgxCheckbox implements ControlValueAccessor { } @NgModule({ - declarations: [IgxCheckbox], - exports: [IgxCheckbox] + declarations: [IgxCheckboxComponent], + exports: [IgxCheckboxComponent] }) export class IgxCheckboxModule { } diff --git a/src/core/navigation.ts b/src/core/navigation.ts index 40db0cefead..b00afd6dae2 100644 --- a/src/core/navigation.ts +++ b/src/core/navigation.ts @@ -1,3 +1,3 @@ -export * from "./navigation/nav-service"; +export * from "./navigation/nav.service"; export * from "./navigation/toggle"; export * from "./navigation/directives"; diff --git a/src/core/navigation/directives.ts b/src/core/navigation/directives.ts index 7b3a1c39045..3f98602fef4 100644 --- a/src/core/navigation/directives.ts +++ b/src/core/navigation/directives.ts @@ -1,5 +1,5 @@ import { Directive, HostListener, Input, NgModule } from "@angular/core"; -import {IgxNavigationService} from "./nav-service"; +import {IgxNavigationService} from "./nav.service"; /** * Directive that can toggle targets through provided NavigationService. @@ -11,7 +11,7 @@ import {IgxNavigationService} from "./nav-service"; * Where the `ID` matches the ID of compatible `IToggleView` component. */ @Directive({ selector: "[igxNavToggle]" }) -export class IgxNavigationToggle { +export class IgxNavigationToggleDirective { public state: IgxNavigationService; @Input("igxNavToggle") private target; @@ -36,7 +36,7 @@ export class IgxNavigationToggle { * Where the `ID` matches the ID of compatible `IToggleView` component. */ @Directive({ selector: "[igxNavClose]" }) -export class IgxNavigationClose { +export class IgxNavigationCloseDirective { public state: IgxNavigationService; @Input("igxNavClose") private target; @@ -52,8 +52,8 @@ export class IgxNavigationClose { } @NgModule({ - declarations: [IgxNavigationClose, IgxNavigationToggle], - exports: [IgxNavigationClose, IgxNavigationToggle], + declarations: [IgxNavigationCloseDirective, IgxNavigationToggleDirective], + exports: [IgxNavigationCloseDirective, IgxNavigationToggleDirective], providers: [IgxNavigationService] }) -export class IgxNavigationDirectives {} +export class IgxNavigationModule {} diff --git a/src/core/navigation/nav-service.ts b/src/core/navigation/nav.service.ts similarity index 100% rename from src/core/navigation/nav-service.ts rename to src/core/navigation/nav.service.ts diff --git a/src/core/touch.ts b/src/core/touch.ts index 648216b8a3b..51a5db57035 100644 --- a/src/core/touch.ts +++ b/src/core/touch.ts @@ -1,7 +1,7 @@ import { Inject, Injectable, NgZone } from "@angular/core"; import { DOCUMENT, ɵgetDOM as getDOM } from "@angular/platform-browser"; -const EVENT_SUFFIX: string = "precise"; +const EVENT_SUFFIX = "precise"; /** * Touch gestures manager based on Hammer.js diff --git a/src/data-operations/data-util.spec.ts b/src/data-operations/data-util.spec.ts index 1ad85ceea9b..668a20fa5fb 100644 --- a/src/data-operations/data-util.spec.ts +++ b/src/data-operations/data-util.spec.ts @@ -23,7 +23,7 @@ function testSort() { data = dataGenerator.data; })); describe("Test sorting", () => { - it('sorts descending column "number"', () => { + it("sorts descending column 'number'", () => { const se: ISortingExpression = { dir: SortingDirection.Desc, fieldName: "number" @@ -32,7 +32,7 @@ function testSort() { expect(dataGenerator.getValuesForColumn(res, "number")) .toEqual(dataGenerator.generateArray(4, 0)); }); - it('sorts ascending column "boolean"', () => { + it("sorts ascending column 'boolean'", () => { const se: ISortingExpression = { dir: SortingDirection.Asc, fieldName: "boolean" @@ -42,7 +42,7 @@ function testSort() { .toEqual([false, false, false, true, true]); }); // test multiple sorting - it('sorts descending column "boolean", sorts "date" ascending', () => { + it("sorts descending column 'boolean', sorts 'date' ascending", () => { const se0: ISortingExpression = { dir: SortingDirection.Desc, fieldName: "boolean" @@ -100,7 +100,7 @@ function testFilter() { const dataGenerator: DataGenerator = new DataGenerator(); const data: object[] = dataGenerator.data; describe("test filtering", () => { - it('filters "number" column greater than 3', () => { + it("filters 'number' column greater than 3", () => { const res = DataUtil.filter(data, { expressions: [{fieldName: "number", condition: FilteringCondition.number.greaterThan, searchVal: 3}] }); @@ -108,7 +108,7 @@ function testFilter() { .toEqual([4]); }); // test string filtering - with ignoreCase true/false - it('filters "string" column contains "row"', () => { + it("filters 'string' column contains 'row'", () => { let res = DataUtil.filter(data, { expressions: [ { diff --git a/src/date-picker/date-picker.component.spec.ts b/src/date-picker/date-picker.component.spec.ts index 67f697be3c9..758b7071c6e 100644 --- a/src/date-picker/date-picker.component.spec.ts +++ b/src/date-picker/date-picker.component.spec.ts @@ -9,11 +9,11 @@ describe("IgxDatePicker", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - IgxDatePicker, - IgxDatePickerWithWeekStart, - IgxDatePickerWithCustomFormatter, - IgxDatePickerWithPassedDate, - IgxDatePickerWIthLocale + IgxDatePickerTestComponent, + IgxDatePickerWithWeekStartComponent, + IgxDatePickerWithCustomFormatterComponent, + IgxDatePickerWithPassedDateComponent, + IgxDatePickerWIthLocaleComponent ], imports: [IgxDatePickerModule, FormsModule, BrowserAnimationsModule] }) @@ -21,7 +21,7 @@ describe("IgxDatePicker", () => { })); it("Initialize a datepicker component", () => { - const fixture = TestBed.createComponent(IgxDatePicker); + const fixture = TestBed.createComponent(IgxDatePickerTestComponent); fixture.detectChanges(); const datePicker = fixture.componentInstance.datePicker; @@ -32,7 +32,7 @@ describe("IgxDatePicker", () => { }); it("@Input properties", () => { - const fixture = TestBed.createComponent(IgxDatePickerWithPassedDate); + const fixture = TestBed.createComponent(IgxDatePickerWithPassedDateComponent); fixture.detectChanges(); const datePicker = fixture.componentInstance.datePicker; @@ -41,7 +41,7 @@ describe("IgxDatePicker", () => { }); it("Datepicker DOM input value", () => { - const fixture = TestBed.createComponent(IgxDatePickerWithPassedDate); + const fixture = TestBed.createComponent(IgxDatePickerWithPassedDateComponent); fixture.detectChanges(); const today = new Date(2017, 7, 7); @@ -54,7 +54,7 @@ describe("IgxDatePicker", () => { }); it("Datepicker week start day (Monday)", () => { - const fixture = TestBed.createComponent(IgxDatePickerWithWeekStart); + const fixture = TestBed.createComponent(IgxDatePickerWithWeekStartComponent); fixture.detectChanges(); const dom = fixture.debugElement; @@ -70,7 +70,7 @@ describe("IgxDatePicker", () => { }); it("Set formatOptions for month to be numeric", () => { - const fixture = TestBed.createComponent(IgxDatePickerWithPassedDate); + const fixture = TestBed.createComponent(IgxDatePickerWithPassedDateComponent); fixture.detectChanges(); const getMonthFromPickerDate = fixture.componentInstance.date.getMonth() + 1; @@ -87,7 +87,7 @@ describe("IgxDatePicker", () => { }); it("locale propagate calendar value (de-DE)", () => { - const fixture = TestBed.createComponent(IgxDatePickerWIthLocale); + const fixture = TestBed.createComponent(IgxDatePickerWIthLocaleComponent); fixture.detectChanges(); const datePicker = fixture.componentInstance.datePicker; @@ -97,7 +97,7 @@ describe("IgxDatePicker", () => { }); it("Datepicker open event", () => { - const fixture = TestBed.createComponent(IgxDatePicker); + const fixture = TestBed.createComponent(IgxDatePickerTestComponent); fixture.detectChanges(); const datePicker = fixture.componentInstance.datePicker; @@ -115,7 +115,7 @@ describe("IgxDatePicker", () => { }); it("Datepicker onSelection event and selectDate method propagation", () => { - const fixture = TestBed.createComponent(IgxDatePicker); + const fixture = TestBed.createComponent(IgxDatePickerTestComponent); fixture.detectChanges(); const datePicker = fixture.componentInstance.datePicker; @@ -131,7 +131,7 @@ describe("IgxDatePicker", () => { }); it("Datepicker custom formatter", () => { - const fixture = TestBed.createComponent(IgxDatePickerWithCustomFormatter); + const fixture = TestBed.createComponent(IgxDatePickerWithCustomFormatterComponent); fixture.detectChanges(); const compInstance = fixture.componentInstance; @@ -145,7 +145,7 @@ describe("IgxDatePicker", () => { }); it("Datepicker custom locale(EN) date format", () => { - const fixture = TestBed.createComponent(IgxDatePickerWithPassedDate); + const fixture = TestBed.createComponent(IgxDatePickerWithPassedDateComponent); fixture.detectChanges(); const todayToEnLocale = new Date(2017, 7, 7).toLocaleDateString("en"); @@ -161,7 +161,7 @@ describe("IgxDatePicker", () => { ` }) -export class IgxDatePickerWithCustomFormatter { +export class IgxDatePickerWithCustomFormatterComponent { @ViewChild(IgxDatePickerComponent) public datePicker: IgxDatePickerComponent; public date = new Date(2017, 7, 7); @@ -175,7 +175,7 @@ export class IgxDatePickerWithCustomFormatter { ` }) -export class IgxDatePickerWithWeekStart { +export class IgxDatePickerWithWeekStartComponent { public date: Date = new Date(2017, 6, 8); @ViewChild(IgxDatePickerComponent) public datePicker: IgxDatePickerComponent; } @@ -185,8 +185,8 @@ export class IgxDatePickerWithWeekStart { ` }) -export class IgxDatePicker { - public weekStart: number = 1; +export class IgxDatePickerTestComponent { + public weekStart = 1; @ViewChild(IgxDatePickerComponent) public datePicker: IgxDatePickerComponent; } @@ -195,7 +195,7 @@ export class IgxDatePicker { ` }) -export class IgxDatePickerWithPassedDate { +export class IgxDatePickerWithPassedDateComponent { public date: Date = new Date(2017, 7, 7); public formatOptions = { day: "numeric", @@ -211,7 +211,7 @@ export class IgxDatePickerWithPassedDate { ` }) -export class IgxDatePickerWIthLocale { +export class IgxDatePickerWIthLocaleComponent { public date: Date = new Date(2017, 7, 7); @ViewChild(IgxDatePickerComponent) public datePicker: IgxDatePickerComponent; } diff --git a/src/date-picker/date-picker.component.ts b/src/date-picker/date-picker.component.ts index 9624a00d260..03864054cd8 100644 --- a/src/date-picker/date-picker.component.ts +++ b/src/date-picker/date-picker.component.ts @@ -17,13 +17,14 @@ import { import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; import { WEEKDAYS } from "../calendar/calendar"; import { IgxCalendarComponent, IgxCalendarModule } from "../calendar/calendar.component"; -import { IgxDialog, IgxDialogModule } from "../dialog/dialog.component"; -import { IgxInput } from "../input/input.directive"; +import { IgxDialogComponent, IgxDialogModule } from "../dialog/dialog.component"; +import { IgxInputModule } from "../directives/input/input.directive"; @Component({ encapsulation: ViewEncapsulation.None, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxDatePickerComponent, multi: true }], + // tslint:disable-next-line:component-selector selector: "igx-datePicker", styleUrls: ["date-picker.component.scss"], templateUrl: "date-picker.component.html" @@ -71,7 +72,7 @@ export class IgxDatePickerComponent implements ControlValueAccessor, OnInit, OnD } @ViewChild("container", {read: ViewContainerRef}) public container: ViewContainerRef; - @ViewChild(IgxDialog) public alert: IgxDialog; + @ViewChild(IgxDialogComponent) public alert: IgxDialogComponent; public calendarRef: ComponentRef; @@ -201,6 +202,6 @@ class Constants { declarations: [IgxDatePickerComponent], entryComponents: [IgxCalendarComponent], exports: [IgxDatePickerComponent], - imports: [CommonModule, IgxInput, IgxDialogModule, IgxCalendarModule] + imports: [CommonModule, IgxInputModule, IgxDialogModule, IgxCalendarModule] }) export class IgxDatePickerModule { } diff --git a/src/dialog/README.md b/src/dialog/README.md index a395894b877..86b757068c6 100644 --- a/src/dialog/README.md +++ b/src/dialog/README.md @@ -60,11 +60,11 @@ When you are using Custom Dialogs you don't have a message property set. rightButtonBackgroundColor="green" rightButtonColor="white" closeOnOutsideSelect="true"> -
+
-
+
diff --git a/src/dialog/dialog.component.spec.ts b/src/dialog/dialog.component.spec.ts index c6de42c66ba..52d774c552b 100644 --- a/src/dialog/dialog.component.spec.ts +++ b/src/dialog/dialog.component.spec.ts @@ -3,17 +3,17 @@ import { async, ComponentFixture, TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; -import { IgxDialog, IgxDialogModule } from "./dialog.component"; +import { IgxDialogComponent, IgxDialogModule } from "./dialog.component"; describe("Dialog", () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [Alert, Dialog, CustomDialog], + declarations: [AlertComponent, DialogComponent, CustomDialogComponent], imports: [BrowserAnimationsModule, IgxDialogModule] }).compileComponents(); })); it("Should set dialog title.", () => { - const fixture = TestBed.createComponent(Alert); + const fixture = TestBed.createComponent(AlertComponent); const dialog = fixture.componentInstance.dialog; const expectedTitle = "alert"; @@ -27,7 +27,7 @@ describe("Dialog", () => { }); it("Should set dialog message.", () => { - const fixture = TestBed.createComponent(Alert); + const fixture = TestBed.createComponent(AlertComponent); const dialog = fixture.componentInstance.dialog; const expectedMessage = "message"; @@ -40,7 +40,7 @@ describe("Dialog", () => { }); it("Should set custom modal message.", () => { - const fixture = TestBed.createComponent(CustomDialog); + const fixture = TestBed.createComponent(CustomDialogComponent); const dialog = fixture.componentInstance.dialog; dialog.open(); @@ -53,7 +53,7 @@ describe("Dialog", () => { }); it("Should set left and right button properties.", () => { - const fixture = TestBed.createComponent(Dialog); + const fixture = TestBed.createComponent(DialogComponent); const dialog = fixture.componentInstance.dialog; fixture.detectChanges(); @@ -73,7 +73,7 @@ describe("Dialog", () => { }); it("Should execute open/close methods.", () => { - const fixture = TestBed.createComponent(Alert); + const fixture = TestBed.createComponent(AlertComponent); const dialog = fixture.componentInstance.dialog; fixture.detectChanges(); @@ -89,7 +89,7 @@ describe("Dialog", () => { }); it("Should set closeOnOutsideSelect.", () => { - const fixture = TestBed.createComponent(Alert); + const fixture = TestBed.createComponent(AlertComponent); const dialog = fixture.componentInstance.dialog; dialog.open(); @@ -108,7 +108,7 @@ describe("Dialog", () => { }); it("Should test events.", () => { - const fixture = TestBed.createComponent(Dialog); + const fixture = TestBed.createComponent(DialogComponent); const dialog = fixture.componentInstance.dialog; spyOn(dialog.onOpen, "emit"); @@ -139,14 +139,14 @@ describe("Dialog", () => { }); it("Should set ARIA attributes.", () => { - const alertFixture = TestBed.createComponent(Alert); + const alertFixture = TestBed.createComponent(AlertComponent); const alert = alertFixture.componentInstance.dialog; alert.open(); alertFixture.detectChanges(); expect(alert.role).toEqual("alertdialog"); - const dialogFixture = TestBed.createComponent(Dialog); + const dialogFixture = TestBed.createComponent(DialogComponent); const dialog = dialogFixture.componentInstance.dialog; dialog.open(); @@ -157,7 +157,7 @@ describe("Dialog", () => { expect(titleWrapper.attributes.id).toEqual(dialogWindow.attributes["aria-labelledby"]); }); - function testDialogIsOpen(debugElement: DebugElement, dialog: IgxDialog, isOpen: boolean) { + function testDialogIsOpen(debugElement: DebugElement, dialog: IgxDialogComponent, isOpen: boolean) { const dialogDebugElement = debugElement.query(By.css(".igx-dialog")); expect(dialog.isOpen).toEqual(isOpen); @@ -177,8 +177,8 @@ describe("Dialog", () => { leftButtonLabel="OK">
` }) -class Alert { - @ViewChild("dialog") public dialog: IgxDialog; +class AlertComponent { + @ViewChild("dialog") public dialog: IgxDialogComponent; } @Component({ template: `
@@ -196,8 +196,8 @@ class Alert { rightButtonRipple="white">
` }) -class Dialog { - @ViewChild("dialog") public dialog: IgxDialog; +class DialogComponent { + @ViewChild("dialog") public dialog: IgxDialogComponent; } @Component({ template: `
@@ -207,6 +207,6 @@ class Dialog {
` }) -class CustomDialog { - @ViewChild("dialog") public dialog: IgxDialog; +class CustomDialogComponent { + @ViewChild("dialog") public dialog: IgxDialogComponent; } diff --git a/src/dialog/dialog.component.ts b/src/dialog/dialog.component.ts index 36593906fcb..0ec693b2146 100644 --- a/src/dialog/dialog.component.ts +++ b/src/dialog/dialog.component.ts @@ -14,8 +14,8 @@ import { import { EaseOut } from "../animations/easings"; import { fadeIn, fadeOut, slideInBottom } from "../animations/main"; -import { IgxButtonModule } from "../button/button.directive"; -import { IgxRippleModule } from "../directives/ripple.directive"; +import { IgxButtonModule } from "../directives/button/button.directive"; +import { IgxRippleModule } from "../directives/ripple/ripple.directive"; @Component({ animations: [ @@ -32,26 +32,26 @@ import { IgxRippleModule } from "../directives/ripple.directive"; styleUrls: ["./dialog.component.scss"], templateUrl: "dialog-content.component.html" }) -export class IgxDialog { - private static NEXT_ID: number = 1; +export class IgxDialogComponent { + private static NEXT_ID = 1; private static readonly DIALOG_CLASS = "igx-dialog"; - @Input() public title: string = ""; - @Input() public message: string = ""; + @Input() public title = ""; + @Input() public message = ""; - @Input() public leftButtonLabel: string = ""; - @Input() public leftButtonType: string = "flat"; - @Input() public leftButtonColor: string = ""; - @Input() public leftButtonBackgroundColor: string = ""; - @Input() public leftButtonRipple: string = ""; + @Input() public leftButtonLabel = ""; + @Input() public leftButtonType = "flat"; + @Input() public leftButtonColor = ""; + @Input() public leftButtonBackgroundColor = ""; + @Input() public leftButtonRipple = ""; - @Input() public rightButtonLabel: string = ""; - @Input() public rightButtonType: string = "flat"; - @Input() public rightButtonColor: string = ""; - @Input() public rightButtonBackgroundColor: string = ""; - @Input() public rightButtonRipple: string = ""; + @Input() public rightButtonLabel = ""; + @Input() public rightButtonType = "flat"; + @Input() public rightButtonColor = ""; + @Input() public rightButtonBackgroundColor = ""; + @Input() public rightButtonRipple = ""; - @Input() public closeOnOutsideSelect: boolean = false; + @Input() public closeOnOutsideSelect = false; @Output() public onOpen = new EventEmitter(); @Output() public onClose = new EventEmitter(); @@ -94,7 +94,7 @@ export class IgxDialog { } constructor() { - this._titleId = IgxDialog.NEXT_ID++ + "_title"; + this._titleId = IgxDialogComponent.NEXT_ID++ + "_title"; } public open() { @@ -119,7 +119,7 @@ export class IgxDialog { if ( this.isOpen && this.closeOnOutsideSelect && - event.target.classList.contains(IgxDialog.DIALOG_CLASS) + event.target.classList.contains(IgxDialogComponent.DIALOG_CLASS) ) { this.close(); } @@ -140,8 +140,8 @@ export class IgxDialog { } @NgModule({ - declarations: [IgxDialog], - exports: [IgxDialog], + declarations: [IgxDialogComponent], + exports: [IgxDialogComponent], imports: [CommonModule, IgxButtonModule, IgxRippleModule] }) export class IgxDialogModule { } diff --git a/src/button/README.md b/src/directives/button/README.md similarity index 100% rename from src/button/README.md rename to src/directives/button/README.md diff --git a/src/button/button.directive.spec.ts b/src/directives/button/button.directive.spec.ts similarity index 86% rename from src/button/button.directive.spec.ts rename to src/directives/button/button.directive.spec.ts index 18d97e762db..f34bb5ca3ac 100644 --- a/src/button/button.directive.spec.ts +++ b/src/directives/button/button.directive.spec.ts @@ -4,22 +4,22 @@ import { TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxButton } from "./button.directive"; +import { IgxButtonDirective } from "./button.directive"; describe("IgxButton", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitButton, - ButtonWithAttribs, - IgxButton + InitButtonComponent, + ButtonWithAttribsComponent, + IgxButtonDirective ] }) .compileComponents(); })); it("Initializes a button", () => { - const fixture = TestBed.createComponent(InitButton); + const fixture = TestBed.createComponent(InitButtonComponent); fixture.detectChanges(); expect(fixture.debugElement.query(By.css("span.igx-button--flat"))).toBeTruthy(); @@ -27,7 +27,7 @@ describe("IgxButton", () => { }); it("Button with properties", () => { - const fixture = TestBed.createComponent(ButtonWithAttribs); + const fixture = TestBed.createComponent(ButtonWithAttribsComponent); fixture.detectChanges(); const button = fixture.debugElement.query(By.css("span")).nativeElement; @@ -58,7 +58,7 @@ describe("IgxButton", () => { add ` }) -class InitButton { +class InitButtonComponent { } @Component({ @@ -68,7 +68,7 @@ class InitButton { [igxButtonBackground]="background" [disabled]="isDisabled">Test` }) -class ButtonWithAttribs { +class ButtonWithAttribsComponent { public isDisabled = true; public foreground = "white"; public background = "black"; diff --git a/src/button/button.directive.ts b/src/directives/button/button.directive.ts similarity index 80% rename from src/button/button.directive.ts rename to src/directives/button/button.directive.ts index 519a9142b48..796b6891d81 100644 --- a/src/button/button.directive.ts +++ b/src/directives/button/button.directive.ts @@ -1,20 +1,19 @@ -import { Directive, ElementRef, Input, NgModule, OnInit, Renderer2 } from "@angular/core"; +import { Directive, ElementRef, HostBinding, Input, NgModule, OnInit, Renderer2 } from "@angular/core"; @Directive({ - host: { - role: "button" - }, selector: "[igxButton]" }) -export class IgxButton { - private _type: string = "flat"; - private _cssClass: string = "igx-button"; +export class IgxButtonDirective { + private _type = "flat"; + private _cssClass = "igx-button"; private _color: string; private _label: string; private _backgroundColor: string; constructor(private _el: ElementRef, private _renderer: Renderer2) {} + @HostBinding("attr.role") public role = "button"; + @Input("igxButton") set type(value: string) { this._type = value || this._type; this._renderer.addClass(this._el.nativeElement, `${this._cssClass}--${this._type}`); @@ -46,7 +45,7 @@ export class IgxButton { } @NgModule({ - declarations: [IgxButton], - exports: [IgxButton] + declarations: [IgxButtonDirective], + exports: [IgxButtonDirective] }) export class IgxButtonModule {} diff --git a/src/directives/dragdrop.directive.ts b/src/directives/dragdrop/dragdrop.directive.ts similarity index 96% rename from src/directives/dragdrop.directive.ts rename to src/directives/dragdrop/dragdrop.directive.ts index 9ca53a8c98c..266f6b94582 100644 --- a/src/directives/dragdrop.directive.ts +++ b/src/directives/dragdrop/dragdrop.directive.ts @@ -25,7 +25,7 @@ export class IgxDraggableDirective implements OnInit, OnDestroy { @Input("igxDraggable") public data: any; @Input() public dragClass: string; - @Input() public effectAllowed: string = "move"; + @Input() public effectAllowed = "move"; @HostBinding("draggable") public draggable: boolean; @@ -64,7 +64,7 @@ export class IgxDroppableDirective { @Input("igxDroppable") public data: any; @Input() public dropClass: string; - @Input() public dropEffect: string = "move"; + @Input() public dropEffect = "move"; @Output() public onDrop = new EventEmitter(); diff --git a/src/directives/README-FILTER.md b/src/directives/filter/README-FILTER.md similarity index 100% rename from src/directives/README-FILTER.md rename to src/directives/filter/README-FILTER.md diff --git a/src/directives/filter.directive.spec.ts b/src/directives/filter/filter.directive.spec.ts similarity index 90% rename from src/directives/filter.directive.spec.ts rename to src/directives/filter/filter.directive.spec.ts index c1b00ee2cae..aa598867601 100644 --- a/src/directives/filter.directive.spec.ts +++ b/src/directives/filter/filter.directive.spec.ts @@ -1,7 +1,7 @@ import { Component, ContentChildren, ViewChild } from "@angular/core"; import { async, ComponentFixtureAutoDetect, TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxList, IgxListItem, IgxListModule } from "../list/list.component"; +import { IgxListComponent, IgxListItemComponent, IgxListModule } from "../../list/list.component"; import { IgxFilterDirective, IgxFilterModule, IgxFilterOptions, IgxFilterPipe } from "./filter.directive"; describe("Filter", () => { @@ -27,7 +27,7 @@ describe("Filter", () => { items = list.items; for (const item of items) { - expect(item instanceof IgxListItem).toBeTruthy(); + expect(item instanceof IgxListItemComponent).toBeTruthy(); } visibleItems = items.filter((listItem) => !listItem.hidden); @@ -38,7 +38,7 @@ describe("Filter", () => { visibleItems = items.filter((listItem) => !listItem.hidden); expect(visibleItems.length).toBe(1); - expect(visibleItems[0] instanceof IgxListItem).toBeTruthy(); + expect(visibleItems[0] instanceof IgxListItemComponent).toBeTruthy(); fixture.componentInstance.filterValue = ""; fixture.detectChanges(); @@ -55,7 +55,7 @@ describe("Filter", () => { expect(list.items.length).toBe(4); for (const item of list.items) { - expect(item instanceof IgxListItem).toBeTruthy(); + expect(item instanceof IgxListItemComponent).toBeTruthy(); } expect(list.items.length).toBe(4); @@ -64,7 +64,7 @@ describe("Filter", () => { fixture.detectChanges(); expect(list.items.length).toBe(1); - expect(list.items[0] instanceof IgxListItem).toBeTruthy(); + expect(list.items[0] instanceof IgxListItemComponent).toBeTruthy(); fixture.componentInstance.filterValue = ""; fixture.detectChanges(); @@ -79,7 +79,7 @@ describe("Filter", () => { const logInput = fixture.componentInstance.logInput; fixture.detectChanges(); - visibleItems = list.items.filter((listItem) => !(listItem as IgxListItem).hidden); + visibleItems = list.items.filter((listItem) => !(listItem as IgxListItemComponent).hidden); expect(list.items.length).toBe(3); expect(visibleItems.length).toBe(3); @@ -89,7 +89,7 @@ describe("Filter", () => { fixture.componentInstance.filterValue = "2"; fixture.detectChanges(); - visibleItems = list.items.filter((listItem) => !(listItem as IgxListItem).hidden); + visibleItems = list.items.filter((listItem) => !(listItem as IgxListItemComponent).hidden); expect(visibleItems.length).toBe(1); expect(logInput.nativeElement.value).toBe("filtering;filtered;"); @@ -114,7 +114,7 @@ describe("Filter", () => { const logInput = fixture.componentInstance.logInput; fixture.detectChanges(); - visibleItems = list.items.filter((listItem) => !(listItem as IgxListItem).hidden); + visibleItems = list.items.filter((listItem) => !(listItem as IgxListItemComponent).hidden); expect(list.items.length).toBe(3); expect(visibleItems.length).toBe(3); @@ -125,7 +125,7 @@ describe("Filter", () => { fixture.componentInstance.filterValue = "2"; fixture.detectChanges(); - visibleItems = list.items.filter((listItem) => !(listItem as IgxListItem).hidden); + visibleItems = list.items.filter((listItem) => !(listItem as IgxListItemComponent).hidden); expect(visibleItems.length).toBe(3); expect(logInput.nativeElement.value).toBe("filtering;"); @@ -151,11 +151,11 @@ describe("Filter", () => { }) class DeclarativeListTestComponent { public filterValue: string; - public isCanceled: boolean = false; + public isCanceled = false; public filteringArgs: FilteringArgs; public filteredArgs: FilteringArgs; - @ViewChild(IgxList) public list: IgxList; + @ViewChild(IgxListComponent) public list: IgxListComponent; @ViewChild("logInput") public logInput: any; get fo() { @@ -187,9 +187,9 @@ class DeclarativeListTestComponent { }) class DynamicListTestComponent { public filterValue: string; - public isCanceled: boolean = false; + public isCanceled = false; - @ViewChild(IgxList) public list: IgxList; + @ViewChild(IgxListComponent) public list: IgxListComponent; protected dataSourceItems: object[] = [ { key: "1", text: "Nav1" }, @@ -208,6 +208,6 @@ class DynamicListTestComponent { class FilteringArgs { public cancel: boolean; - public items: IgxListItem[]; - public filteredItems: IgxListItem[]; + public items: IgxListItemComponent[]; + public filteredItems: IgxListItemComponent[]; } diff --git a/src/directives/filter.directive.ts b/src/directives/filter/filter.directive.ts similarity index 98% rename from src/directives/filter.directive.ts rename to src/directives/filter/filter.directive.ts index 02fa3ca581e..01ae6c62689 100644 --- a/src/directives/filter.directive.ts +++ b/src/directives/filter/filter.directive.ts @@ -95,7 +95,7 @@ export class IgxFilterPipe implements PipeTransform { export class IgxFilterOptions { // Input text value that will be used as a filtering pattern (matching condition is based on it) - public inputValue: string = ""; + public inputValue = ""; // Item property, which value should be used for filtering public key: string; @@ -109,7 +109,7 @@ export class IgxFilterOptions { // Default behavior - returns "key"- named property value of item if key si provided, // otherwise textContent of the item's html element public get_value(item: any, key: string): string { - let result: string = ""; + let result = ""; if (key) { result = item[key].toString(); diff --git a/src/input/README.md b/src/directives/input/README.md similarity index 100% rename from src/input/README.md rename to src/directives/input/README.md diff --git a/src/input/input.directive.spec.ts b/src/directives/input/input.directive.spec.ts similarity index 88% rename from src/input/input.directive.spec.ts rename to src/directives/input/input.directive.spec.ts index 07d89dd039d..7e2049cf59d 100644 --- a/src/input/input.directive.spec.ts +++ b/src/directives/input/input.directive.spec.ts @@ -5,17 +5,17 @@ import { } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; import { IgxLabelModule } from "../label/label.directive"; -import { IgxInput } from "./input.directive"; +import { IgxInputModule } from "./input.directive"; describe("IgxInput", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitInput, - InputWithAttribs + InitInputComponent, + InputWithAttribsComponent ], imports: [ - IgxInput, + IgxInputModule, IgxLabelModule ] }) @@ -23,14 +23,14 @@ describe("IgxInput", () => { })); it("Initializes an empty input", () => { - const fixture = TestBed.createComponent(InitInput); + const fixture = TestBed.createComponent(InitInputComponent); fixture.detectChanges(); expect(fixture.debugElement.query(By.css("input"))).toBeTruthy(); }); it("Initializes an empty input with attributes", () => { - const fixture = TestBed.createComponent(InputWithAttribs); + const fixture = TestBed.createComponent(InputWithAttribsComponent); fixture.detectChanges(); const inputEl = fixture.debugElement.query(By.css("input")).nativeElement; @@ -62,7 +62,7 @@ describe("IgxInput", () => { }); @Component({ template: `` }) -class InitInput { +class InitInputComponent { } @Component({ @@ -73,6 +73,6 @@ class InitInput {
` }) -class InputWithAttribs { +class InputWithAttribsComponent { public placeholder = "Please enter a name"; } diff --git a/src/input/input.directive.ts b/src/directives/input/input.directive.ts similarity index 76% rename from src/input/input.directive.ts rename to src/directives/input/input.directive.ts index d797345b27c..b275199716c 100644 --- a/src/input/input.directive.ts +++ b/src/directives/input/input.directive.ts @@ -11,18 +11,18 @@ import { @Directive({ selector: "[igxInput]" }) -export class IgxInputClass implements DoCheck { +export class IgxInputDirective implements DoCheck { @HostBinding("class.igx-form-group__input") - public isInput: boolean = true; + public isInput = true; @HostBinding("class.igx-form-group__input--focused") - public focused: boolean = false; + public focused = false; @HostBinding("class.igx-form-group__input--filled") - public filled: boolean = false; + public filled = false; @HostBinding("class.igx-form-group__input--placeholder") - public placeholder: boolean = false; + public placeholder = false; constructor(protected el: ElementRef) {} @@ -45,8 +45,8 @@ export class IgxInputClass implements DoCheck { } @NgModule({ - declarations: [IgxInputClass], - exports: [IgxInputClass], + declarations: [IgxInputDirective], + exports: [IgxInputDirective], imports: [CommonModule] }) -export class IgxInput {} +export class IgxInputModule {} diff --git a/src/label/README.md b/src/directives/label/README.md similarity index 100% rename from src/label/README.md rename to src/directives/label/README.md diff --git a/src/label/label.directive.ts b/src/directives/label/label.directive.ts similarity index 75% rename from src/label/label.directive.ts rename to src/directives/label/label.directive.ts index 66035ed49cb..979b1ae69b1 100644 --- a/src/label/label.directive.ts +++ b/src/directives/label/label.directive.ts @@ -9,14 +9,14 @@ import { @Directive({ selector: "[igxLabel]" }) -export class IgxLabel { +export class IgxLabelDirective { constructor(el: ElementRef, renderer: Renderer2) { renderer.addClass(el.nativeElement, "igx-form-group__label"); } } @NgModule({ - declarations: [IgxLabel], - exports: [IgxLabel] + declarations: [IgxLabelDirective], + exports: [IgxLabelDirective] }) export class IgxLabelModule {} diff --git a/src/layout/README.md b/src/directives/layout/README.md similarity index 100% rename from src/layout/README.md rename to src/directives/layout/README.md diff --git a/src/layout/layout.directive.ts b/src/directives/layout/layout.directive.ts similarity index 64% rename from src/layout/layout.directive.ts rename to src/directives/layout/layout.directive.ts index 8e06074107d..9923b3d75de 100644 --- a/src/layout/layout.directive.ts +++ b/src/directives/layout/layout.directive.ts @@ -4,11 +4,11 @@ import { Directive, HostBinding, Input, NgModule } from "@angular/core"; selector: "[igxLayout]" }) export class IgxLayoutDirective { - @Input("igxLayoutDir") public dir: string = "row"; - @Input("igxLayoutReverse") public reverse: boolean = false; - @Input("igxLayoutWrap") public wrap: string = "nowrap"; - @Input("igxLayoutJustify") public justify: string = "flex-start"; - @Input("igxLayoutItemAlign") public itemAlign: string = "flex-start"; + @Input("igxLayoutDir") public dir = "row"; + @Input("igxLayoutReverse") public reverse = false; + @Input("igxLayoutWrap") public wrap = "nowrap"; + @Input("igxLayoutJustify") public justify = "flex-start"; + @Input("igxLayoutItemAlign") public itemAlign = "flex-start"; @HostBinding("style.display") public display = "flex"; @HostBinding("style.flex-wrap") get flexwrap() { return this.wrap; } @@ -28,10 +28,10 @@ export class IgxLayoutDirective { selector: "[igxFlex]" }) export class IgxFlexDirective { - @Input("igxFlexGrow") public grow: number = 1; - @Input("igxFlexShrink") public shrink: number = 1; - @Input("igxFlex") public flex: string = ""; - @Input("igxFlexOrder") public order: number = 0; + @Input("igxFlexGrow") public grow = 1; + @Input("igxFlexShrink") public shrink = 1; + @Input("igxFlex") public flex = ""; + @Input("igxFlexOrder") public order = 0; @HostBinding("style.flex") get style() { @@ -48,7 +48,7 @@ export class IgxFlexDirective { } @NgModule({ - declarations: [IgxLayoutDirective, IgxFlexDirective], + declarations: [IgxFlexDirective, IgxLayoutDirective], exports: [IgxFlexDirective, IgxLayoutDirective] }) -export class IgxLayout { } +export class IgxLayoutModule { } diff --git a/src/directives/README-RIPPLE.md b/src/directives/ripple/README-RIPPLE.md similarity index 100% rename from src/directives/README-RIPPLE.md rename to src/directives/ripple/README-RIPPLE.md diff --git a/src/directives/ripple.directive.ts b/src/directives/ripple/ripple.directive.ts similarity index 94% rename from src/directives/ripple.directive.ts rename to src/directives/ripple/ripple.directive.ts index 9f4f7da8eea..e3a3117ab87 100644 --- a/src/directives/ripple.directive.ts +++ b/src/directives/ripple/ripple.directive.ts @@ -4,13 +4,13 @@ import { Directive, ElementRef, HostListener, Input, NgModule, NgZone, Renderer2 selector: "[igxRipple]" }) export class IgxRippleDirective { - @Input("igxRippleTarget") public rippleTarget: string = ""; + @Input("igxRippleTarget") public rippleTarget = ""; @Input("igxRipple") public rippleColor: string; - @Input("igxRippleDuration") public rippleDuration: number = 600; + @Input("igxRippleDuration") public rippleDuration = 600; protected container: HTMLElement; - private _centered: boolean = false; + private _centered = false; private animationQueue = []; @Input("igxRippleCentered") set centered(value: boolean) { diff --git a/src/grid/cell.spec.ts b/src/grid/cell.spec.ts index b43aeafc59e..ed27e86fe69 100644 --- a/src/grid/cell.spec.ts +++ b/src/grid/cell.spec.ts @@ -14,15 +14,15 @@ describe("IgxGrid - Cell component", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - DefaultGrid, - CtrlKeyKeyboardNagivation + DefaultGridComponent, + CtrlKeyKeyboardNagivationComponent ], imports: [IgxGridModule.forRoot()] }).compileComponents(); })); it("@Input properties and getters", () => { - const fix = TestBed.createComponent(DefaultGrid); + const fix = TestBed.createComponent(DefaultGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -38,7 +38,7 @@ describe("IgxGrid - Cell component", () => { }); it("selection and selection events", () => { - const fix = TestBed.createComponent(DefaultGrid); + const fix = TestBed.createComponent(DefaultGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -57,7 +57,7 @@ describe("IgxGrid - Cell component", () => { }); it("edit mode", fakeAsync(() => { - const fix = TestBed.createComponent(DefaultGrid); + const fix = TestBed.createComponent(DefaultGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -99,7 +99,7 @@ describe("IgxGrid - Cell component", () => { })); it("edit mode - leaves edit mode on blur", fakeAsync(() => { - const fix = TestBed.createComponent(DefaultGrid); + const fix = TestBed.createComponent(DefaultGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -125,7 +125,7 @@ describe("IgxGrid - Cell component", () => { })); it("keyboard navigation", fakeAsync(() => { - const fix = TestBed.createComponent(DefaultGrid); + const fix = TestBed.createComponent(DefaultGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -173,7 +173,7 @@ describe("IgxGrid - Cell component", () => { })); it("keyboard navigation - first/last cell jump with Ctrl", fakeAsync(() => { - const fix = TestBed.createComponent(CtrlKeyKeyboardNagivation); + const fix = TestBed.createComponent(CtrlKeyKeyboardNagivationComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -206,7 +206,7 @@ describe("IgxGrid - Cell component", () => { ` }) -export class DefaultGrid { +export class DefaultGridComponent { public data = [ { index: 1, value: 1}, @@ -228,7 +228,7 @@ export class DefaultGrid { ` }) -export class CtrlKeyKeyboardNagivation { +export class CtrlKeyKeyboardNagivationComponent { public data = [ { index: 1, value: 1, other: 1, another: 1}, diff --git a/src/grid/column.spec.ts b/src/grid/column.spec.ts index d889a37c525..7c3344d0d26 100644 --- a/src/grid/column.spec.ts +++ b/src/grid/column.spec.ts @@ -13,9 +13,9 @@ describe("IgxGrid - Column properties", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - TemplatedColumns, - ColumnHiddenFromMarkup, - ColumnCellFormatter + TemplatedColumnsComponent, + ColumnHiddenFromMarkupComponent, + ColumnCellFormatterComponent ], imports: [IgxGridModule.forRoot()] }) @@ -23,7 +23,7 @@ describe("IgxGrid - Column properties", () => { })); it("should correctly initialize column templates", () => { - const fix = TestBed.createComponent(TemplatedColumns); + const fix = TestBed.createComponent(TemplatedColumnsComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -42,7 +42,7 @@ describe("IgxGrid - Column properties", () => { }); it("should provide a way to change templates dynamically", () => { - const fix = TestBed.createComponent(TemplatedColumns); + const fix = TestBed.createComponent(TemplatedColumnsComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -62,7 +62,7 @@ describe("IgxGrid - Column properties", () => { }); it("should reflect column hiding correctly in the DOM dynamically", () => { - const fix = TestBed.createComponent(TemplatedColumns); + const fix = TestBed.createComponent(TemplatedColumnsComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -83,7 +83,7 @@ describe("IgxGrid - Column properties", () => { }); it("should reflect column hiding correctly in the DOM from markup declaration", () => { - const fix = TestBed.createComponent(ColumnHiddenFromMarkup); + const fix = TestBed.createComponent(ColumnHiddenFromMarkupComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -99,7 +99,7 @@ describe("IgxGrid - Column properties", () => { }); it("should support providing a custom formatter for cell values", () => { - const fix = TestBed.createComponent(ColumnCellFormatter); + const fix = TestBed.createComponent(ColumnCellFormatterComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -114,7 +114,7 @@ describe("IgxGrid - Column properties", () => { }); it("should reflect the column in the DOM based on its index", () => { - const fix = TestBed.createComponent(ColumnCellFormatter); + const fix = TestBed.createComponent(ColumnCellFormatterComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -184,7 +184,7 @@ describe("IgxGrid - Column properties", () => { ` }) -export class TemplatedColumns { +export class TemplatedColumnsComponent { public data = [ { ID: 1, Name: "Johny" }, @@ -209,7 +209,7 @@ export class TemplatedColumns { ` }) -export class ColumnHiddenFromMarkup { +export class ColumnHiddenFromMarkupComponent { public data = [ { ID: 1, Name: "Johny" }, @@ -229,7 +229,7 @@ export class ColumnHiddenFromMarkup { ` }) -export class ColumnCellFormatter { +export class ColumnCellFormatterComponent { public data = [ { ID: 1, Name: "Johny" }, diff --git a/src/grid/grid-filtering.spec.ts b/src/grid/grid-filtering.spec.ts index b240f0523a6..167ed6b1fef 100644 --- a/src/grid/grid-filtering.spec.ts +++ b/src/grid/grid-filtering.spec.ts @@ -13,7 +13,7 @@ describe("IgxGrid - Filtering actions", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - IgxGridFiltering + IgxGridFilteringComponent ], imports: [IgxGridModule.forRoot()] }) @@ -21,7 +21,7 @@ describe("IgxGrid - Filtering actions", () => { })); it("should correctly filter by 'string' filtering conditions", () => { - const fix = TestBed.createComponent(IgxGridFiltering); + const fix = TestBed.createComponent(IgxGridFilteringComponent); fix.detectChanges(); const grid = fix.componentInstance.grid; @@ -109,7 +109,7 @@ describe("IgxGrid - Filtering actions", () => { }); it("should correctly filter by 'number' filtering conditions", () => { - const fix = TestBed.createComponent(IgxGridFiltering); + const fix = TestBed.createComponent(IgxGridFilteringComponent); fix.detectChanges(); const grid = fix.componentInstance.grid; @@ -185,7 +185,7 @@ describe("IgxGrid - Filtering actions", () => { }); it("should correctly filter by 'boolean' filtering conditions", () => { - const fix = TestBed.createComponent(IgxGridFiltering); + const fix = TestBed.createComponent(IgxGridFilteringComponent); fix.detectChanges(); const grid = fix.componentInstance.grid; @@ -233,7 +233,7 @@ describe("IgxGrid - Filtering actions", () => { }); it("should correctly filter by 'date' filtering conditions", () => { - const fix = TestBed.createComponent(IgxGridFiltering); + const fix = TestBed.createComponent(IgxGridFilteringComponent); fix.detectChanges(); const grid = fix.componentInstance.grid; @@ -362,7 +362,7 @@ describe("IgxGrid - Filtering actions", () => { // }); it("should correctly apply multiple filtering through API", () => { - const fix = TestBed.createComponent(IgxGridFiltering); + const fix = TestBed.createComponent(IgxGridFilteringComponent); fix.detectChanges(); const grid = fix.componentInstance.grid; @@ -385,7 +385,7 @@ describe("IgxGrid - Filtering actions", () => { }); it("should correctly apply global filtering", () => { - const fix = TestBed.createComponent(IgxGridFiltering); + const fix = TestBed.createComponent(IgxGridFilteringComponent); fix.detectChanges(); const grid = fix.componentInstance.grid; @@ -410,7 +410,7 @@ describe("IgxGrid - Filtering actions", () => { ` }) -export class IgxGridFiltering { +export class IgxGridFilteringComponent { public timeGenerator: Calendar = new Calendar(); public today: Date = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0, 0, 0); diff --git a/src/grid/grid.crud.spec.ts b/src/grid/grid.crud.spec.ts index a49c0706b64..399821d73ba 100644 --- a/src/grid/grid.crud.spec.ts +++ b/src/grid/grid.crud.spec.ts @@ -9,14 +9,14 @@ describe("IgxGrid - CRUD operations", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - DefaultCRUDGrid + DefaultCRUDGridComponent ], imports: [IgxGridModule.forRoot()] }).compileComponents(); })); it("should support adding rows through the grid API", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -36,7 +36,7 @@ describe("IgxGrid - CRUD operations", () => { }); it("should support adding rows by manipulating the `data` @Input of the grid", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -67,7 +67,7 @@ describe("IgxGrid - CRUD operations", () => { }); it("should support deleting rows through the grid API", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -107,7 +107,7 @@ describe("IgxGrid - CRUD operations", () => { }); it("should support removing rows by manipulating the `data` @Input of the grid", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -142,7 +142,7 @@ describe("IgxGrid - CRUD operations", () => { }); it("should support updating a row through the grid API", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -164,7 +164,7 @@ describe("IgxGrid - CRUD operations", () => { }); it("should support updating a cell value through the grid API", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -185,7 +185,7 @@ describe("IgxGrid - CRUD operations", () => { }); it("should support updating a cell value through the cell object", () => { - const fix = TestBed.createComponent(DefaultCRUDGrid); + const fix = TestBed.createComponent(DefaultCRUDGridComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -210,7 +210,7 @@ describe("IgxGrid - CRUD operations", () => { ` }) -export class DefaultCRUDGrid { +export class DefaultCRUDGridComponent { public data = [ { index: 1, value: 1} diff --git a/src/grid/grid.initialization.spec.ts b/src/grid/grid.initialization.spec.ts index 70850d34fd4..1fc6d70ced6 100644 --- a/src/grid/grid.initialization.spec.ts +++ b/src/grid/grid.initialization.spec.ts @@ -10,8 +10,8 @@ describe("IgxGrid - Grid initialization", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - GridMarkupDeclaration, - GridAutogeneratedColumns + GridMarkupDeclarationComponent, + GridAutogeneratedColumnsComponent ], imports: [IgxGridModule.forRoot()] }) @@ -19,7 +19,7 @@ describe("IgxGrid - Grid initialization", () => { })); it("should initialize a grid with columns from markup", () => { - const fix = TestBed.createComponent(GridMarkupDeclaration); + const fix = TestBed.createComponent(GridMarkupDeclarationComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -30,7 +30,7 @@ describe("IgxGrid - Grid initialization", () => { }); it("should initialize a grid with autogenerated columns", () => { - const fix = TestBed.createComponent(GridAutogeneratedColumns); + const fix = TestBed.createComponent(GridAutogeneratedColumnsComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -47,14 +47,14 @@ describe("IgxGrid - Grid initialization", () => { }); it("should initialize a grid and emit event on column creation", () => { - const fix = TestBed.createComponent(GridAutogeneratedColumns); + const fix = TestBed.createComponent(GridAutogeneratedColumnsComponent); fix.detectChanges(); expect(fix.componentInstance.columnEventCount).toEqual(4); }); it("should initialize a grid and change column properties during initialization", () => { - const fix = TestBed.createComponent(GridAutogeneratedColumns); + const fix = TestBed.createComponent(GridAutogeneratedColumnsComponent); fix.detectChanges(); const grid = fix.componentInstance.instance; @@ -74,7 +74,7 @@ describe("IgxGrid - Grid initialization", () => { ` }) -export class GridMarkupDeclaration { +export class GridMarkupDeclarationComponent { public data = [ { ID: 1, Name: "Johny" }, @@ -91,7 +91,7 @@ export class GridMarkupDeclaration { ` }) -export class GridAutogeneratedColumns { +export class GridAutogeneratedColumnsComponent { public data = [ { Number: 1, String: "1", Boolean: true, Date: new Date(Date.now()) }, diff --git a/src/grid/grid.pagination.spec.ts b/src/grid/grid.pagination.spec.ts index 649ab2fc8fb..4684b736f49 100644 --- a/src/grid/grid.pagination.spec.ts +++ b/src/grid/grid.pagination.spec.ts @@ -12,9 +12,9 @@ describe("IgxGrid - Grid Paging", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - GridMarkupPagingDeclaration, - GridDeclaration, - IgxGridMarkupEditingDeclaration + GridMarkupPagingDeclarationComponent, + GridDeclarationComponent, + IgxGridMarkupEditingDeclarationComponent ], imports: [IgxGridModule.forRoot()] }) @@ -22,7 +22,7 @@ describe("IgxGrid - Grid Paging", () => { })); it("should paginate data UI", fakeAsync(() => { - const fix = TestBed.createComponent(GridMarkupPagingDeclaration); + const fix = TestBed.createComponent(GridMarkupPagingDeclarationComponent); fix.detectChanges(); const grid = fix.componentInstance.grid1; const gridElement: HTMLElement = fix.nativeElement.querySelector(".igx-grid"); @@ -108,7 +108,7 @@ describe("IgxGrid - Grid Paging", () => { })); it("should paginate data API", fakeAsync(() => { - const fix = TestBed.createComponent(GridDeclaration); + const fix = TestBed.createComponent(GridDeclarationComponent); fix.detectChanges(); const grid = fix.componentInstance.grid1; const gridElement: HTMLElement = fix.nativeElement.querySelector(".igx-grid"); @@ -129,7 +129,7 @@ describe("IgxGrid - Grid Paging", () => { })); it("change paging settings UI", fakeAsync(() => { - const fix = TestBed.createComponent(GridMarkupPagingDeclaration); + const fix = TestBed.createComponent(GridMarkupPagingDeclarationComponent); fix.detectChanges(); const grid = fix.componentInstance.grid1; const gridElement: HTMLElement = fix.nativeElement.querySelector(".igx-grid"); @@ -160,7 +160,7 @@ describe("IgxGrid - Grid Paging", () => { })); it("change paging settings API", fakeAsync(() => { - const fix = TestBed.createComponent(GridDeclaration); + const fix = TestBed.createComponent(GridDeclarationComponent); fix.detectChanges(); const grid = fix.componentInstance.grid1; const gridElement: HTMLElement = fix.nativeElement.querySelector(".igx-grid"); @@ -206,7 +206,7 @@ describe("IgxGrid - Grid Paging", () => { ` }) -export class GridMarkupPagingDeclaration { +export class GridMarkupPagingDeclarationComponent { public data = new CustomStrategyData().data; @ViewChild("grid1", { read: IgxGridComponent }) @@ -222,7 +222,7 @@ export class GridMarkupPagingDeclaration { ` }) -export class GridDeclaration { +export class GridDeclarationComponent { public data = new CustomStrategyData().data; @@ -239,7 +239,7 @@ export class GridDeclaration { ` }) -export class IgxGridMarkupEditingDeclaration { +export class IgxGridMarkupEditingDeclarationComponent { public data = new CustomStrategyData().data; diff --git a/src/grid/grid.sorting.spec.ts b/src/grid/grid.sorting.spec.ts index 261e5d3e70a..b47fcab08c0 100644 --- a/src/grid/grid.sorting.spec.ts +++ b/src/grid/grid.sorting.spec.ts @@ -11,7 +11,7 @@ describe("IgxGrid - Grid Sorting", () => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [ - GridDeclaredColumns + GridDeclaredColumnsComponent ], imports: [IgxGridModule.forRoot()] }) @@ -19,7 +19,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort ascending by column name (default)", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -41,7 +41,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort descending by column name", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -69,7 +69,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Try sort by invalid column should not change anything", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -87,7 +87,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort current column by expression (Ascending)", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -100,7 +100,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort current column by expression (Descending with ignoreCase)", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -115,7 +115,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort by multiple expressions and clear sorting through API", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -157,7 +157,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort by multiple expressions through API using ignoreCase for the second expression", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -204,7 +204,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort by invalid expressions fieldName shouldn't change anything", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -234,7 +234,7 @@ describe("IgxGrid - Grid Sorting", () => { it(`Grid sort by mixed valid and invalid expressions should update the data only by valid ones (through API)`, () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -263,7 +263,7 @@ describe("IgxGrid - Grid Sorting", () => { // UI Tests it("Grid sort ascending by clicking once on first header cell UI", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -288,7 +288,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort descending by clicking twice on header cell UI", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -315,7 +315,7 @@ describe("IgxGrid - Grid Sorting", () => { }); it("Grid sort none when we click three time on header cell UI", () => { - const fixture = TestBed.createComponent(GridDeclaredColumns); + const fixture = TestBed.createComponent(GridDeclaredColumnsComponent); fixture.detectChanges(); const grid = fixture.componentInstance.grid; @@ -351,7 +351,7 @@ describe("IgxGrid - Grid Sorting", () => { ` }) -export class GridDeclaredColumns { +export class GridDeclaredColumnsComponent { public data = [ { ID: 2, Name: "Jane", LastName: "Brown" }, diff --git a/src/grid/index.ts b/src/grid/index.ts index 8f04fc62d86..637dca9e34f 100644 --- a/src/grid/index.ts +++ b/src/grid/index.ts @@ -1,12 +1,12 @@ import { CommonModule } from "@angular/common"; import { NgModule } from "@angular/core"; import { FormsModule } from "@angular/forms"; -import { IgxButtonModule } from "../button/button.directive"; import { IgxDatePickerModule } from "../date-picker/date-picker.component"; -import { IgxRippleModule } from "../directives/ripple.directive"; import { IgxVirtForModule } from "../directives/virtual-for/igx_virtual_for.directive"; +import { IgxButtonModule } from "../directives/button/button.directive"; +import { IgxInputModule } from "../directives/input/input.directive"; +import { IgxRippleModule } from "../directives/ripple/ripple.directive"; import { IgxIconModule } from "../icon/icon.component"; -import { IgxInput } from "../input/input.directive"; import { IgxGridAPIService } from "./api.service"; import { IgxGridCellComponent } from "./cell.component"; import { IgxColumnComponent } from "./column.component"; @@ -58,7 +58,7 @@ import { IgxGridRowComponent } from "./row.component"; IgxDatePickerModule, IgxIconModule, IgxRippleModule, - IgxInput, + IgxInputModule, IgxVirtForModule ], providers: [IgxGridAPIService] diff --git a/src/grid/tests.helper.ts b/src/grid/tests.helper.ts index 6c7ba391af6..4be8a21085f 100644 --- a/src/grid/tests.helper.ts +++ b/src/grid/tests.helper.ts @@ -5,7 +5,7 @@ import { FilteringStrategy, IFilteringStrategy } from "../../src/data-operations import { SortingStrategy } from "../../src/data-operations/sorting-strategy"; import { StableSortingStrategy } from "../../src/data-operations/stable-sorting-strategy"; -const KEY_JOB_TITLE: string = "JobTitle"; +const KEY_JOB_TITLE = "JobTitle"; export class CustomJobTitleSortingStrategy extends SortingStrategy { public jobTitles = { diff --git a/src/icon/icon.component.spec.ts b/src/icon/icon.component.spec.ts index b2da047780f..d6cee859f16 100644 --- a/src/icon/icon.component.spec.ts +++ b/src/icon/icon.component.spec.ts @@ -4,23 +4,23 @@ import { TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxIcon, IgxIconModule } from "./icon.component"; +import { IgxIconComponent, IgxIconModule } from "./icon.component"; describe("Icon", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - IgxIcon, - InitIcon, - InitMaterialIcon, - InitCustomColorIcon, - InitInactiveIcon + IgxIconComponent, + InitIconComponent, + InitMaterialIconComponent, + InitCustomColorIconComponent, + InitInactiveIconComponent ] }).compileComponents(); })); it("Initializes icon with initials", () => { - const fixture = TestBed.createComponent(InitIcon); + const fixture = TestBed.createComponent(InitIconComponent); const icon = fixture.componentInstance.icon; fixture.detectChanges(); @@ -33,7 +33,7 @@ describe("Icon", () => { }); it("Initializes material icon", () => { - const fixture = TestBed.createComponent(InitMaterialIcon); + const fixture = TestBed.createComponent(InitMaterialIconComponent); const icon = fixture.componentInstance.icon; fixture.detectChanges(); @@ -43,7 +43,7 @@ describe("Icon", () => { }); it("Initializes custom color icon", () => { - const fixture = TestBed.createComponent(InitCustomColorIcon); + const fixture = TestBed.createComponent(InitCustomColorIconComponent); const icon = fixture.componentInstance.icon; fixture.detectChanges(); @@ -52,7 +52,7 @@ describe("Icon", () => { }); it("Initializes inactive icon", () => { - const fixture = TestBed.createComponent(InitInactiveIcon); + const fixture = TestBed.createComponent(InitInactiveIconComponent); const icon = fixture.componentInstance.icon; const iconContainers = icon.el.nativeElement.getElementsByClassName("igx-icon"); @@ -66,27 +66,27 @@ describe("Icon", () => { @Component({ template: `` }) -class InitIcon { - @ViewChild(IgxIcon) public icon: IgxIcon; +class InitIconComponent { + @ViewChild(IgxIconComponent) public icon: IgxIconComponent; } @Component({ template: `` }) -class InitMaterialIcon { - @ViewChild(IgxIcon) public icon: IgxIcon; +class InitMaterialIconComponent { + @ViewChild(IgxIconComponent) public icon: IgxIconComponent; } @Component({ template: `` }) -class InitCustomColorIcon { - @ViewChild(IgxIcon) public icon: IgxIcon; +class InitCustomColorIconComponent { + @ViewChild(IgxIconComponent) public icon: IgxIconComponent; } @Component({ template: `` }) -class InitInactiveIcon { - @ViewChild(IgxIcon) public icon: IgxIcon; +class InitInactiveIconComponent { + @ViewChild(IgxIconComponent) public icon: IgxIconComponent; } diff --git a/src/icon/icon.component.ts b/src/icon/icon.component.ts index b52d888feeb..a310d42920a 100644 --- a/src/icon/icon.component.ts +++ b/src/icon/icon.component.ts @@ -7,11 +7,11 @@ import { Component, ElementRef, Input, NgModule, ViewChild } from "@angular/core templateUrl: "icon.component.html" }) -export class IgxIcon { +export class IgxIconComponent { @ViewChild("icon") public themeIcon: ElementRef; - private font: string = "material"; - private active: string = "true"; + private font = "material"; + private active = "true"; private iconColor: string; private iconName: string; @@ -56,8 +56,8 @@ export class IgxIcon { } @NgModule({ - declarations: [IgxIcon], - exports: [IgxIcon], + declarations: [IgxIconComponent], + exports: [IgxIconComponent], imports: [CommonModule] }) export class IgxIconModule { } diff --git a/src/list/list.component.spec.ts b/src/list/list.component.spec.ts index ef7a0921ee0..3a8e566a7b5 100644 --- a/src/list/list.component.spec.ts +++ b/src/list/list.component.spec.ts @@ -1,16 +1,16 @@ import { Component, ContentChildren, QueryList, ViewChild } from "@angular/core"; import { async, ComponentFixture, TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxList, IgxListItem, IgxListModule, IgxListPanState } from "./list.component"; +import { IgxListComponent, IgxListItemComponent, IgxListModule, IgxListPanState } from "./list.component"; declare var Simulator: any; describe("List", () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ListTestComponent, ListWithPanningAllowed, - ListWithLeftPanningAllowed, ListWithRightPanningAllowed, - ListWithNoItems, ListWithCustomNoItemsTemplate], + declarations: [ListTestComponent, ListWithPanningAllowedComponent, + ListWithLeftPanningAllowedComponent, ListWithRightPanningAllowedComponent, + ListWithNoItemsComponent, ListWithCustomNoItemsTemplateComponent], imports: [IgxListModule] }).compileComponents(); })); @@ -20,7 +20,7 @@ describe("List", () => { const list = fixture.componentInstance.list; expect(list).toBeDefined(); - expect(list instanceof IgxList).toBeTruthy(); + expect(list instanceof IgxListComponent).toBeTruthy(); expect(list.items instanceof Array).toBeTruthy(); expect(list.items.length).toBe(0); expect(list.headers instanceof Array).toBeTruthy(); @@ -29,10 +29,10 @@ describe("List", () => { fixture.detectChanges(); expect(list.items instanceof Array).toBeTruthy(); expect(list.items.length).toBe(3); - expect(list.items[0] instanceof IgxListItem).toBeTruthy(); + expect(list.items[0] instanceof IgxListItemComponent).toBeTruthy(); expect(list.headers instanceof Array).toBeTruthy(); expect(list.headers.length).toBe(1); - expect(list.headers[0] instanceof IgxListItem).toBeTruthy(); + expect(list.headers[0] instanceof IgxListItemComponent).toBeTruthy(); }); it("should set/get properly layout properties: width, left, maxLeft", () => { @@ -49,7 +49,7 @@ describe("List", () => { fixture.detectChanges(); expect(list.items.length).toBe(3); item = list.items[0]; - expect(item instanceof IgxListItem).toBeTruthy(); + expect(item instanceof IgxListItemComponent).toBeTruthy(); expect(item.width).toBe(testWidth); expect(item.left).toBe(0); expect(item.maxLeft).toBe(-testWidth); @@ -71,28 +71,28 @@ describe("List", () => { expect(list.headers.length).toBe(1); for (let i = 0; i < list.children.length; i++) { - const item: IgxListItem = list.children.find(((child) => (child.index === i))); + const item: IgxListItemComponent = list.children.find(((child) => (child.index === i))); expect(item.index).toBe(i); } }); it("Should pan right and pan left.", (done) => { let fixture; - let list: IgxList; - let item: IgxListItem; + let list: IgxListComponent; + let item: IgxListItemComponent; let itemNativeElement; let itemHeight; let itemWidth; TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(ListWithPanningAllowed); + fixture = TestBed.createComponent(ListWithPanningAllowedComponent); list = fixture.componentInstance.list; fixture.detectChanges(); return fixture.whenStable(); }).then(() => { - item = list.items[0] as IgxListItem; + item = list.items[0] as IgxListItemComponent; itemNativeElement = item.element.nativeElement; itemHeight = item.element.nativeElement.offsetHeight; itemWidth = item.element.nativeElement.offsetWidth; @@ -126,20 +126,20 @@ describe("List", () => { it("Should pan right only.", (done) => { let fixture; - let list: IgxList; - let item: IgxListItem; + let list: IgxListComponent; + let item: IgxListItemComponent; let itemNativeElement; let itemHeight; let itemWidth; TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(ListWithRightPanningAllowed); + fixture = TestBed.createComponent(ListWithRightPanningAllowedComponent); list = fixture.componentInstance.list; fixture.detectChanges(); return fixture.whenStable(); }).then(() => { - item = list.items[0] as IgxListItem; + item = list.items[0] as IgxListItemComponent; itemNativeElement = item.element.nativeElement; itemHeight = item.element.nativeElement.offsetHeight; itemWidth = item.element.nativeElement.offsetWidth; @@ -167,20 +167,20 @@ describe("List", () => { it("Should pan left only.", (done) => { let fixture; - let list: IgxList; - let item: IgxListItem; + let list: IgxListComponent; + let item: IgxListItemComponent; let itemNativeElement; let itemHeight; let itemWidth; TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(ListWithLeftPanningAllowed); + fixture = TestBed.createComponent(ListWithLeftPanningAllowedComponent); list = fixture.componentInstance.list; fixture.detectChanges(); return fixture.whenStable(); }).then(() => { - item = list.items[0] as IgxListItem; + item = list.items[0] as IgxListItemComponent; itemNativeElement = item.element.nativeElement; itemHeight = item.element.nativeElement.offsetHeight; itemWidth = item.element.nativeElement.offsetWidth; @@ -207,7 +207,7 @@ describe("List", () => { }, 5000); it("Should have default no items template.", () => { - const fixture = TestBed.createComponent(ListWithNoItems); + const fixture = TestBed.createComponent(ListWithNoItemsComponent); const list = fixture.componentInstance.list; const listNoItemsImgSrc = "https://example.com/noitems.png"; const listNoItemsMessage = "Custom no items message."; @@ -235,7 +235,7 @@ describe("List", () => { }); it("Should have custom no items template.", () => { - const fixture = TestBed.createComponent(ListWithCustomNoItemsTemplate); + const fixture = TestBed.createComponent(ListWithCustomNoItemsTemplateComponent); const list = fixture.componentInstance.list; const listCustomNoItemsTemplateContent = "Custom no items message."; @@ -287,7 +287,7 @@ describe("List", () => {
` }) class ListTestComponent { - @ViewChild(IgxList) public list: IgxList; + @ViewChild(IgxListComponent) public list: IgxListComponent; @ViewChild("wrapper") public wrapper; } @@ -300,8 +300,8 @@ class ListTestComponent { ` }) -class ListWithPanningAllowed { - @ViewChild(IgxList) public list: IgxList; +class ListWithPanningAllowedComponent { + @ViewChild(IgxListComponent) public list: IgxListComponent; } @Component({ @@ -313,8 +313,8 @@ class ListWithPanningAllowed { ` }) -class ListWithRightPanningAllowed { - @ViewChild(IgxList) public list: IgxList; +class ListWithRightPanningAllowedComponent { + @ViewChild(IgxListComponent) public list: IgxListComponent; } @Component({ @@ -326,8 +326,8 @@ class ListWithRightPanningAllowed { ` }) -class ListWithLeftPanningAllowed { - @ViewChild(IgxList) public list: IgxList; +class ListWithLeftPanningAllowedComponent { + @ViewChild(IgxListComponent) public list: IgxListComponent; } @Component({ @@ -339,8 +339,8 @@ class ListWithLeftPanningAllowed { ` }) -class ListWithNoItems { - @ViewChild(IgxList) public list: IgxList; +class ListWithNoItemsComponent { + @ViewChild(IgxListComponent) public list: IgxListComponent; } @Component({ @@ -352,6 +352,6 @@ class ListWithNoItems { ` }) -class ListWithCustomNoItemsTemplate { - @ViewChild(IgxList) public list: IgxList; +class ListWithCustomNoItemsTemplateComponent { + @ViewChild(IgxListComponent) public list: IgxListComponent; } diff --git a/src/list/list.component.ts b/src/list/list.component.ts index 3479604eb9c..2b9177a507a 100644 --- a/src/list/list.component.ts +++ b/src/list/list.component.ts @@ -3,9 +3,9 @@ import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, forwardRef, HostBinding, Inject, Input, NgModule, OnDestroy, OnInit, Output, QueryList, Renderer2, ViewChild } from "@angular/core"; -import { IgxButtonModule } from "../button/button.directive"; import { HammerGesturesManager } from "../core/touch"; -import { IgxRippleModule } from "../directives/ripple.directive"; +import { IgxButtonModule } from "../directives/button/button.directive"; +import { IgxRippleModule } from "../directives/ripple/ripple.directive"; export interface IListChild { index: number; @@ -16,23 +16,21 @@ export enum IgxListPanState { NONE, LEFT, RIGHT } // ====================== LIST ================================ // The `` directive is a list container for items and headers @Component({ - host: { - role: "list" - }, selector: "igx-list", styleUrls: ["./list.component.scss"], templateUrl: "list.component.html" }) -export class IgxList { - @ContentChildren(forwardRef(() => IgxListItem)) public children: QueryList; +export class IgxListComponent { + @ContentChildren(forwardRef(() => IgxListItemComponent)) public children: QueryList; - @Input() public allowLeftPanning: boolean = false; - @Input() public allowRightPanning: boolean = false; + @HostBinding("attr.role") public role = "list"; + @Input() public allowLeftPanning = false; + @Input() public allowRightPanning = false; - @Input() public hasNoItemsTemplate: boolean = false; + @Input() public hasNoItemsTemplate = false; @Input() public emptyListImage: string; - @Input() public emptyListMessage: string = "No items"; - @Input() public emptyListButtonText: string = "Add"; + @Input() public emptyListMessage = "No items"; + @Input() public emptyListButtonText = "Add"; @Output() public emptyListButtonClick = new EventEmitter(); @@ -44,10 +42,10 @@ export class IgxList { return this._innerStyle; } - private _innerStyle: string = "igx-list"; + private _innerStyle = "igx-list"; - get items(): IgxListItem[] { - const items: IgxListItem[] = []; + get items(): IgxListItemComponent[] { + const items: IgxListItemComponent[] = []; if (this.children !== undefined) { for (const child of this.children.toArray()) { if (!child.isHeader) { @@ -59,8 +57,8 @@ export class IgxList { return items; } - get headers(): IgxListItem[] { - const headers: IgxListItem[] = []; + get headers(): IgxListItemComponent[] { + const headers: IgxListItemComponent[] = []; if (this.children !== undefined) { for (const child of this.children.toArray()) { if (child.isHeader) { @@ -89,13 +87,13 @@ export class IgxList { styleUrls: ["./list.component.scss"], templateUrl: "list-item.component.html" }) -export class IgxListItem implements OnInit, OnDestroy, IListChild { +export class IgxListItemComponent implements OnInit, OnDestroy, IListChild { @ViewChild("wrapper") public element: ElementRef; - public hidden: boolean = false; + public hidden = false; @HostBinding("attr.role") public role; - @Input() public isHeader: boolean = false; + @Input() public isHeader = false; @Input() public href: string; @Input() public options: object[]; @@ -105,7 +103,7 @@ export class IgxListItem implements OnInit, OnDestroy, IListChild { private _panState: IgxListPanState = IgxListPanState.NONE; private _FRACTION_OF_WIDTH_TO_TRIGGER_GRIP = 0.5; // as a fraction of the item width - private _innerStyle: string = ""; + private _innerStyle = ""; private _previousPanDeltaX = 0; get panState(): IgxListPanState { @@ -146,8 +144,8 @@ export class IgxListItem implements OnInit, OnDestroy, IListChild { } constructor( - @Inject(forwardRef(() => IgxList)) - private list: IgxList, + @Inject(forwardRef(() => IgxListComponent)) + private list: IgxListComponent, private _renderer: Renderer2) { } @@ -244,8 +242,8 @@ export class IgxListItem implements OnInit, OnDestroy, IListChild { } @NgModule({ - declarations: [IgxList, IgxListItem], - exports: [IgxList, IgxListItem], + declarations: [IgxListComponent, IgxListItemComponent], + exports: [IgxListComponent, IgxListItemComponent], imports: [CommonModule, IgxButtonModule, IgxRippleModule] }) export class IgxListModule { diff --git a/src/main.ts b/src/main.ts index fdc192af2da..76b13e7b699 100644 --- a/src/main.ts +++ b/src/main.ts @@ -20,24 +20,24 @@ export * from "./grid/"; export * from "./navigation-drawer/navigation-drawer.component"; export * from "./icon/icon.component"; -export * from "./button/button.directive"; +export * from "./directives/button/button.directive"; +export * from "./directives/filter/filter.directive"; +export * from "./directives/input/input.directive"; +export * from "./directives/label/label.directive"; +export * from "./directives/layout/layout.directive"; +export * from "./directives/ripple/ripple.directive"; export * from "./buttonGroup/buttonGroup.component"; export * from "./list/list.component"; export * from "./tabbar/tabbar.component"; export * from "./calendar/calendar.component"; export * from "./carousel/carousel.component"; -export * from "./input/input.directive"; export * from "./checkbox/checkbox.component"; export * from "./radio/radio.component"; -export * from "./label/label.directive"; export * from "./switch/switch.component"; export * from "./avatar/avatar.component"; -export * from "./layout/layout.directive"; export * from "./dialog/dialog.component"; export * from "./progressbar/progressbar.component"; export * from "./navbar/navbar.component"; -export * from "./directives/filter.directive"; -export * from "./directives/ripple.directive"; export * from "./directives/virtual-for/igx_virtual_for.directive"; export * from "./badge/badge.component"; export * from "./snackbar/snackbar.component"; diff --git a/src/navbar/navbar.component.spec.ts b/src/navbar/navbar.component.spec.ts index 2f499c40893..59983bc35e9 100644 --- a/src/navbar/navbar.component.spec.ts +++ b/src/navbar/navbar.component.spec.ts @@ -1,6 +1,6 @@ import {Component, ViewChild} from "@angular/core"; import {async, TestBed } from "@angular/core/testing"; -import {IgxNavbar, IgxNavbarModule} from "./navbar.component"; +import {IgxNavbarComponent, IgxNavbarModule} from "./navbar.component"; describe("IgxNavbar", () => { beforeEach(async(() => { @@ -64,7 +64,7 @@ describe("IgxNavbar", () => { })); }); @Component({ - selector: "navbar-test-component", + selector: "igx-navbar-test-component", template: ` -
+

Drawer Title

-
+
@@ -35,8 +35,8 @@ The **igx-nav-drawer** is a container element for side navigation, providing qui | `isOpen` | boolean | State of the drawer. | | `pin` | boolean | Pinned state of the drawer. Currently only support. | | `pinThreshold` | number | Minimum device width required for automatic pin to be toggled. Default is 1024, can be set to falsy value to ignore. | -| `width` | string| Width of the drawer in its open state. Defaults to 300px based on the `.ig-nav-drawer` style. Can be used to override or dynamically modify the width.| -| `miniWidth` | string | Width of the drawer in its mini state. Defaults to 60px based on the `.ig-nav-drawer.mini` style. Can be used to override or dynamically modify the width. | +| `width` | string| Width of the drawer in its open state. Defaults to 300px based on the `.igx-nav-drawer` style. Can be used to override or dynamically modify the width.| +| `miniWidth` | string | Width of the drawer in its mini state. Defaults to 60px based on the `.igx-nav-drawer.mini` style. Can be used to override or dynamically modify the width. | ## Methods | Name | Description | @@ -66,7 +66,7 @@ export class MainDrawerSampleComponent { open: boolean = false; position = "left"; drawerMiniWidth = ""; - @ViewChild(IgxNavigationDrawer) viewChild: IgxNavigationDrawer; + @ViewChild(IgxNavigationDrawerComponent) viewChild: IgxNavigationDrawerComponent; /** Sample-specific configurations: */ showMiniWidth: boolean = false; showEventLog: boolean = true; diff --git a/src/navigation-drawer/navigation-drawer.component.html b/src/navigation-drawer/navigation-drawer.component.html index 2ee431be5bf..a99cd176296 100644 --- a/src/navigation-drawer/navigation-drawer.component.html +++ b/src/navigation-drawer/navigation-drawer.component.html @@ -1,12 +1,12 @@ -
-
+
\ No newline at end of file diff --git a/src/navigation-drawer/navigation-drawer.component.scss b/src/navigation-drawer/navigation-drawer.component.scss index d7aadb1c521..6abc636a08f 100644 --- a/src/navigation-drawer/navigation-drawer.component.scss +++ b/src/navigation-drawer/navigation-drawer.component.scss @@ -2,7 +2,7 @@ @import "../themes/material/config"; // Main Navigation Drawer state styles -@include b(ig-nav-drawer) { +@include b(igx-nav-drawer) { position: fixed; width: em(242px); height: 100%; @@ -71,7 +71,7 @@ } // Navigation Drawer overlay styles -.ig-nav-drawer-overlay { +.igx-nav-drawer-overlay { opacity: 1; background-color: $overlay-color; transition-property: opacity, visibility; // opacity must match drawer transition, step over visibility to reduce animation cost diff --git a/src/navigation-drawer/navigation-drawer.component.spec.ts b/src/navigation-drawer/navigation-drawer.component.spec.ts index bbbc1a62d0a..4309f2f479e 100644 --- a/src/navigation-drawer/navigation-drawer.component.spec.ts +++ b/src/navigation-drawer/navigation-drawer.component.spec.ts @@ -7,7 +7,7 @@ import { } from "@angular/core/testing"; import { Component, DebugElement, ViewChild } from "@angular/core"; -import { Observable } from "rxjs/Rx"; +import { Observable } from "rxjs/Observable"; import * as Infragistics from "../../src/main"; // HammerJS simulator from https://github.com/hammerjs/simulator, manual typings TODO @@ -19,10 +19,10 @@ describe("Navigation Drawer", () => { jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; TestBed.configureTestingModule({ declarations: [ - Infragistics.IgxNavigationClose, - Infragistics.IgxNavigationToggle, + Infragistics.IgxNavigationCloseDirective, + Infragistics.IgxNavigationToggleDirective, TestComponent, - TestComponentDI, + TestComponentDIComponent, TestComponentPin], imports: [Infragistics.IgxNavigationDrawerModule] }); @@ -36,18 +36,20 @@ describe("Navigation Drawer", () => { TestBed.compileComponents().then(() => { const fixture = TestBed.createComponent(TestComponent); fixture.detectChanges(); - expect(fixture.componentInstance.viewChild instanceof Infragistics.IgxNavigationDrawer).toBeTruthy(); + expect(fixture.componentInstance.viewChild instanceof + Infragistics.IgxNavigationDrawerComponent).toBeTruthy(); expect(fixture.componentInstance.viewChild.state).toBeNull(); }); })); it("should initialize with DI service", async(() => { TestBed.compileComponents().then(() => { - const fixture = TestBed.createComponent(TestComponentDI); + const fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); expect(fixture.componentInstance.viewChild).toBeDefined(); - expect(fixture.componentInstance.viewChild instanceof Infragistics.IgxNavigationDrawer).toBeTruthy(); + expect(fixture.componentInstance.viewChild instanceof + Infragistics.IgxNavigationDrawerComponent).toBeTruthy(); expect(fixture.componentInstance.viewChild.state instanceof Infragistics.IgxNavigationService) .toBeTruthy(); }); @@ -55,11 +57,11 @@ describe("Navigation Drawer", () => { it("should properly initialize all elements and properties", async(() => { TestBed.compileComponents().then(() => { - const fixture = TestBed.createComponent(TestComponentDI); + const fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); - expect(fixture.componentInstance.viewChild.drawer.classList).toContain("ig-nav-drawer"); - expect(fixture.componentInstance.viewChild.overlay.classList).toContain("ig-nav-drawer-overlay"); + expect(fixture.componentInstance.viewChild.drawer.classList).toContain("igx-nav-drawer"); + expect(fixture.componentInstance.viewChild.overlay.classList).toContain("igx-nav-drawer-overlay"); expect(fixture.componentInstance.viewChild.styleDummy.classList).toContain("style-dummy"); expect(fixture.componentInstance.viewChild.hasAnimateWidth).toBeFalsy(); @@ -69,14 +71,14 @@ describe("Navigation Drawer", () => { })); it("should attach events and register to nav service and detach on destroy", async(() => { - const template = ''; - TestBed.overrideComponent(TestComponentDI, { + const template = ""; + TestBed.overrideComponent(TestComponentDIComponent, { set: { template }}); // compile after overrides, not in before each: https://github.com/angular/angular/issues/10712 TestBed.compileComponents().then(() => { - const fixture = TestBed.createComponent(TestComponentDI); + const fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); const state: Infragistics.IgxNavigationService = fixture.componentInstance.viewChild.state; const touchManager = fixture.componentInstance.viewChild.touchManager; @@ -95,9 +97,9 @@ describe("Navigation Drawer", () => { it("should open and close with API calls", async(() => { TestBed.compileComponents().then(() => { - const fixture = TestBed.createComponent(TestComponentDI); + const fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); - const drawer: Infragistics.IgxNavigationDrawer = fixture.componentInstance.viewChild; + const drawer: Infragistics.IgxNavigationDrawerComponent = fixture.componentInstance.viewChild; expect(drawer.isOpen).toBeFalsy(); drawer.open(); @@ -121,7 +123,7 @@ describe("Navigation Drawer", () => { })); it("async API calls should resolve Promise and emit events", async(() => { - let fixture: ComponentFixture; + let fixture: ComponentFixture; let resolver; let drawer; const result = new Promise((resolve) => { @@ -131,7 +133,7 @@ describe("Navigation Drawer", () => { }); // compile after overrides, not in before each: https://github.com/angular/angular/issues/10712 TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(TestComponentDI); + fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); drawer = fixture.componentInstance.viewChild; @@ -170,16 +172,16 @@ describe("Navigation Drawer", () => { it("should properly initialize with min template", async(() => { const template = ` -
-
+
+
`; - TestBed.overrideComponent(TestComponentDI, { + TestBed.overrideComponent(TestComponentDIComponent, { set: { template }}); // compile after overrides, not in before each: https://github.com/angular/angular/issues/10712 TestBed.compileComponents().then(() => { - const fixture = TestBed.createComponent(TestComponentDI); + const fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); expect(fixture.componentInstance.viewChild.hasAnimateWidth).toBeTruthy(); @@ -218,10 +220,10 @@ describe("Navigation Drawer", () => { })); it("should toggle on edge swipe gesture", (done) => { - let fixture: ComponentFixture; + let fixture: ComponentFixture; TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(TestComponentDI); + fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); expect(fixture.componentInstance.viewChild.isOpen).toEqual(false); @@ -248,11 +250,11 @@ describe("Navigation Drawer", () => { it("should toggle on edge pan gesture", (done) => { let navDrawer; - let fixture: ComponentFixture; + let fixture: ComponentFixture; // Using bare minimum of timeouts, jasmine.DEFAULT_TIMEOUT_INTERVAL can be modified only in beforeEach TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(TestComponentDI); + fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); navDrawer = fixture.componentInstance.viewChild; @@ -290,18 +292,18 @@ describe("Navigation Drawer", () => { it("should update edge zone with mini width", async(() => { const template = ` -
+
`; - let fixture: ComponentFixture; - TestBed.overrideComponent(TestComponentDI, { + let fixture: ComponentFixture; + TestBed.overrideComponent(TestComponentDIComponent, { set: { template }}); // compile after overrides, not in before each: https://github.com/angular/angular/issues/10712 TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(TestComponentDI); + fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); - const drawer: Infragistics.IgxNavigationDrawer = fixture.componentInstance.viewChild; + const drawer: Infragistics.IgxNavigationDrawerComponent = fixture.componentInstance.viewChild; fixture.componentInstance.drawerMiniWidth = 60; fixture.detectChanges(); @@ -319,17 +321,17 @@ describe("Navigation Drawer", () => { it("should update width from css or property", (done) => { const template = ` -
-
+
+
`; - let fixture: ComponentFixture; - TestBed.overrideComponent(TestComponentDI, { + let fixture: ComponentFixture; + TestBed.overrideComponent(TestComponentDIComponent, { set: { template }}); // compile after overrides, not in before each: https://github.com/angular/angular/issues/10712 TestBed.compileComponents().then(() => { - fixture = TestBed.createComponent(TestComponentDI); + fixture = TestBed.createComponent(TestComponentDIComponent); fixture.detectChanges(); // defaults: @@ -449,26 +451,26 @@ describe("Navigation Drawer", () => { }); @Component({ - selector: "test-cmp", + selector: "igx-test-cmp", template: "" }) class TestComponent { - @ViewChild(Infragistics.IgxNavigationDrawer) public viewChild: Infragistics.IgxNavigationDrawer; + @ViewChild(Infragistics.IgxNavigationDrawerComponent) public viewChild: Infragistics.IgxNavigationDrawerComponent; } @Component({ providers: [Infragistics.IgxNavigationService], - selector: "test-cmp", + selector: "igx-test-cmp", template: "" }) -class TestComponentDI { +class TestComponentDIComponent { public drawerMiniWidth: string | number; public drawerWidth: string | number; - @ViewChild(Infragistics.IgxNavigationDrawer) public viewChild: Infragistics.IgxNavigationDrawer; + @ViewChild(Infragistics.IgxNavigationDrawerComponent) public viewChild: Infragistics.IgxNavigationDrawerComponent; } -class TestComponentPin extends TestComponentDI { - public pin: boolean = true; - public enableGestures: string = ""; - public pinThreshold: number = 1024; +class TestComponentPin extends TestComponentDIComponent { + public pin = true; + public enableGestures = ""; + public pinThreshold = 1024; } diff --git a/src/navigation-drawer/navigation-drawer.component.ts b/src/navigation-drawer/navigation-drawer.component.ts index 4dd36335267..c9664fd56e2 100644 --- a/src/navigation-drawer/navigation-drawer.component.ts +++ b/src/navigation-drawer/navigation-drawer.component.ts @@ -28,12 +28,12 @@ import { HammerGesturesManager } from "../core/touch"; * Usage: * ``` * - *
+ *
* *
* * ``` - * Can also include an optional `
`. + * Can also include an optional `
`. * ID required to register with NavigationService allow directives to target the control. */ @Component({ @@ -42,7 +42,7 @@ import { HammerGesturesManager } from "../core/touch"; styleUrls: ["./navigation-drawer.component.scss"], templateUrl: "navigation-drawer.component.html" }) -export class IgxNavigationDrawer extends BaseComponent implements IToggleView, +export class IgxNavigationDrawerComponent extends BaseComponent implements IToggleView, OnInit, AfterContentInit, OnDestroy, @@ -54,34 +54,34 @@ export class IgxNavigationDrawer extends BaseComponent implements IToggleView, /** * Position of the Navigation Drawer. Can be "left"(default) or "right". Only has effect when not pinned. */ - @Input() public position: string = "left"; + @Input() public position = "left"; /** * Enables the use of touch gestures to manipulate the drawer - such as swipe/pan from edge to open, * swipe toggle and pan drag. */ - @Input() public enableGestures: boolean = true; + @Input() public enableGestures = true; /** State of the drawer. */ - @Input() public isOpen: boolean = false; + @Input() public isOpen = false; /** Pinned state of the drawer. Currently only support */ - @Input() public pin: boolean = false; + @Input() public pin = false; /** * Minimum device width required for automatic pin to be toggled. * Deafult is 1024, can be set to falsy value to ignore. */ - @Input() public pinThreshold: number = 1024; + @Input() public pinThreshold = 1024; /** - * Width of the drawer in its open state. Defaults to 300px based on the `.ig-nav-drawer` style. + * Width of the drawer in its open state. Defaults to 300px based on the `.igx-nav-drawer` style. * Can be used to override or dynamically modify the width. */ @Input() public width: string; /** - * Width of the drawer in its mini state. Defaults to 60px based on the `.ig-nav-drawer.mini` style. + * Width of the drawer in its mini state. Defaults to 60px based on the `.igx-nav-drawer.mini` style. * Can be used to override or dynamically modify the width. */ @Input() public miniWidth: string; @@ -97,15 +97,15 @@ export class IgxNavigationDrawer extends BaseComponent implements IToggleView, /** Event fired when the Navigation Drawer has closed. */ @Output() public closed = new EventEmitter(); - public _hasMimiTempl: boolean = false; - private _gesturesAttached: boolean = false; + public _hasMimiTempl = false; + private _gesturesAttached = false; private _widthCache: { width: number, miniWidth: number } = { width: null, miniWidth: null }; private _resizeObserver: Subscription; private css: { [name: string]: string; } = { - drawer: "ig-nav-drawer", + drawer: "igx-nav-drawer", mini: "mini", - miniProjection: ".ig-drawer-mini-content", - overlay: "ig-nav-drawer-overlay", + miniProjection: ".igx-drawer-mini-content", + overlay: "igx-nav-drawer-overlay", styleDummy: "style-dummy" }; private _resolveOpen: (value?: any | PromiseLike) => void; @@ -135,7 +135,7 @@ export class IgxNavigationDrawer extends BaseComponent implements IToggleView, } /** Pan animation properties */ - private _panning: boolean = false; + private _panning = false; private _panStartWidth: number; private _panLimit: number; private _previousDeltaX: number; @@ -147,7 +147,7 @@ export class IgxNavigationDrawer extends BaseComponent implements IToggleView, return this.pin || this._hasMimiTempl; } - private _maxEdgeZone: number = 50; + private _maxEdgeZone = 50; /** * Used for touch gestures (swipe and pan). * Defaults to 50 (in px) and is extended to at least 110% of the mini template width if available. @@ -609,8 +609,8 @@ export class IgxNavigationDrawer extends BaseComponent implements IToggleView, } @NgModule({ - declarations: [IgxNavigationDrawer], - exports: [IgxNavigationDrawer] + declarations: [IgxNavigationDrawerComponent], + exports: [IgxNavigationDrawerComponent] }) export class IgxNavigationDrawerModule { } diff --git a/src/progressbar/circularbar.component.spec.ts b/src/progressbar/circularbar.component.spec.ts index 552b2430c76..a8a33c846e6 100644 --- a/src/progressbar/circularbar.component.spec.ts +++ b/src/progressbar/circularbar.component.spec.ts @@ -6,23 +6,23 @@ import { tick } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxCircularProgressBar } from "./progressbar.component"; +import { IgxCircularProgressBarComponent } from "./progressbar.component"; describe("IgCircularBar", () => { const tickTime = 2000; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitCircularProgressBar, - CircularBar, - IgxCircularProgressBar + InitCircularProgressBarComponent, + CircularBarComponent, + IgxCircularProgressBarComponent ] }) .compileComponents(); })); it("Initialize circularProgressbar with default values", fakeAsync(() => { - const fixture = TestBed.createComponent(InitCircularProgressBar); + const fixture = TestBed.createComponent(InitCircularProgressBarComponent); tick(tickTime); fixture.detectChanges(); @@ -40,7 +40,7 @@ describe("IgCircularBar", () => { it("should set value to 0 for negative numbers", fakeAsync(() => { const negativeValue = -20; const expectedValue = 0; - const fixture = TestBed.createComponent(InitCircularProgressBar); + const fixture = TestBed.createComponent(InitCircularProgressBarComponent); tick(tickTime); fixture.detectChanges(); tick(tickTime); @@ -58,7 +58,7 @@ describe("IgCircularBar", () => { it("If passed value is higher then max it should stay equal to maximum (default max size)", fakeAsync(() => { const progressBarValue = 120; const expectedMaxValue = 100; - const fixture = TestBed.createComponent(InitCircularProgressBar); + const fixture = TestBed.createComponent(InitCircularProgressBarComponent); fixture.componentInstance.circularBar.value = 11; tick(tickTime); fixture.detectChanges(); @@ -77,7 +77,7 @@ describe("IgCircularBar", () => { it("If passed value is higher then max it should stay equal to maximum (custom max size)", fakeAsync(() => { const progressBarMaxValue = 150; const progressBarValue = 170; - const fixture = TestBed.createComponent(InitCircularProgressBar); + const fixture = TestBed.createComponent(InitCircularProgressBarComponent); tick(tickTime); fixture.detectChanges(); tick(tickTime); @@ -96,7 +96,7 @@ describe("IgCircularBar", () => { it("should not update value if max is updated", fakeAsync(() => { let progressBarMaxValue = 150; const progressBarValue = 120; - const fixture = TestBed.createComponent(InitCircularProgressBar); + const fixture = TestBed.createComponent(InitCircularProgressBarComponent); tick(tickTime); fixture.detectChanges(); @@ -123,7 +123,7 @@ describe("IgCircularBar", () => { })); it("Should update value when we try to decrease it", fakeAsync(() => { - const fixture = TestBed.createComponent(CircularBar); + const fixture = TestBed.createComponent(CircularBarComponent); const progressBar = fixture.componentInstance.circularBar; let expectedValue = 50; @@ -146,7 +146,7 @@ describe("IgCircularBar", () => { })); it("Should update value when we try to decrease it (without animation)", fakeAsync(() => { - const fixture = TestBed.createComponent(CircularBar); + const fixture = TestBed.createComponent(CircularBarComponent); const progressBar = fixture.componentInstance.circularBar; let expectedValue = 50; @@ -166,7 +166,7 @@ describe("IgCircularBar", () => { // UI TESTS it("The value representation should respond to passed value correctly", fakeAsync(() => { - const fixture = TestBed.createComponent(CircularBar); + const fixture = TestBed.createComponent(CircularBarComponent); const expectedValue = 30; @@ -189,7 +189,7 @@ describe("IgCircularBar", () => { })); it("The max representation should respond correctly to passed maximum value", fakeAsync(() => { - const fixture = TestBed.createComponent(CircularBar); + const fixture = TestBed.createComponent(CircularBarComponent); const expectedValue = 30; @@ -219,8 +219,8 @@ describe("IgCircularBar", () => { }); @Component({ template: `` }) -class InitCircularProgressBar { - @ViewChild(IgxCircularProgressBar) public circularBar: IgxCircularProgressBar; +class InitCircularProgressBarComponent { + @ViewChild(IgxCircularProgressBarComponent) public circularBar: IgxCircularProgressBarComponent; } @Component({ template: ` @@ -229,12 +229,12 @@ class InitCircularProgressBar {
` }) -class CircularBar { - @ViewChild(IgxCircularProgressBar) public progressbar: IgxCircularProgressBar; +class CircularBarComponent { + @ViewChild(IgxCircularProgressBarComponent) public progressbar: IgxCircularProgressBarComponent; @ViewChild("wrapper") public wrapper; @ViewChild("circularBar") public circularBar; - public value: number = 30; - public max: number = 100; - public animate: boolean = true; + public value = 30; + public max = 100; + public animate = true; } diff --git a/src/progressbar/linearbar.component.spec.ts b/src/progressbar/linearbar.component.spec.ts index 8c78610e693..dc6e291b7dc 100644 --- a/src/progressbar/linearbar.component.spec.ts +++ b/src/progressbar/linearbar.component.spec.ts @@ -6,23 +6,23 @@ import { tick } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxLinearProgressBar } from "./progressbar.component"; +import { IgxLinearProgressBarComponent } from "./progressbar.component"; describe("IgLinearBar", () => { const tickTime = 2000; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitLinearProgressBar, - LinearBar, - IgxLinearProgressBar + InitLinearProgressBarComponent, + LinearBarComponent, + IgxLinearProgressBarComponent ] }) .compileComponents(); })); it("should initialize linearProgressbar with default values", fakeAsync(() => { - const fixture = TestBed.createComponent(InitLinearProgressBar); + const fixture = TestBed.createComponent(InitLinearProgressBarComponent); tick(tickTime); fixture.detectChanges(); @@ -44,7 +44,7 @@ describe("IgLinearBar", () => { it("should set value to 0 for negative values", fakeAsync(() => { const negativeValue = -20; const expectedValue = 0; - const fixture = TestBed.createComponent(InitLinearProgressBar); + const fixture = TestBed.createComponent(InitLinearProgressBarComponent); tick(tickTime); fixture.detectChanges(); @@ -63,7 +63,7 @@ describe("IgLinearBar", () => { it("If passed value is higher then max it should stay equal to maximum (default max size)", fakeAsync(() => { const progressBarValue = 120; const expectedMaxValue = 100; - const fixture = TestBed.createComponent(InitLinearProgressBar); + const fixture = TestBed.createComponent(InitLinearProgressBarComponent); tick(tickTime); fixture.detectChanges(); @@ -83,7 +83,7 @@ describe("IgLinearBar", () => { "(custom max size and without animation)", fakeAsync(() => { const progressBarMaxValue = 150; const progressBarValue = 170; - const fixture = TestBed.createComponent(InitLinearProgressBar); + const fixture = TestBed.createComponent(InitLinearProgressBarComponent); fixture.detectChanges(); @@ -100,7 +100,7 @@ describe("IgLinearBar", () => { it("should not update value if max is decreased", fakeAsync(() => { let progressBarMaxValue = 200; const progressBarValue = 80; - const fixture = TestBed.createComponent(InitLinearProgressBar); + const fixture = TestBed.createComponent(InitLinearProgressBarComponent); tick(tickTime); fixture.detectChanges(); @@ -129,7 +129,7 @@ describe("IgLinearBar", () => { it("should not update value if max is increased (without animation)", fakeAsync(() => { let progressBarMaxValue = 100; const progressBarValue = 50; - const fixture = TestBed.createComponent(InitLinearProgressBar); + const fixture = TestBed.createComponent(InitLinearProgressBarComponent); fixture.detectChanges(); @@ -151,7 +151,7 @@ describe("IgLinearBar", () => { })); it("Should update value when we try to decrese it", fakeAsync(() => { - const fixture = TestBed.createComponent(LinearBar); + const fixture = TestBed.createComponent(LinearBarComponent); const progressBar = fixture.componentInstance.linearBar; let expectedValue = 50; @@ -174,7 +174,7 @@ describe("IgLinearBar", () => { })); it("Should update value when we try to decrease it (without animation)", fakeAsync(() => { - const fixture = TestBed.createComponent(LinearBar); + const fixture = TestBed.createComponent(LinearBarComponent); const progressBar = fixture.componentInstance.linearBar; let expectedValue = 50; @@ -195,7 +195,7 @@ describe("IgLinearBar", () => { // UI Tests it("The percentage representation should respond to passed value correctly", fakeAsync(() => { - const fixture = TestBed.createComponent(LinearBar); + const fixture = TestBed.createComponent(LinearBarComponent); const expectedValue = 30; @@ -206,7 +206,7 @@ describe("IgLinearBar", () => { tick(tickTime); const progressBarElem = fixture.componentInstance.linearBar.elementRef.nativeElement - .querySelectorAll('[class*="progress-linear__bar--"]')[0]; + .querySelectorAll("[class*='progress-linear__bar--']")[0]; fixture.detectChanges(); @@ -215,11 +215,11 @@ describe("IgLinearBar", () => { })); it("Should change class suffix which would be relevant to the type that had been passed", fakeAsync(() => { - const fixture = TestBed.createComponent(LinearBar); + const fixture = TestBed.createComponent(LinearBarComponent); fixture.detectChanges(); const progressBarElem = fixture.componentInstance.linearBar.elementRef.nativeElement - .querySelectorAll('[class*="progress-linear__bar--"]')[0]; + .querySelectorAll("[class*='progress-linear__bar--']")[0]; expect(progressBarElem.classList.contains("progress-linear__bar--default")).toBeTruthy(); @@ -230,7 +230,7 @@ describe("IgLinearBar", () => { })); it("Change progressbar style to be striped", fakeAsync(() => { - const fixture = TestBed.createComponent(LinearBar); + const fixture = TestBed.createComponent(LinearBarComponent); fixture.detectChanges(); const progressElem = fixture.componentInstance.linearBar.elementRef.nativeElement @@ -245,13 +245,13 @@ describe("IgLinearBar", () => { })); it("should stay striped when the type has changed", fakeAsync(() => { - const fixture = TestBed.createComponent(LinearBar); + const fixture = TestBed.createComponent(LinearBarComponent); fixture.detectChanges(); const progressElem = fixture.componentInstance.linearBar.elementRef.nativeElement .getElementsByClassName("progress-linear")[0]; const progressBarElem = fixture.componentInstance.linearBar.elementRef.nativeElement - .querySelectorAll('[class*="progress-linear__bar--"]')[0]; + .querySelectorAll("[class*='progress-linear__bar--']")[0]; fixture.componentInstance.striped = true; fixture.detectChanges(); @@ -268,8 +268,8 @@ describe("IgLinearBar", () => { }); @Component({ template: `` }) -class InitLinearProgressBar { - @ViewChild(IgxLinearProgressBar) public linearBar: IgxLinearProgressBar; +class InitLinearProgressBarComponent { + @ViewChild(IgxLinearProgressBarComponent) public linearBar: IgxLinearProgressBarComponent; } @Component({ template: `
@@ -277,14 +277,14 @@ class InitLinearProgressBar { [animate]="animate" [type]="type" [striped]="striped">
` }) -class LinearBar { - @ViewChild(IgxLinearProgressBar) public progressbar: IgxLinearProgressBar; +class LinearBarComponent { + @ViewChild(IgxLinearProgressBarComponent) public progressbar: IgxLinearProgressBarComponent; @ViewChild("wrapper") public wrapper; @ViewChild("linearBar") public linearBar; - public value: number = 30; - public max: number = 100; - public type: string = "default"; - public striped: boolean = false; - public animate: boolean = true; + public value = 30; + public max = 100; + public type = "default"; + public striped = false; + public animate = true; } diff --git a/src/progressbar/progressbar.component.ts b/src/progressbar/progressbar.component.ts index b068ce20eec..285f2958c1d 100644 --- a/src/progressbar/progressbar.component.ts +++ b/src/progressbar/progressbar.component.ts @@ -15,8 +15,8 @@ import { export abstract class BaseProgress { protected requestAnimationId: number = undefined; - protected _valueInPercent: number = 0; - protected _max: number = 100; + protected _valueInPercent = 0; + protected _max = 100; protected _value = 0; protected _animate = true; @@ -71,10 +71,10 @@ export abstract class BaseProgress { styleUrls: ["progressbar.component.scss"], templateUrl: "templates/linear-bar.component.html" }) -export class IgxLinearProgressBar extends BaseProgress { +export class IgxLinearProgressBarComponent extends BaseProgress { - @Input() public striped: boolean = false; - @Input() public type: string = "default"; + @Input() public striped = false; + @Input() public type = "default"; @Input() set animate(animate: boolean) { this._animate = animate; @@ -130,7 +130,7 @@ export class IgxLinearProgressBar extends BaseProgress { styleUrls: ["progressbar.component.scss"], templateUrl: "templates/circular-bar.component.html" }) -export class IgxCircularProgressBar extends BaseProgress implements AfterViewInit { +export class IgxCircularProgressBarComponent extends BaseProgress implements AfterViewInit { @Output() public onProgressChanged = new EventEmitter(); @@ -180,7 +180,7 @@ export class IgxCircularProgressBar extends BaseProgress implements AfterViewIni this.onProgressChanged.emit(changedValues); } - private _radius: number = 0; + private _radius = 0; private _circumference: number; @ViewChild("circle") private _svgCircle: ElementRef; @@ -240,8 +240,8 @@ export function convertInPercentage(value: number, max: number) { } @NgModule({ - declarations: [IgxLinearProgressBar, IgxCircularProgressBar], - exports: [IgxLinearProgressBar, IgxCircularProgressBar], + declarations: [IgxLinearProgressBarComponent, IgxCircularProgressBarComponent], + exports: [IgxLinearProgressBarComponent, IgxCircularProgressBarComponent], imports: [CommonModule] }) export class IgxProgressBarModule { diff --git a/src/radio/radio.component.spec.ts b/src/radio/radio.component.spec.ts index 87151db2044..394f431e592 100644 --- a/src/radio/radio.component.spec.ts +++ b/src/radio/radio.component.spec.ts @@ -5,16 +5,16 @@ import { } from "@angular/core/testing"; import { FormsModule } from "@angular/forms"; import { By } from "@angular/platform-browser"; -import { IgxRadio } from "./radio.component"; +import { IgxRadioComponent } from "./radio.component"; describe("IgRadio", () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - InitRadio, - RadioWithModel, - IgxRadio + InitRadioComponent, + RadioWithModelComponent, + IgxRadioComponent ], imports: [FormsModule] }) @@ -22,7 +22,7 @@ describe("IgRadio", () => { })); it("Init a radio", () => { - const fixture = TestBed.createComponent(InitRadio); + const fixture = TestBed.createComponent(InitRadioComponent); fixture.detectChanges(); const nativeRadio = fixture.debugElement.query(By.css("input")).nativeElement; @@ -35,7 +35,7 @@ describe("IgRadio", () => { }); it("Binding to ngModel", async(() => { - const fixture = TestBed.createComponent(RadioWithModel); + const fixture = TestBed.createComponent(RadioWithModelComponent); fixture.detectChanges(); const radios = fixture.componentInstance.radios.toArray(); @@ -59,7 +59,7 @@ describe("IgRadio", () => { }); @Component({ template: `Radio` }) -class InitRadio {} +class InitRadioComponent {} @Component({ template: ` @@ -67,8 +67,8 @@ class InitRadio {} value="{{item}}" name="group" [(ngModel)]="selected">{{item}}` }) -class RadioWithModel { - @ViewChildren(IgxRadio) public radios; +class RadioWithModelComponent { + @ViewChildren(IgxRadioComponent) public radios; public selected = "Foo"; } diff --git a/src/radio/radio.component.ts b/src/radio/radio.component.ts index 637eaf3a7f3..d8829e7c15d 100644 --- a/src/radio/radio.component.ts +++ b/src/radio/radio.component.ts @@ -14,16 +14,16 @@ let nextId = 0; const noop = () => { }; @Component({ - providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxRadio, multi: true }], + providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxRadioComponent, multi: true }], selector: "igx-radio", styleUrls: ["./radio.component.scss"], templateUrl: "radio.component.html" }) -export class IgxRadio implements ControlValueAccessor { +export class IgxRadioComponent implements ControlValueAccessor { @Input() public value: any; - @Input() public id: string = `igx-radio-${nextId++}`; + @Input() public id = `igx-radio-${nextId++}`; @Input() public name: string; @@ -81,7 +81,7 @@ export class IgxRadio implements ControlValueAccessor { } @NgModule({ - declarations: [IgxRadio], - exports: [IgxRadio] + declarations: [IgxRadioComponent], + exports: [IgxRadioComponent] }) export class IgxRadioModule { } diff --git a/src/scroll/README.md b/src/scroll/README.md index e95e42b0d17..b28ac261b31 100644 --- a/src/scroll/README.md +++ b/src/scroll/README.md @@ -47,7 +47,7 @@ export class IgxScrollSampleComponent { To use the IgxSlider import the IgxSlider: ```typescript -import { IgxScroll } from "../../../src/main"; +import { IgxScrollComponent } from "../../../src/main"; ``` ## API diff --git a/src/scroll/scroll.component.spec.ts b/src/scroll/scroll.component.spec.ts index 425e8057d21..54acc07e5a5 100644 --- a/src/scroll/scroll.component.spec.ts +++ b/src/scroll/scroll.component.spec.ts @@ -1,6 +1,6 @@ import {Component, ViewChild} from "@angular/core"; import {async, TestBed} from "@angular/core/testing"; -import {IgxScroll, IgxScrollEvent, IgxScrollModule} from "./scroll.component"; +import {IgxScrollComponent, IgxScrollEvent, IgxScrollModule} from "./scroll.component"; declare var Simulator: any; @@ -262,7 +262,6 @@ describe("IgxScroll", () => { } }); @Component({ - selector: "scroll-test-component", template: ` { ` }) class ScrollInitializeTestComponent { - @ViewChild(IgxScroll) public scroll: IgxScroll; + @ViewChild(IgxScrollComponent) public scroll: IgxScrollComponent; public items: string[] = []; public visibleItems: string[] = []; - public visibleItemsCount: number = 5; + public visibleItemsCount = 5; - public currentTop: number = 0; + public currentTop = 0; public constructor() { for (let i = 1; i <= 5000; i++) { diff --git a/src/scroll/scroll.component.ts b/src/scroll/scroll.component.ts index d75ed0a738e..a4b6df07519 100644 --- a/src/scroll/scroll.component.ts +++ b/src/scroll/scroll.component.ts @@ -27,7 +27,7 @@ export interface IgxScrollEvent { styleUrls: ["./scroll.component.scss"], templateUrl: "scroll.component.html" }) -export class IgxScroll { +export class IgxScrollComponent { /** * Gets the scroll top of the scroll * @returns {number} @@ -139,8 +139,8 @@ export class IgxScroll { } @NgModule({ - declarations: [IgxScroll], - exports: [IgxScroll], + declarations: [IgxScrollComponent], + exports: [IgxScrollComponent], imports: [CommonModule], providers: [{ provide: HAMMER_GESTURE_CONFIG, diff --git a/src/slider/README.md b/src/slider/README.md index 8b97668f58d..577ea305e20 100644 --- a/src/slider/README.md +++ b/src/slider/README.md @@ -26,10 +26,10 @@ Based on its configuration it's a slider or range slider. ### Dependencies -To use the IgxSlider import the IgxSlider: +To use the IgxSlider import the IgxSliderComponent: ```typescript -import { IgxSlider } from "../../../src/main"; +import { IgxSliderComponent } from "../../../src/main"; ``` ## API diff --git a/src/slider/slider.component.spec.ts b/src/slider/slider.component.spec.ts index 73deecba436..41e810521eb 100644 --- a/src/slider/slider.component.spec.ts +++ b/src/slider/slider.component.spec.ts @@ -1,6 +1,6 @@ import { Component, ViewChild } from "@angular/core"; import { async, TestBed } from "@angular/core/testing"; -import {IgxSlider, IgxSliderModule, IRangeSliderValue, SliderType} from "./slider.component"; +import {IgxSliderComponent, IgxSliderModule, IRangeSliderValue, SliderType} from "./slider.component"; declare var Simulator: any; @@ -303,7 +303,7 @@ describe("IgxSlider", () => { xit("should move thumb slider to value 60", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -324,7 +324,7 @@ describe("IgxSlider", () => { it("should not move thumb slider and value should remain the same when slider is disabled", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -363,7 +363,7 @@ describe("IgxSlider", () => { it("should change value from 60 to 61 when right arrow is pressed and slider is SLIDER", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -384,7 +384,7 @@ describe("IgxSlider", () => { it("should change value from 60 to 59 when left arrow is pressed and slider is SLIDER", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -406,7 +406,7 @@ describe("IgxSlider", () => { it("should switch from left thumb to be focused upper when lower value is near upper" + "when slider is RANGE", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -435,7 +435,7 @@ describe("IgxSlider", () => { it("should switch from right thumb to be focused lower when upper value is near lower" + "when slider is RANGE", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -463,7 +463,7 @@ describe("IgxSlider", () => { it("should not change value if different key from arrows is pressed and slider is SLIDER", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -492,7 +492,7 @@ describe("IgxSlider", () => { it("should increment lower value when lower thumb is focused" + "if right arrow is pressed and slider is RANGE", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -521,7 +521,7 @@ describe("IgxSlider", () => { it("should increment upper value when upper thumb is focused" + "if right arrow is pressed and slider is RANGE", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -549,7 +549,7 @@ describe("IgxSlider", () => { it("should not increment upper value when slider is disabled", (done) => { let fixture; - let slider: IgxSlider; + let slider: IgxSliderComponent; TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(SliderInitializeTestComponent); slider = fixture.componentInstance.slider; @@ -604,10 +604,10 @@ describe("IgxSlider", () => { }); }); @Component({ - selector: "slider-test-component", + selector: "igx-slider-test-component", template: ` ` }) class SliderInitializeTestComponent { - @ViewChild(IgxSlider) public slider: IgxSlider; + @ViewChild(IgxSliderComponent) public slider: IgxSliderComponent; } diff --git a/src/slider/slider.component.ts b/src/slider/slider.component.ts index 3480acef955..d5527a03700 100644 --- a/src/slider/slider.component.ts +++ b/src/slider/slider.component.ts @@ -30,12 +30,12 @@ const noop = () => { }; @Component({ - providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxSlider, multi: true }], + providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxSliderComponent, multi: true }], selector: "igx-slider", styleUrls: ["./slider.component.scss"], templateUrl: "slider.component.html" }) -export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { +export class IgxSliderComponent implements ControlValueAccessor, OnInit, AfterViewInit { /** * Disables or enables UI interaction. */ @@ -47,7 +47,7 @@ export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { * Discrete slider does not have ticks and does not shows bubble labels for values. */ @Input() - public isContinuous: boolean = false; + public isContinuous = false; /** * The type of the slider. The slider can be SliderType.SLIDER or SliderType.RANGE @@ -61,7 +61,7 @@ export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { * @type {number} */ @Input() - public thumbLabelVisibilityDuration: number = 750; + public thumbLabelVisibilityDuration = 750; /** * The incremental/decremental step of the value when dragging the thumb. @@ -69,7 +69,7 @@ export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { * @type {number} */ @Input() - public step: number = 1; + public step = 1; /** * This event is emitted when user has stopped interacting the thumb and value is changed. @@ -78,7 +78,7 @@ export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { @Output() public onValueChange = new EventEmitter(); - public isActiveLabel: boolean = false; + public isActiveLabel = false; private activeHandle: SliderHandle = SliderHandle.TO; @@ -97,22 +97,22 @@ export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { @ViewChild("thumbTo") private thumbTo: ElementRef; - private _minValue: number = 0; + private _minValue = 0; // Measures & Coordinates - private width: number = 0; - private xOffset: number = 0; - private xPointer: number = 0; - private pPointer: number = 0; + private width = 0; + private xOffset = 0; + private xPointer = 0; + private pPointer = 0; // Limit handle travel zone - private pMin: number = 0; - private pMax: number = 1; + private pMin = 0; + private pMax = 1; // From/upperValue in percent values - private hasViewInit: boolean = false; + private hasViewInit = false; private timer; - private _maxValue: number = 100; + private _maxValue = 100; private _lowerBound?: number; private _upperBound?: number; private _lowerValue: number; @@ -671,8 +671,8 @@ export class IgxSlider implements ControlValueAccessor, OnInit, AfterViewInit { } @NgModule({ - declarations: [IgxSlider], - exports: [IgxSlider], + declarations: [IgxSliderComponent], + exports: [IgxSliderComponent], imports: [CommonModule] }) export class IgxSliderModule { diff --git a/src/snackbar/snackbar.component.spec.ts b/src/snackbar/snackbar.component.spec.ts index 0b2651c0ed8..d4a5493d74a 100644 --- a/src/snackbar/snackbar.component.spec.ts +++ b/src/snackbar/snackbar.component.spec.ts @@ -1,7 +1,7 @@ import {Component, ViewChild} from "@angular/core"; import {async, TestBed } from "@angular/core/testing"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; -import {IgxSnackbar, IgxSnackbarModule} from "./snackbar.component"; +import {IgxSnackbarComponent, IgxSnackbarModule} from "./snackbar.component"; const oldTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; @@ -44,7 +44,7 @@ describe("IgxSnackbar", () => { const fixture = TestBed.createComponent(SnackbarInitializeTestComponent); fixture.detectChanges(); - const displayTime: number = 1000; + const displayTime = 1000; fixture.componentInstance.snackbar.displayTime = displayTime; fixture.componentInstance.snackbar.show(); @@ -66,7 +66,7 @@ describe("IgxSnackbar", () => { const fixture = TestBed.createComponent(SnackbarInitializeTestComponent); fixture.detectChanges(); - const displayTime: number = 1000; + const displayTime = 1000; fixture.componentInstance.snackbar.displayTime = displayTime; fixture.componentInstance.snackbar.autoHide = false; @@ -103,11 +103,10 @@ describe("IgxSnackbar", () => { })); }); @Component({ - selector: "snackbar-test-component", template: ` ` }) class SnackbarInitializeTestComponent { public text: string; - @ViewChild(IgxSnackbar) public snackbar: IgxSnackbar; + @ViewChild(IgxSnackbarComponent) public snackbar: IgxSnackbarComponent; } diff --git a/src/snackbar/snackbar.component.ts b/src/snackbar/snackbar.component.ts index c013954ad13..d189527c8a2 100644 --- a/src/snackbar/snackbar.component.ts +++ b/src/snackbar/snackbar.component.ts @@ -73,7 +73,7 @@ import { fadeIn, fadeOut, slideInBottom, slideOutBottom } from "../animations/ma styleUrls: ["./snackbar.component.scss"], templateUrl: "snackbar.component.html" }) -export class IgxSnackbar { +export class IgxSnackbarComponent { /** * The message that will be shown message by the IgxSnackbar component * @type {string} @@ -84,14 +84,14 @@ export class IgxSnackbar { * The IgxSnackbar component visual state state * @type {boolean} */ - @Input() public isVisible: boolean = false; + @Input() public isVisible = false; /** * Sets if the IgxSnackbar component will be hidden after shown * Default value is true * @type {number} */ - @Input() public autoHide: boolean = true; + @Input() public autoHide = true; /** * The duration of time span in ms which the IgxSnackbar component will be visible @@ -99,7 +99,7 @@ export class IgxSnackbar { * Default value is 4000 * @type {number} */ - @Input() public displayTime: number = 4000; + @Input() public displayTime = 4000; /** * The text of the IgxSnackbar component action @@ -172,8 +172,8 @@ export class IgxSnackbar { } @NgModule({ - declarations: [IgxSnackbar], - exports: [IgxSnackbar], + declarations: [IgxSnackbarComponent], + exports: [IgxSnackbarComponent], imports: [CommonModule] }) export class IgxSnackbarModule { } diff --git a/src/switch/switch.component.ts b/src/switch/switch.component.ts index f0855b335c0..9fe580a3cd2 100644 --- a/src/switch/switch.component.ts +++ b/src/switch/switch.component.ts @@ -13,29 +13,29 @@ const noop = () => { }; let nextId = 0; @Component({ - providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxSwitch, multi: true }], + providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxSwitchComponent, multi: true }], selector: "igx-switch", styleUrls: ["./switch.component.scss"], templateUrl: "switch.component.html" }) -export class IgxSwitch implements ControlValueAccessor { +export class IgxSwitchComponent implements ControlValueAccessor { @Input() public value: any; - @Input() public id: string = `igx-switch-${nextId++}`; + @Input() public id = `igx-switch-${nextId++}`; @Input() get labelId() { return this.id + "_label"; } @Input() public name: string; - @Input() public disabled: boolean = false; + @Input() public disabled = false; @Input() public tabindex: number = null; - @Input() public checked: boolean = false; + @Input() public checked = false; @Output() public change = new EventEmitter(); @ViewChild("checkbox") public nativeCheckbox; - public focused: boolean = false; + public focused = false; protected _value: any; @@ -74,7 +74,7 @@ export class IgxSwitch implements ControlValueAccessor { } @NgModule({ - declarations: [IgxSwitch], - exports: [IgxSwitch] + declarations: [IgxSwitchComponent], + exports: [IgxSwitchComponent] }) export class IgxSwitchModule { } diff --git a/src/tabbar/tabbar.component.spec.ts b/src/tabbar/tabbar.component.spec.ts index eb7d5434096..ebc2c41144a 100644 --- a/src/tabbar/tabbar.component.spec.ts +++ b/src/tabbar/tabbar.component.spec.ts @@ -1,7 +1,7 @@ import { AfterContentChecked, AfterViewChecked, Component, ContentChildren, QueryList, ViewChild } from "@angular/core"; import { async, TestBed } from "@angular/core/testing"; import { By } from "@angular/platform-browser"; -import { IgxTab, IgxTabBar, IgxTabBarModule, IgxTabPanel } from "./tabbar.component"; +import { IgxTabBarComponent, IgxTabBarModule, IgxTabComponent, IgxTabPanelComponent } from "./tabbar.component"; describe("TabBar", () => { beforeEach(async(() => { @@ -15,8 +15,8 @@ describe("TabBar", () => { it("should initialize igx-tab-bar, igx-tab-panel and igx-tab", () => { const fixture = TestBed.createComponent(TabBarTestComponent); const tabbar = fixture.componentInstance.tabbar; - let panels: IgxTabPanel[]; - let tabs: IgxTab[]; + let panels: IgxTabPanelComponent[]; + let tabs: IgxTabComponent[]; fixture.detectChanges(); @@ -24,12 +24,12 @@ describe("TabBar", () => { tabs = tabbar.tabs.toArray(); expect(tabbar).toBeDefined(); - expect(tabbar instanceof IgxTabBar).toBeTruthy(); + expect(tabbar instanceof IgxTabBarComponent).toBeTruthy(); expect(tabbar.panels instanceof QueryList).toBeTruthy(); expect(tabbar.panels.length).toBe(3); for (let i = 0; i < tabbar.panels.length; i++) { - expect(panels[i] instanceof IgxTabPanel).toBeTruthy(); + expect(panels[i] instanceof IgxTabPanelComponent).toBeTruthy(); expect(panels[i].relatedTab).toBe(tabs[i]); } @@ -37,7 +37,7 @@ describe("TabBar", () => { expect(tabbar.tabs.length).toBe(3); for (let i = 0; i < tabbar.tabs.length; i++) { - expect(tabs[i] instanceof IgxTab).toBeTruthy(); + expect(tabs[i] instanceof IgxTabComponent).toBeTruthy(); expect(tabs[i].relatedPanel).toBe(panels[i]); } }); @@ -84,8 +84,8 @@ describe("TabBar", () => { const fixture = TestBed.createComponent(TabBarTestComponent); const tabbar = fixture.componentInstance.tabbar; let tabs; - let tab1: IgxTab; - let tab2: IgxTab; + let tab1: IgxTabComponent; + let tab2: IgxTabComponent; expect(tabbar.selectedIndex).toBe(-1); fixture.componentInstance.tabSelectedHandler = () => { @@ -161,7 +161,7 @@ describe("TabBar", () => {
` }) class TabBarTestComponent { - @ViewChild(IgxTabBar) public tabbar: IgxTabBar; + @ViewChild(IgxTabBarComponent) public tabbar: IgxTabBarComponent; @ViewChild("wrapperDiv") public wrapperDiv: any; public tabSelectedHandler(args) { @@ -200,6 +200,6 @@ class TabBarTestComponent {
` }) class BottomTabBarTestComponent { - @ViewChild(IgxTabBar) public tabbar: IgxTabBar; + @ViewChild(IgxTabBarComponent) public tabbar: IgxTabBarComponent; @ViewChild("wrapperDiv") public wrapperDiv: any; } diff --git a/src/tabbar/tabbar.component.ts b/src/tabbar/tabbar.component.ts index b41946fcba5..8b453706f22 100644 --- a/src/tabbar/tabbar.component.ts +++ b/src/tabbar/tabbar.component.ts @@ -6,6 +6,8 @@ import { ElementRef, EventEmitter, forwardRef, + HostBinding, + HostListener, Input, NgModule, Output, @@ -18,30 +20,27 @@ import { IgxBadgeModule } from "../badge/badge.component"; import { IgxIconModule } from "../icon/icon.component"; @Component({ encapsulation: ViewEncapsulation.None, - host: { - "(onTabSelected)": "_selectedPanelHandler($event)" - }, selector: "igx-tab-bar", styleUrls: ["./tabbar.component.scss"], templateUrl: "tab-bar-content.component.html" }) -export class IgxTabBar implements AfterViewInit { - @ViewChildren(forwardRef(() => IgxTab)) public tabs: QueryList; - @ContentChildren(forwardRef(() => IgxTabPanel)) public panels: QueryList; +export class IgxTabBarComponent implements AfterViewInit { + @ViewChildren(forwardRef(() => IgxTabComponent)) public tabs: QueryList; + @ContentChildren(forwardRef(() => IgxTabPanelComponent)) public panels: QueryList; @Output() public onTabSelected = new EventEmitter(); @Output() public onTabDeselected = new EventEmitter(); - public selectedIndex: number = -1; + public selectedIndex = -1; public get itemStyle(): string { return this._itemStyle; } - private _itemStyle: string = "igx-tab-bar"; + private _itemStyle = "igx-tab-bar"; - get selectedTab(): IgxTab { + get selectedTab(): IgxTabComponent { if (this.tabs && this.selectedIndex !== undefined) { return this.tabs.toArray()[this.selectedIndex]; } @@ -64,6 +63,7 @@ export class IgxTabBar implements AfterViewInit { }, 0); } + @HostListener("onTabSelected", ["$event"]) public _selectedPanelHandler(args) { this.selectedIndex = args.panel.index; @@ -74,7 +74,7 @@ export class IgxTabBar implements AfterViewInit { }); } - private _deselectPanel(panel: IgxTabPanel) { + private _deselectPanel(panel: IgxTabPanelComponent) { // Cannot deselect the selected tab - this will mean that there will be not selected tab left if (panel.isDisabled || this.selectedTab.index === panel.index) { return; @@ -85,43 +85,54 @@ export class IgxTabBar implements AfterViewInit { } } -// ================================= IgxTabPanel ====================================== +// ================================= IgxTabPanelComponent ====================================== @Component({ - host: { - "[attr.aria-labelledby]": "'igx-tab-' + index", - "[class.igx-tab-bar__panel--selected]": "isSelected", - "[class.igx-tab-bar__panel]": "!isSelected", - "[id]": "'igx-tab-bar__panel-' + index", - "role": "tabpanel" - }, selector: "igx-tab-panel", templateUrl: "tab-panel.component.html" }) -export class IgxTabPanel { - public isSelected: boolean = false; +export class IgxTabPanelComponent { + private _itemStyle = "igx-tab-panel"; + public isSelected = false; @Input() public label: string; @Input() public icon: string; @Input() public isDisabled: boolean; + @HostBinding("attr.role") public role = "tabpanel"; + + @HostBinding("class.igx-tab-bar__panel") + get styleClass(): boolean { + return (!this.isSelected); + } + @HostBinding("class.igx-tab-bar__panel--selected") + get selected(): boolean { + return this.isSelected; + } + @HostBinding("attr.aria-labelledby") + get labelledBy(): string { + return "igx-tab-" + this.index; + } + + @HostBinding("attr.id") + get id(): string { + return "igx-tab-bar__panel-" + this.index; + } + public get itemStyle(): string { return this._itemStyle; } - private _itemStyle: string = "igx-tab-panel"; - get relatedTab(): IgxTab { + get relatedTab(): IgxTabComponent { if (this._tabBar.tabs) { return this._tabBar.tabs.toArray()[this.index]; } } - get index() { return this._tabBar.panels.toArray().indexOf(this); } - - constructor(private _tabBar: IgxTabBar) { + constructor(private _tabBar: IgxTabBarComponent) { } public select() { @@ -134,21 +145,20 @@ export class IgxTabPanel { } } -// ======================================= IgxTab ========================================== +// ======================================= IgxTabComponent ========================================== @Component({ - host: { - class: "igx-tab-bar__menu-item", - role: "tab" - }, selector: "igx-tab", templateUrl: "tab.component.html" }) -export class IgxTab { - @Input() public relatedPanel: IgxTabPanel; +export class IgxTabComponent { + + @HostBinding("attr.role") public role = "tab"; + + @Input() public relatedPanel: IgxTabPanelComponent; - private _changesCount: number = 0; // changes and updates accordingly applied to the tab. + private _changesCount = 0; // changes and updates accordingly applied to the tab. get changesCount(): number { return this._changesCount; @@ -174,7 +184,7 @@ export class IgxTab { return this._tabBar.tabs.toArray().indexOf(this); } - constructor(private _tabBar: IgxTabBar, private _element: ElementRef) { + constructor(private _tabBar: IgxTabBarComponent, private _element: ElementRef) { } public select() { @@ -183,8 +193,8 @@ export class IgxTab { } @NgModule({ - declarations: [IgxTabBar, IgxTabPanel, IgxTab], - exports: [IgxTabBar, IgxTabPanel, IgxTab], + declarations: [IgxTabBarComponent, IgxTabPanelComponent, IgxTabComponent], + exports: [IgxTabBarComponent, IgxTabPanelComponent, IgxTabComponent], imports: [CommonModule, IgxBadgeModule, IgxIconModule] }) export class IgxTabBarModule { diff --git a/src/toast/toast.component.spec.ts b/src/toast/toast.component.spec.ts index f92833af9cd..6e0a69e2c1a 100644 --- a/src/toast/toast.component.spec.ts +++ b/src/toast/toast.component.spec.ts @@ -2,7 +2,7 @@ import {Component, ViewChild} from "@angular/core"; import {async, TestBed } from "@angular/core/testing"; import {By} from "@angular/platform-browser"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; -import {IgxToast, IgxToastModule, IgxToastPosition} from "./toast.component"; +import {IgxToastComponent, IgxToastModule, IgxToastPosition} from "./toast.component"; const oldTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; @@ -92,7 +92,7 @@ describe("IgxToast", () => { const fixture = TestBed.createComponent(ToastInitializeTestComponent); fixture.detectChanges(); - const displayTime: number = 1000; + const displayTime = 1000; fixture.componentInstance.toast.displayTime = displayTime; fixture.componentInstance.toast.show(); @@ -114,7 +114,7 @@ describe("IgxToast", () => { const fixture = TestBed.createComponent(ToastInitializeTestComponent); fixture.detectChanges(); - const displayTime: number = 1000; + const displayTime = 1000; fixture.componentInstance.toast.displayTime = displayTime; fixture.componentInstance.toast.autoHide = false; @@ -133,10 +133,9 @@ describe("IgxToast", () => { }); }); @Component({ - selector: "snackbar-test-component", template: ` ` }) class ToastInitializeTestComponent { - @ViewChild(IgxToast) public toast: IgxToast; + @ViewChild(IgxToastComponent) public toast: IgxToastComponent; } diff --git a/src/toast/toast.component.ts b/src/toast/toast.component.ts index f41b8a801d5..1d012959653 100644 --- a/src/toast/toast.component.ts +++ b/src/toast/toast.component.ts @@ -20,14 +20,11 @@ import { Component, EventEmitter, Input, NgModule, Output } from "@angular/core" transition("show => *", animate(".40s ease-out")) ]) ], - host: { - role: "alert" - }, selector: "igx-toast", styleUrls: ["./toast.component.scss"], templateUrl: "toast.component.html" }) -export class IgxToast { +export class IgxToastComponent { public readonly CSS_CLASSES = { IGX_TOAST_BOTTOM: "igx-toast--bottom", IGX_TOAST_MIDDLE: "igx-toast--middle", @@ -62,13 +59,15 @@ export class IgxToast { @Output() public onHidden = new EventEmitter(); + @Input() + public role = "alert"; /** * Sets if the IgxToast component will be hidden after shown * Default value is true * @type {number} */ @Input() - public autoHide: boolean = true; + public autoHide = true; /** * The duration of time span in ms which the IgxToast component will be visible @@ -77,14 +76,14 @@ export class IgxToast { * @type {number} */ @Input() - public displayTime: number = 4000; + public displayTime = 4000; /** * The IgxToast component visual state state * @type {boolean} */ @Input() - public isVisible: boolean = false; + public isVisible = false; /** * The message that will be shown message by the IgxToast component @@ -161,8 +160,8 @@ export enum IgxToastPosition { } @NgModule({ - declarations: [IgxToast], - exports: [IgxToast], + declarations: [IgxToastComponent], + exports: [IgxToastComponent], imports: [CommonModule] }) export class IgxToastModule { } diff --git a/tslint.json b/tslint.json index 94ceba8a707..e65ef73e7b5 100644 --- a/tslint.json +++ b/tslint.json @@ -1,14 +1,150 @@ { - "extends": "tslint:latest", + "extends": "tslint:latest", + "rulesDirectory": [ + "node_modules/codelyzer" + ], "rules": { - "indent": [true, "spaces"], - "variable-name": [true, "allow-leading-underscore"], "interface-name": [true, "always-prefix"], "trailing-comma": [true, {"multiline": "never", "singleline": "never"}], - "no-empty": false, - "no-bitwise": false, "no-submodule-imports": [true, "rxjs", "@angular/platform-browser", "@angular/core/testing"], "max-classes-per-file": [false], - "prefer-object-spread": false + "prefer-object-spread": false, + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [ + true, + "rxjs", + "rxjs/Rx" + ], + "import-spacing": true, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "double" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "typeof-compare": true, + "unified-signatures": true, + "variable-name": [true, "allow-leading-underscore"], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "directive-selector": [ + true, + "attribute", + "igx", + "camelCase" + ], + "component-selector": [ + true, + "element", + "igx", + "kebab-case" + ], + "no-output-on-prefix": false, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": false, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true } }