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

Commit

Permalink
Fixed lint errors (and brought Time Picker coverage to 100%) (#741)
Browse files Browse the repository at this point in the history
* Fixed lint errors

* Removed unnecessary checks

* Made inlineFilters public

* Made active property public
  • Loading branch information
Blackbaud-SteveBrush authored May 31, 2017
1 parent 0594c37 commit bebc014
Show file tree
Hide file tree
Showing 30 changed files with 75 additions and 72 deletions.
3 changes: 2 additions & 1 deletion config/wdio/ci.wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
.getVisualRegression(
'webdriver-screenshots',
'webdriver-screenshots-screen',
'webdriver-screenshots-diffs');
'webdriver-screenshots-diffs'
);

config.onPrepare = server.startCI;
config.onComplete = server.stopCI;
Expand Down
8 changes: 4 additions & 4 deletions config/wdio/local-browserstack.wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@

shared.visualRegression = require('../utils/visual-browser-commands')
.getVisualRegression(
'webdriver-screenshotslocal',
'webdriver-screenshotslocal-screen',
'webdriver-screenshotslocal-diffs'
);
'webdriver-screenshotslocal',
'webdriver-screenshotslocal-screen',
'webdriver-screenshotslocal-diffs'
);

shared.onPrepare = server.startCI;
shared.onComplete = server.stopCI;
Expand Down
9 changes: 5 additions & 4 deletions config/wdio/local.wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
];

config.visualRegression = require('../utils/visual-browser-commands')
.getVisualRegression(
'webdriver-screenshotslocal',
'webdriver-screenshotslocal-screen',
'webdriver-screenshotslocal-diffs');
.getVisualRegression(
'webdriver-screenshotslocal',
'webdriver-screenshotslocal-screen',
'webdriver-screenshotslocal-diffs'
);
config.onPrepare = server.start;
config.onComplete = server.stop;

Expand Down
6 changes: 2 additions & 4 deletions config/wdio/shared.wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
var timestamp;
module.exports = {
specs: [
'src/modules/**/*.visual-spec.js'
'src/modules/**/*.visual-spec.js'
],
logLevel: 'silent',
baseUrl: 'http://localhost:3000',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 200000,
expectationResultHandler: function () {

}
expectationResultHandler: function () { }
},
waitforTimeout: 3000,
services: [
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/shared/demo-page-plunker-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,5 @@ export class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);`
}
];
};
}
}
12 changes: 5 additions & 7 deletions src/app/components/timepicker/timepicker-demo.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<h3>12hour timepicker.</h3>
<h3>12-hour timepicker</h3>
<div style="max-width: 400px">
<sky-timepicker #timePickerExample1>
<input type="text" [skyTimepickerInput]="timePickerExample1" [timeFormat]="format12" [(ngModel)]="selectedTime1" #time="ngModel"
/>
<input type="text" [skyTimepickerInput]="timePickerExample1" [timeFormat]="format12" [(ngModel)]="selectedTime1" #time="ngModel" />
</sky-timepicker>
<div class="sky-error-label" *ngIf="time.errors && time.errors.skyTime && (time.dirty || time.touched)">
<div [hidden]="!time.errors.skyTime.invalid" >
Expand All @@ -11,8 +10,7 @@ <h3>12hour timepicker.</h3>
</div>
</div>
<div>

Selected time is {{selectedTime1.local}}
Selected time is {{selectedTime1?.local}}
</div>
<br/>
<h3>24-hour timepicker.</h3>
Expand All @@ -28,7 +26,7 @@ <h3>24-hour timepicker.</h3>
</div>
</div>
<div>
Selected time is {{selectedTime2.hour}}:{{selectedTime2.minute}}
Selected time is {{selectedTime2?.hour}}:{{selectedTime2?.minute}}
</div>
<br/>
<h3>Custom timepicker.</h3>
Expand All @@ -42,6 +40,6 @@ <h3>Custom timepicker.</h3>
Please enter a valid time.
</div>
</div>
Selected time is {{selectedTime3.local}}
Selected time is {{selectedTime3?.local}}
</div>
<br/>
15 changes: 12 additions & 3 deletions src/app/components/timepicker/timepicker-demo.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Component } from '@angular/core';

import { SkyWindowRefService } from '../../../modules/window';

@Component({
selector: 'sky-timepicker-demo',
templateUrl: './timepicker-demo.component.html'
Expand All @@ -8,7 +10,14 @@ export class SkyTimePickerDemoComponent {
public format12 = 'hh';
public format24 = 'HH';
public returnFormat = 'HH:mm:ssZ';
public selectedTime1 = '8:30 PM';
public selectedTime2 = '20:30';
public selectedTime3 = '02:00:00-0400';
public selectedTime1: any = '8:30 PM';
public selectedTime2: any = '20:30';
public selectedTime3: any = '02:00:00-0400';

public constructor(
private windowObj: SkyWindowRefService) { }

public alert(event: any) {
this.windowObj.getWindow().alert(event);
}
}
3 changes: 2 additions & 1 deletion src/app/components/wizard/wizard-demo-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export class SkyWizardDemoFormComponent {
return this.step2Disabled || !this.requiredValue2;
}

constructor(private instance: SkyModalInstance) { }
constructor(
public instance: SkyModalInstance) { }

public validateStep1() {
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/app/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SKY UX 2 is an updated version of Blackbaud's UX framework. The framework brings a consistent, cohesive experience to Blackbaud products and allows third-party developers to provide the same consistent experience in their customizations and applications. SKY UX 2 takes advantage of updates to <a href="https://angular.io/">Angular</a> to keep SKY UX modern while increasing the tooling, testing, and performance available.
</p>
</stache-page-summary>
<sky-alert [alertType]="warning" [closeable]="false">
<p>To follow the development of SKY UX and make contributions, see <a href="https://github.com/blackbaud/skyux2">the SKY UX 2 GitHub repo</a>. The SKY UX 2 documentation lives alongside the components in the repo, so you can contribute to the documentation there as well. For information about how to contribute, see <a href="https://github.com/blackbaud/skyux2/blob/master/CONTRIBUTING.md">the contribution guidelines</a>.</p>
<sky-alert alertType="warning" [closeable]="false">
<p>To follow along with the development of SKY UX and to make contributions, see <a href="https://github.com/blackbaud/skyux2">the SKY UX 2 GitHub repo</a>. The SKY UX 2 documentation lives alongside the components in the repo, so you can contribute to the documentation there as well. For information about how to contribute, see <a href="https://github.com/blackbaud/skyux2/blob/master/CONTRIBUTING.md">the SKY UX 2 contribution guidelines</a>.</p>
</sky-alert>
</stache>
</stache>
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export {
} from './modules/tiles';
export {
SkyTimepickerComponent
} from './modules/timepicker'
} from './modules/timepicker';
export {
SkyToolbarComponent,
SkyToolbarItemComponent,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class SkyAlertComponent {
@Input()
public set alertType(value: string) {
this._alertType = value;
};
}

public get alertType() {
return this._alertType || ALERT_TYPE_DEFAULT;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/card/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class SkyCardComponent implements AfterContentInit, OnDestroy {
this.selected = !this.selected;
this.selectedChange.emit(this.selected);
}
};
}

public ngOnDestroy() {
/* istanbul ignore else */
Expand Down
2 changes: 1 addition & 1 deletion src/modules/datepicker/datepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class SkyDatepickerInputDirective implements

public registerOnTouched(fn: () => any): void { this._onTouched = fn; }

public registerOnValidatorChange(fn: () => void): void { this._validatorChange = fn; };
public registerOnValidatorChange(fn: () => void): void { this._validatorChange = fn; }

public writeValue(value: any) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ import { SkyDefinitionListService } from './definition-list.service';
export class SkyDefinitionListLabelComponent {
public labelWidth: number;

constructor(private service: SkyDefinitionListService) { }
constructor(
public service: SkyDefinitionListService) { }
}
2 changes: 1 addition & 1 deletion src/modules/dropdown/dropdown-adapter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class SkyDropdownAdapterService {
topLeftVal,
heightVal,
widthVal,
overflowVal,
overflowVal
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/error/error.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class SkyErrorComponent implements OnInit {
public set errorType(value: string) {
this._errorType = value;
this.setErrorTypeFields();
};
}

public get errorType() {
return this._errorType;
Expand Down
3 changes: 1 addition & 2 deletions src/modules/fileattachments/file-drop.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
TestBed,
ComponentFixture

} from '@angular/core/testing';

import {
Expand Down Expand Up @@ -142,7 +141,7 @@ describe('File drop component', () => {
let errorCallbacks: Function[] = [];
let abortCallbacks: Function[] = [];

spyOn(window, 'FileReader').and.returnValue({
spyOn((window as any), 'FileReader').and.returnValue({
readAsDataURL: function(file: any) {

},
Expand Down
2 changes: 1 addition & 1 deletion src/modules/grid/fixtures/grid.component.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ export class GridTestComponent {
this.searchedData = data;
this.searchText = searchText;
return true;
};
}
}
3 changes: 1 addition & 2 deletions src/modules/list-filters/list-filter-inline.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ import {
templateUrl: './list-filter-inline.component.html'
})
export class SkyListFilterInlineComponent implements AfterContentInit {
public inlineFilters: Array<SkyListFilterInlineModel> = [];

@ContentChildren(SkyListFilterInlineItemComponent)
private filters: QueryList<SkyListFilterInlineItemComponent>;

private inlineFilters: Array<SkyListFilterInlineModel> = [];

constructor(
private ref: ChangeDetectorRef,
private state: ListState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export class ListToolbarConfigSetSortSelectorEnabledAction {
constructor(public enabled: true) {}
constructor(public enabled: boolean = true) {}
}
2 changes: 1 addition & 1 deletion src/modules/list/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getData(item: any, selector: string): any {

if (result === item) {
return undefined;
};
}

return result;
}
Expand Down
3 changes: 2 additions & 1 deletion src/modules/list/list-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import {
let moment = require('moment');

export abstract class ListViewComponent implements OnDestroy {
public active: Observable<boolean>;

protected viewName: string;
protected state: ListState;
protected list: SkyListComponent;
protected subscriptions: Array<any> = [];
protected active: Observable<boolean>;
protected hasToolbar: Observable<boolean>;

/* tslint:disable */
Expand Down
5 changes: 3 additions & 2 deletions src/modules/list/state/items/items.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {
describe('list items', () => {
describe('list item model', () => {
it('should throw an error when initializing without an id', () => {
expect(function () { new ListItemModel(undefined, 'something'); })
.toThrow(new Error('All list item models require an ID'));
expect(function () {
return new ListItemModel(undefined, 'something');
}).toThrow(new Error('All list item models require an ID'));
});

it('should not set data when data is undefined', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/modal/modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class SkyModalService {

// Open Overloads
public open(component: any, providers?: any[]): SkyModalInstance;
public open(component: any, config?: IConfig): SkyModalInstance
public open(component: any, config?: IConfig): SkyModalInstance;

// Open Method
public open(): SkyModalInstance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class AppComponent {

public get itemsToShow(): string {
return this._itemsToShow;
};
}

public set itemsToShow(value: string) {
let itemsToShow = value.split(',');
Expand Down
2 changes: 1 addition & 1 deletion src/modules/tabs/tab-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class SkyTabButtonComponent {
public tabHeading: string;

@Input()
public tabHeaderCount: string;
public tabHeaderCount: number;

@Input()
public tabStyle: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="sky-text-expand-repeater">
<ul class="sky-text-expand-repeater-container" (transitionend)="animationEnd()" #container>
<li *ngFor="let data of _data" class="sky-text-expand-repeater-item">
{{data}}
<li *ngFor="let item of contentItems" class="sky-text-expand-repeater-item">
{{item}}
</li>
</ul>
<button type="button" class="sky-btn sky-btn-link-inline sky-text-expand-repeater-see-more" *ngIf="expandable" (click)="repeaterExpand()">
Expand Down
19 changes: 10 additions & 9 deletions src/modules/text-expand-repeater/text-expand-repeater.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export class SkyTextExpandRepeaterComponent implements AfterViewInit {
this.setup(value);
}
public buttonText: string;
private _data: Array<any>;
public contentItems: Array<any>;
public expandable: boolean;

private seeMoreText: string = this.resources.getString('text_expand_see_more');
private seeLessText: string = this.resources.getString('text_expand_see_less');
private isExpanded: boolean = false;
private expandable: boolean;
@ViewChild('container')
private containerEl: ElementRef;
private items: Array<HTMLElement>;
Expand All @@ -41,9 +42,9 @@ export class SkyTextExpandRepeaterComponent implements AfterViewInit {
private textExpandRepeaterAdapter: SkyTextExpandRepeaterAdapterService) { }

public ngAfterViewInit() {
if (this._data) {
if (this.contentItems) {
this.items = this.textExpandRepeaterAdapter.getItems(this.elRef);
for (let i = this.maxItems; i < this._data.length; i++) {
for (let i = this.maxItems; i < this.contentItems.length; i++) {
this.textExpandRepeaterAdapter.hideItem(this.items[i]);
}
}
Expand All @@ -52,7 +53,7 @@ export class SkyTextExpandRepeaterComponent implements AfterViewInit {
public animationEnd() {
// Ensure the correct items are displayed
if (!this.isExpanded) {
for (let i = this.maxItems; i < this._data.length; i++) {
for (let i = this.maxItems; i < this.contentItems.length; i++) {
this.textExpandRepeaterAdapter.hideItem(this.items[i]);
}
}
Expand All @@ -64,7 +65,7 @@ export class SkyTextExpandRepeaterComponent implements AfterViewInit {
let adapter = this.textExpandRepeaterAdapter;
let container = this.containerEl;
let currentHeight = adapter.getContainerHeight(container);
for (let i = this.maxItems; i < this._data.length; i++) {
for (let i = this.maxItems; i < this.contentItems.length; i++) {
if (this.isExpanded) {
adapter.hideItem(this.items[i]);
} else {
Expand All @@ -80,7 +81,7 @@ export class SkyTextExpandRepeaterComponent implements AfterViewInit {
if (newHeight < currentHeight) {
// The new text is smaller than the old text, so put the old text back before doing
// the collapse animation to avoid showing a big chunk of whitespace.
for (let i = this.maxItems; i < this._data.length; i++) {
for (let i = this.maxItems; i < this.contentItems.length; i++) {
adapter.showItem(this.items[i]);
}
}
Expand All @@ -103,9 +104,9 @@ export class SkyTextExpandRepeaterComponent implements AfterViewInit {
} else {
this.expandable = false;
}
this._data = value;
this.contentItems = value;
} else {
this._data = undefined;
this.contentItems = undefined;
this.expandable = false;
}
}
Expand Down
Loading

0 comments on commit bebc014

Please sign in to comment.