Skip to content

Commit

Permalink
style: update code to pass object format lint rule change
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincharity committed May 9, 2019
1 parent 8648c3d commit 054f322
Show file tree
Hide file tree
Showing 90 changed files with 249 additions and 783 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"@semantic-release/github": "^5.2.10",
"@semantic-release/npm": "^5.1.4",
"@semantic-release/release-notes-generator": "^7.1.4",
"@terminus/eslint-config-frontend": "^1.0.2",
"@terminus/eslint-config-frontend": "^1.0.3",
"@terminus/tslint-config-frontend": "^1.0.3",
"@types/jest": "^23.3.13",
"@types/node": "^10.12.19",
Expand Down
66 changes: 14 additions & 52 deletions terminus-ui/autocomplete/src/autocomplete.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import {

describe(`TsAutocompleteComponent`, function() {
let component: TsAutocompleteComponent;
const opt1 = {
id: 1,
};
const opt1 = {id: 1};
let trigger: jest.Mocked<MatAutocompleteTrigger>;

beforeEach(() => {
Expand Down Expand Up @@ -150,11 +148,7 @@ describe(`TsAutocompleteComponent`, function() {
expect(component.selectedOptions.length).toEqual(0);

component.selectionsControl = new FormControl();
const initial = [{
id: 1,
}, {
id: 2,
}];
const initial = [{id: 1}, {id: 2}];
component.initialSelections = initial;

expect(component.selectedOptions.length).toEqual(2);
Expand All @@ -163,20 +157,12 @@ describe(`TsAutocompleteComponent`, function() {


test(`should not mutate the original array`, () => {
const initial = [{
id: 1,
}, {
id: 2,
}];
const initial = [{id: 1}, {id: 2}];
component.initialSelections = initial;
component.multiple = v => v.id;
const event: any = createMockInstance(MatAutocompleteSelectedEvent);
const option = {
id: 3,
};
event.option = {
value: option,
};
const option = {id: 3};
event.option = {value: option};
component.selectOption(event);

expect(component.selectedOptions).toContain(option);
Expand All @@ -190,9 +176,7 @@ describe(`TsAutocompleteComponent`, function() {

beforeEach(() => {
jest.useFakeTimers();
component.query = {
next: jest.fn(),
} as any;
component.query = {next: jest.fn()} as any;
});

afterEach(() => {
Expand Down Expand Up @@ -265,9 +249,7 @@ describe(`TsAutocompleteComponent`, function() {

describe(`selectOption`, () => {
const event: any = createMockInstance(MatAutocompleteSelectedEvent);
event.option = {
value: opt1,
};
event.option = {value: opt1};

beforeEach(() => {
component.selectionsControl = new FormControl();
Expand Down Expand Up @@ -338,9 +320,7 @@ describe(`TsAutocompleteComponent`, function() {
expect(component.selectedOptions).toEqual([opt1]);
expect(component.selectionsControl.value).toEqual([opt1]);

const result = component.deselectOption({
id: 2,
});
const result = component.deselectOption({id: 2});

expect(result).toEqual(undefined);
expect(component.selectedOptions).toEqual([opt1]);
Expand All @@ -366,19 +346,9 @@ describe(`TsAutocompleteComponent`, function() {


describe(`handleBlur`, () => {
const eventDiv = {
relatedTarget: {
nodeName: 'DIV',
},
} as any;
const eventOpt = {
relatedTarget: {
nodeName: 'MAT-OPTION',
},
} as any;
const eventNoNode = {
relatedTarget: {},
} as MouseEvent;
const eventDiv = {relatedTarget: {nodeName: 'DIV'}} as any;
const eventOpt = {relatedTarget: {nodeName: 'MAT-OPTION'}} as any;
const eventNoNode = {relatedTarget: {}} as MouseEvent;
const eventNoRelatedTarget = {} as KeyboardEvent;


Expand Down Expand Up @@ -431,11 +401,7 @@ describe(`TsAutocompleteComponent`, function() {
beforeEach(() => {
component.searchQuery = 'foo';
component.querySubject.next = jest.fn();
component.input = {
nativeElement: {
value: 'foo',
},
};
component.input = {nativeElement: {value: 'foo'}};
component['trigger'] = {
panelOpen: jest.fn().mockReturnValue(true),
closePanel: jest.fn(),
Expand Down Expand Up @@ -519,13 +485,9 @@ describe(`TsAutocompleteComponent`, function() {
component.ngAfterViewInit();
expect(component.selectedOptions).toEqual([]);

component.selectionsControl.setValue([{
id: 9,
}]);
component.selectionsControl.setValue([{id: 9}]);

expect(component.selectedOptions).toEqual([{
id: 9,
}]);
expect(component.selectedOptions).toEqual([{id: 9}]);
});


Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/autocomplete/src/autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ const DEFAULT_MINIMUM_CHARACTERS = 2;
selector: 'ts-autocomplete',
templateUrl: './autocomplete.component.html',
styleUrls: ['./autocomplete.component.scss'],
host: {
class: 'ts-autocomplete',
},
host: {class: 'ts-autocomplete'},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
exportAs: 'tsAutocomplete',
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/autofocus/src/autofocus.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe(`TsAutofocusDirective`, function() {
new ElementRefMock(),
new ChangeDetectorRefMock(),
);
directive['elementRef'].nativeElement = {
focus: jest.fn(),
};
directive['elementRef'].nativeElement = {focus: jest.fn()};
directive['changeDetectorRef'].detectChanges = jest.fn();
directive.tsAutofocus = '';
};
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/autofocus/src/autofocus.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import { coerceBooleanProperty } from '@terminus/ngx-tools/coercion';
*
* <example-url>https://getterminus.github.io/ui-demos-master/components/autofocus</example-url>
*/
@Directive({
selector: '[tsAutofocus]',
})
@Directive({selector: '[tsAutofocus]'})
export class TsAutofocusDirective implements AfterViewInit {
/**
* Store the shouldFocus value
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/button/src/button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ const DEFAULT_COLLAPSE_DELAY_MS = 4000;
selector: 'ts-button',
templateUrl: './button.component.html',
styleUrls: ['./button.component.scss'],
host: {
class: 'ts-button',
},
host: {class: 'ts-button'},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
exportAs: 'tsButton',
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/card/src/card-title.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import { TsStyleThemeTypes } from '@terminus/ui/utilities';
import { TsCardComponent } from './card.component';


@Directive({
selector: '[tsCardTitle]',
})
@Directive({selector: '[tsCardTitle]'})
export class TsCardTitleDirective {
/**
* Option to add a border to the header
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/card/src/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ let nextUniqueId = 0;
selector: 'ts-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss'],
host: {
class: 'ts-card',
},
host: {class: 'ts-card'},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
exportAs: 'tsCard',
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/chart/src/amcharts.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import {


const AM_CHARTS_TOKEN_MOCK = {
core: {
useTheme: jest.fn(),
},
core: {useTheme: jest.fn()},
themes: ['foo', null, 'bar'],
} as TsAmChartsToken;

Expand Down
44 changes: 11 additions & 33 deletions terminus-ui/chart/src/chart.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,57 +124,43 @@ describe(`ChartComponent`, function() {
describe(`chart type coercion`, function() {

test(`should validate xy chart`, function() {
const chart = {
className: 'XYChart',
} as TsChart;
const chart = {className: 'XYChart'} as TsChart;
expect(tsChartXYTypeCheck(chart)).toEqual(true);
});


test(`should validate pie chart`, function() {
const chart = {
className: 'PieChart',
} as TsChart;
const chart = {className: 'PieChart'} as TsChart;
expect(tsChartPieTypeCheck(chart)).toEqual(true);
});


test(`should validate map chart`, function() {
const chart = {
className: 'MapChart',
} as TsChart;
const chart = {className: 'MapChart'} as TsChart;
expect(tsChartMapTypeCheck(chart)).toEqual(true);
});


test(`should validate radar chart`, function() {
const chart = {
className: 'RadarChart',
} as TsChart;
const chart = {className: 'RadarChart'} as TsChart;
expect(tsChartRadarTypeCheck(chart)).toEqual(true);
});


test(`should validate tree chart`, function() {
const chart = {
className: 'TreeMap',
} as TsChart;
const chart = {className: 'TreeMap'} as TsChart;
expect(tsChartTreeTypeCheck(chart)).toEqual(true);
});


test(`should validate sankey chart`, function() {
const chart = {
className: 'SankeyDiagram',
} as TsChart;
const chart = {className: 'SankeyDiagram'} as TsChart;
expect(tsChartSankeyTypeCheck(chart)).toEqual(true);
});


test(`should validate chord chart`, function() {
const chart = {
className: 'ChordDiagram',
} as TsChart;
const chart = {className: 'ChordDiagram'} as TsChart;
expect(tsChartChordTypeCheck(chart)).toEqual(true);
});

Expand All @@ -194,9 +180,7 @@ class AmChartsServiceMock {
return {
core: {
create: jest.fn(() => ({
responsive: {
enabled: false,
},
responsive: {enabled: false},
dispose: jest.fn(),
})),
},
Expand All @@ -208,9 +192,7 @@ class AmChartsServiceMock {
SankeyDiagram: {},
ChordDiagram: {},
},
maps: {
MapChart: {},
},
maps: {MapChart: {}},
};
}
}
Expand Down Expand Up @@ -241,17 +223,13 @@ function createComponent<T>(component: Type<T>, providers: Provider[] = AM_CHART
* TEMPLATES
*/

@Component({
template: `<ts-chart></ts-chart>`,
})
@Component({template: `<ts-chart></ts-chart>`})
class SimpleHost {
@ViewChild(TsChartComponent)
public component: TsChartComponent;
}

@Component({
template: `<ts-chart [visualization]="visualization"></ts-chart>`,
})
@Component({template: `<ts-chart [visualization]="visualization"></ts-chart>`})
class VisualizationsHost {
public visualization: TsChartVisualizationOptions | undefined;

Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/chart/src/chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ export type TsChart
selector: 'ts-chart',
templateUrl: './chart.component.html',
styleUrls: ['./chart.component.scss'],
host: {
class: 'ts-chart',
},
host: {class: 'ts-chart'},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
exportAs: 'tsChart',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import { Subject } from 'rxjs';
selector: 'ts-confirmation-overlay',
styleUrls: ['./confirmation-overlay.component.scss'],
templateUrl: './confirmation-overlay.component.html',
host: {
class: 'ts-confirmation',
},
host: {class: 'ts-confirmation'},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
exportAs: 'tsConfirmation',
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/confirmation/src/confirmation.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export const allowedOverlayPositionTypes: TsConfirmationOverlayPositionTypes[] =
*/
@Directive({
selector: '[tsConfirmation]',
host: {
class: 'ts-confirmation',
},
host: {class: 'ts-confirmation'},
exportAs: 'tsConfirmation',
})
export class TsConfirmationDirective implements OnDestroy, OnInit {
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/copy/src/copy.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ describe(`TsCopyComponent`, function() {
addRange: noop,
});

component['document'].createRange = jest.fn().mockReturnValue({
selectNodeContents: noop,
});
component['document'].createRange = jest.fn().mockReturnValue({selectNodeContents: noop});
component.selectText(component.content.nativeElement, false, false);

expect(component['window'].getSelection).toHaveBeenCalled();
Expand Down
4 changes: 1 addition & 3 deletions terminus-ui/copy/src/copy.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import { TsStyleThemeTypes } from '@terminus/ui/utilities';
selector: 'ts-copy',
templateUrl: './copy.component.html',
styleUrls: ['./copy.component.scss'],
host: {
class: 'ts-copy',
},
host: {class: 'ts-copy'},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
exportAs: 'tsCopy',
Expand Down
Loading

0 comments on commit 054f322

Please sign in to comment.