Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Using Builder's typescript configs; fixed modal warning #1216

Merged
merged 4 commits into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/app/components/wait/wait-demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import {
templateUrl: './wait-demo.component.html'
})
export class SkyWaitDemoComponent {

public isWaiting = false;

constructor(private waitSvc: SkyWaitService) { }

public showPageWait(isBlocking: boolean) {
if (isBlocking) {
this.waitSvc.beginBlockingPageWait();
Expand All @@ -25,6 +26,4 @@ export class SkyWaitDemoComponent {
}, 2000);
}
}

constructor(private waitSvc: SkyWaitService) { }
}
4 changes: 2 additions & 2 deletions src/modules/colorpicker/colorpicker-component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ describe('Colorpicker Component', () => {
fixture.whenStable();
let inputElement: NodeListOf<Element> =
element.querySelectorAll('.rgba-text > div:last-child > input');
let input = {
let input: any = {
'hex': inputElement[0],
'red': inputElement[1],
'green': inputElement[2],
'blue': inputElement[3],
'alpha': inputElement[4]
};
input[name].value = value;
let params = {
let params: any = {
'bubbles': false,
'cancelable': false
};
Expand Down
31 changes: 16 additions & 15 deletions src/modules/colorpicker/colorpicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ let componentIdIndex = 0;
})

export class SkyColorpickerComponent implements OnInit {

@Output()
public selectedColorChanged: EventEmitter<SkyColorpickerOutput> =
new EventEmitter<SkyColorpickerOutput>();
new EventEmitter<SkyColorpickerOutput>();

public idIndex: number;
public skyColorpickerHexId: string;
public skyColorpickerRedId: string;
Expand All @@ -56,12 +56,26 @@ export class SkyColorpickerComponent implements OnInit {
public selectedColor: SkyColorpickerOutput;
public slider: SliderPosition;
public initialColor: string;

@ViewChild('closeColorPicker')
private closeColorPicker: ElementRef;

private outputColor: string;
private hsva: SkyColorpickerHsva;
private sliderDimMax: SliderDimension;

constructor(private service: SkyColorpickerService) {
componentIdIndex++;

this.idIndex = componentIdIndex;
this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex;
this.skyColorpickerHexId = 'sky-colorpicker-hex-' + this.idIndex;
this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex;
this.skyColorpickerGreenId = 'sky-colorpicker-green-' + this.idIndex;
this.skyColorpickerBlueId = 'sky-colorpicker-blue-' + this.idIndex;
this.skyColorpickerAlphaId = 'sky-colorpicker-alpha-' + this.idIndex;
}

@HostListener('click', ['$event'])
public onClick(event: any) {
let element: HTMLButtonElement = <HTMLButtonElement>event.target;
Expand All @@ -87,19 +101,6 @@ export class SkyColorpickerComponent implements OnInit {
}
}

constructor(
private service: SkyColorpickerService
) {
componentIdIndex++;
this.idIndex = componentIdIndex;
this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex;
this.skyColorpickerHexId = 'sky-colorpicker-hex-' + this.idIndex;
this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex;
this.skyColorpickerGreenId = 'sky-colorpicker-green-' + this.idIndex;
this.skyColorpickerBlueId = 'sky-colorpicker-blue-' + this.idIndex;
this.skyColorpickerAlphaId = 'sky-colorpicker-alpha-' + this.idIndex;
}

public setDialog(
instance: any,
elementRef: ElementRef,
Expand Down
10 changes: 4 additions & 6 deletions src/modules/fileattachments/file-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ import {

})
export class SkyFileItemComponent implements DoCheck {

@Input()
public fileItem: SkyFileItem | SkyFileLink;

@Output()
public deleteFile = new EventEmitter<SkyFileLink | SkyFileItem>();

private otherCls: string;

private differ: KeyValueDiffer<any, any>;

public constructor(private differs: KeyValueDiffers) {
this.differ = this.differs.find({}).create(undefined);
}

public ngDoCheck() {
let changes = this.differ.diff(this.fileItem);

Expand Down Expand Up @@ -102,10 +104,6 @@ export class SkyFileItemComponent implements DoCheck {
}
}

public constructor(private differs: KeyValueDiffers) {
this.differ = this.differs.find({}).create(undefined);
}

public itemDelete() {
this.deleteFile.emit(this.fileItem);
}
Expand Down
8 changes: 4 additions & 4 deletions src/modules/grid/grid-column.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export class SkyGridColumnComponent {
@Input()
public isSortable: boolean = true;

/* tslint:disable */
/* tslint:disable:no-input-rename */
@Input('search')
private searchFunction: (value: any, searchText: string) => boolean = this.search;
public searchFunction: (value: any, searchText: string) => boolean = this.search;

@Input('template')
private templateInput: TemplateRef<any>;
/* tslint:enable */
public templateInput: TemplateRef<any>;
/* tslint:enable:no-input-rename */

@ContentChildren(TemplateRef)
private templates: QueryList<TemplateRef<any>>;
Expand Down
13 changes: 5 additions & 8 deletions src/modules/list-filters/list-filter-inline.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@ export class SkyListFilterInlineModel {
public name: string;
public value: any;
public defaultValue: any;

public filterFunction: (item: ListItemModel, filter: any) => boolean;

public onChange: EventEmitter<any> = new EventEmitter<any>();

public template: TemplateRef<any>;

public changed(value: any) {
this.value = value;
this.onChange.emit(value);
}

constructor(data?: any) {
if (data) {
this.name = data.name;
Expand All @@ -30,4 +22,9 @@ export class SkyListFilterInlineModel {
this.defaultValue = data.defaultValue;
}
}

public changed(value: any) {
this.value = value;
this.onChange.emit(value);
}
}
53 changes: 24 additions & 29 deletions src/modules/list-secondary-actions/list-secondary-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,40 +61,35 @@ describe('List Secondary Actions Component', () => {
// run detectChanges once more then begin tests
state.skip(1).take(1).subscribe(() => fixture.detectChanges());
}
it('should show secondary actions when specified', async(() => {
initializeToolbar();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();

/* tslint:disable */
let query =
'.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action';
/* tslint:enable */
expect(nativeElement.querySelector(query)).not.toBeNull();
});

}));

it('should hide secondary actions when no child actions available', fakeAsync(() => {
component.showOption = false;
initializeToolbar();
fixture.detectChanges();
tick();
it('should show secondary actions when specified', async(() => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are purely tab-related.

initializeToolbar();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
/* tslint:disable */

/* tslint:disable:max-line-length */
let query =
'.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions';
/* tslint:enable */
'.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action';
/* tslint:enable:max-line-length */
expect(nativeElement.querySelector(query)).not.toBeNull();
});
}));

expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(true);
it('should hide secondary actions when no child actions available', fakeAsync(() => {
component.showOption = false;
initializeToolbar();
fixture.detectChanges();
tick();
fixture.detectChanges();

component.showOption = true;
fixture.detectChanges();
tick();
expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(false);
expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(true);

}));
component.showOption = true;
fixture.detectChanges();
tick();

});
expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(false);
}));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ describe('List View Checklist Component', () => {
expect(clearAllEl).toBeNull();

let toolbarSectionsEl = nativeElement.querySelectorAll('sky-toolbar-section');
expect(toolbarSectionsEl.item(1).attributes['hidden']).not.toBeUndefined();
expect((toolbarSectionsEl.item(1) as any).attributes['hidden']).not.toBeUndefined();

}));

Expand Down
10 changes: 2 additions & 8 deletions src/modules/list/list-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ import {
} from '@angular/core';

import { ListState } from './state';

import { SkyListComponent } from '../list/list.component';
import {
BehaviorSubject
} from 'rxjs/BehaviorSubject';

import {
Observable
} from 'rxjs/Observable';

let moment = require('moment');
const moment = require('moment');

export abstract class ListViewComponent implements OnDestroy {
public active: Observable<boolean>;
Expand All @@ -23,9 +20,6 @@ export abstract class ListViewComponent implements OnDestroy {
protected subscriptions: Array<any> = [];
protected hasToolbar: Observable<boolean>;

/* tslint:disable */
private initialized: BehaviorSubject<boolean> = new BehaviorSubject(false);
/* tslint:enable */
private viewId: string = moment().toDate().getTime().toString();

constructor(state: ListState, defaultName: string) {
Expand Down
8 changes: 3 additions & 5 deletions src/modules/list/list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ describe('List Component', () => {

describe('models and state', () => {
it('should handle no data passed to constructor', () => {
let item = new ListFilterModel();
new ListFilterModel();
});
});
});
Expand Down Expand Up @@ -820,8 +820,7 @@ describe('List Component', () => {
fixture: any,
dataProvider: SkyListInMemoryDataProvider,
nativeElement: HTMLElement,
element: DebugElement,
bs: BehaviorSubject<any>;
element: DebugElement;

beforeEach(async(() => {
dispatcher = new ListStateDispatcher();
Expand Down Expand Up @@ -882,8 +881,7 @@ describe('List Component', () => {
component: ListTestComponent,
fixture: any,
nativeElement: HTMLElement,
element: DebugElement,
bs: BehaviorSubject<any>;
element: DebugElement;

beforeEach(async(() => {
dispatcher = new ListStateDispatcher();
Expand Down
6 changes: 2 additions & 4 deletions src/modules/modal/modal-host.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
EventEmitter,
Injectable
EventEmitter
} from '@angular/core';

@Injectable()
export class SkyModalHostService {
public static get openModalCount(): number {
return SkyModalHostService.modalHosts.length;
Expand Down Expand Up @@ -31,7 +29,7 @@ export class SkyModalHostService {
public close = new EventEmitter<void>();
public openHelp = new EventEmitter<any>();

public constructor(private fullPage: boolean) {
constructor(private fullPage: boolean) {
SkyModalHostService.modalHosts.push(this);
}

Expand Down
16 changes: 8 additions & 8 deletions src/modules/modal/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ let skyModalUniqueIdentifier: number = 0;
})
export class SkyModalComponent implements AfterViewInit {
public modalState = 'in';

public modalContentId: string = 'sky-modal-content-id-' + skyModalUniqueIdentifier.toString();
public modalHeaderId: string = 'sky-modal-header-id-' + skyModalUniqueIdentifier.toString();

Expand Down Expand Up @@ -87,6 +86,14 @@ export class SkyModalComponent implements AfterViewInit {
return this.config.helpKey;
}

constructor(
private hostService: SkyModalHostService,
private config: SkyModalConfiguration,
private elRef: ElementRef,
private windowRef: SkyWindowRefService,
private componentAdapter: SkyModalComponentAdapterService
) { }

@HostListener('document:keydown', ['$event'])
public onDocumentKeyDown(event: KeyboardEvent) {
/* istanbul ignore else */
Expand Down Expand Up @@ -131,13 +138,6 @@ export class SkyModalComponent implements AfterViewInit {
}
}

constructor(
private hostService: SkyModalHostService,
private config: SkyModalConfiguration,
private elRef: ElementRef,
private windowRef: SkyWindowRefService,
private componentAdapter: SkyModalComponentAdapterService) { }

public ngAfterViewInit() {
skyModalUniqueIdentifier++;
this.componentAdapter.handleWindowChange(this.elRef);
Expand Down
11 changes: 6 additions & 5 deletions src/modules/tiles/tile-dashboard/tile-dashboard.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ describe('Tile dashboard service', () => {
}
);

/* tslint:disable-next-line:no-unused-variable */
let testDashboardService = new SkyTileDashboardService(
mockDragulaService,
mockMediaQueryService
);
(function () {
return new SkyTileDashboardService(
mockDragulaService,
mockMediaQueryService
);
}());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a self-invoking function to avoid having an "unused local":

const dashboardService = new SkyTileDashboardService();


expect(setOptionsSpy).toHaveBeenCalled();
});
Expand Down
Loading