Skip to content

Commit d9aa95b

Browse files
authored
Merge pull request #8877 from IgniteUI/sstoychev/eslint-errors
refactor(*): eslint errors, migrations
2 parents af069e3 + 54d5974 commit d9aa95b

17 files changed

+152
-49
lines changed

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
"version": "11.0.0",
9191
"description": "Updates Ignite UI for Angular from v10.2.x to v11.0.0",
9292
"factory": "./update-11_0_0"
93+
},
94+
"migration-19": {
95+
"version": "11.1.0",
96+
"description": "Updates Ignite UI for Angular from v11.0.x to v11.1.0",
97+
"factory": "./update-11_1_0"
9398
}
9499
}
95100
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "onToggle",
6+
"replaceWith": "collapsedChange",
7+
"owner": {
8+
"selector": "igx-splitter-pane",
9+
"type": "component"
10+
}
11+
}
12+
]
13+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import * as path from 'path';
2+
3+
import { EmptyTree } from '@angular-devkit/schematics';
4+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
5+
6+
describe('Update to 11.1.0', () => {
7+
let appTree: UnitTestTree;
8+
const runner = new SchematicTestRunner(
9+
'ig-migrate',
10+
path.join(__dirname, '../migration-collection.json')
11+
);
12+
const configJson = {
13+
defaultProject: 'testProj',
14+
projects: {
15+
testProj: {
16+
sourceRoot: '/testSrc',
17+
},
18+
},
19+
schematics: {
20+
'@schematics/angular:component': {
21+
prefix: 'appPrefix',
22+
},
23+
},
24+
};
25+
const migrationName = 'migration-19';
26+
27+
beforeEach(() => {
28+
appTree = new UnitTestTree(new EmptyTree());
29+
appTree.create('/angular.json', JSON.stringify(configJson));
30+
});
31+
32+
it('should replace onToggle with collapsedChange ', async () => {
33+
appTree.create(
34+
`/testSrc/appPrefix/component/splitter.component.html`,
35+
`<igx-splitter style='height: 30vh;' [type]='0'>
36+
<igx-splitter-pane (onToggle)="toggled()">
37+
</igx-splitter-pane>
38+
</igx-splitter>`
39+
);
40+
41+
const tree = await runner.runSchematicAsync(migrationName, {}, appTree)
42+
.toPromise();
43+
44+
expect(tree.readContent('/testSrc/appPrefix/component/splitter.component.html'))
45+
.toEqual(`<igx-splitter style='height: 30vh;' [type]='0'>
46+
<igx-splitter-pane (collapsedChange)="toggled()">
47+
</igx-splitter-pane>
48+
</igx-splitter>`);
49+
});
50+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {
2+
Rule,
3+
SchematicContext,
4+
Tree
5+
} from '@angular-devkit/schematics';
6+
import { UpdateChanges } from '../common/UpdateChanges';
7+
8+
const version = '11.1.0';
9+
10+
export default (): Rule => (host: Tree, context: SchematicContext) => {
11+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
12+
13+
const update = new UpdateChanges(__dirname, host, context);
14+
update.applyChanges();
15+
};

projects/igniteui-angular/src/lib/action-strip/action-strip.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class IgxActionStripTestingComponent {
206206

207207
public flag = false;
208208

209-
onIconClick() {
209+
public onIconClick() {
210210
this.flag = true;
211211
}
212212
}

projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class IgxActionStripComponent extends DisplayDensityBase implements After
129129
* @hidden
130130
* @internal
131131
*/
132-
public menuOverlaySettings: OverlaySettings = { scrollStrategy: new CloseScrollStrategy() };
132+
public menuOverlaySettings: OverlaySettings = { scrollStrategy: new CloseScrollStrategy() };
133133

134134
private _hidden = false;
135135

@@ -148,7 +148,7 @@ export class IgxActionStripComponent extends DisplayDensityBase implements After
148148
* @internal
149149
*/
150150
@HostBinding('style.display')
151-
get display(): string {
151+
public get display(): string {
152152
return this._hidden ? 'none' : 'flex';
153153
}
154154

@@ -159,7 +159,7 @@ export class IgxActionStripComponent extends DisplayDensityBase implements After
159159
* @internal
160160
*/
161161
@HostBinding('attr.class')
162-
get hostClasses(): string {
162+
public get hostClasses(): string {
163163
const classes = [this.getComponentDensityClass('igx-action-strip')];
164164
// The custom classes should be at the end.
165165
if (!classes.includes('igx-action-strip')) {
@@ -185,38 +185,42 @@ export class IgxActionStripComponent extends DisplayDensityBase implements After
185185
}
186186
}
187187
});
188-
return [... this._menuItems.toArray(), ... actions];
188+
return [... this._menuItems.toArray(), ...actions];
189189
}
190190

191191
/**
192192
* @hidden
193193
* @internal
194194
*/
195-
ngAfterContentInit() {
195+
public ngAfterContentInit() {
196196
this.actionButtons.forEach(button => {
197197
button.strip = this;
198198
});
199-
this.actionButtons.changes.subscribe(change => {
199+
this.actionButtons.changes.subscribe(() => {
200200
this.actionButtons.forEach(button => {
201201
button.strip = this;
202202
});
203203
});
204204
}
205205

206-
ngAfterViewInit() {
206+
/**
207+
* @hidden
208+
* @internal
209+
*/
210+
public ngAfterViewInit() {
207211
this.menu.onSelection.subscribe(($event) => {
208212
const newSelection = ($event.newSelection as any).elementRef.nativeElement;
209213
let allButtons = [];
210-
this.actionButtons.forEach( actionButtons => {
214+
this.actionButtons.forEach(actionButtons => {
211215
if (actionButtons.asMenuItems) {
212-
allButtons = [... allButtons, ... actionButtons.buttons.toArray()];
216+
allButtons = [...allButtons, ...actionButtons.buttons.toArray()];
213217
}
214218
});
215219
const button = allButtons.find(x => newSelection.contains(x.container.nativeElement));
216220
if (button) {
217-
button.onActionClick.emit();
221+
button.actionClick.emit();
218222
}
219-
});
223+
});
220224
}
221225

222226
/**

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-action-button.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export class IgxGridActionButtonComponent {
1414
*
1515
* @example
1616
* ```html
17-
* <igx-grid-action-button (onActionClick)="startEdit($event)"></igx-grid-action-button>
17+
* <igx-grid-action-button (actionClick)="startEdit($event)"></igx-grid-action-button>
1818
* ```
1919
*/
2020
@Output()
21-
onActionClick = new EventEmitter<Event>();
21+
public actionClick = new EventEmitter<Event>();
2222

2323
/**
2424
* Reference to the current template.
@@ -48,7 +48,7 @@ export class IgxGridActionButtonComponent {
4848
public classNames: string;
4949

5050
/** @hidden @internal */
51-
get containerClass(): string {
51+
public get containerClass(): string {
5252
return 'igx-action-strip__menu-button ' + (this.classNames || '');
5353
}
5454

@@ -69,7 +69,7 @@ export class IgxGridActionButtonComponent {
6969
* @internal
7070
*/
7171
public handleClick(event) {
72-
this.onActionClick.emit(event);
72+
this.actionClick.emit(event);
7373
}
7474

7575
/**

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-actions-base.directive.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ export class IgxGridActionsBaseDirective implements AfterViewInit {
2121
* ```
2222
*/
2323
@Input()
24-
asMenuItems = false;
24+
public asMenuItems = false;
2525

2626
public strip: IgxActionStripComponent;
2727

2828
/**
2929
* @hidden
3030
* @internal
3131
*/
32-
get grid() {
32+
public get grid() {
3333
return this.strip.context.grid;
3434
}
3535

@@ -39,22 +39,22 @@ export class IgxGridActionsBaseDirective implements AfterViewInit {
3939
* @hidden
4040
* @internal
4141
*/
42-
get isRowContext(): boolean {
42+
public get isRowContext(): boolean {
4343
return this.isRow(this.strip.context) && !this.strip.context.inEditMode;
4444
}
4545

4646
constructor(protected iconService: IgxIconService,
47-
protected differs: IterableDiffers) { }
47+
protected differs: IterableDiffers) { }
4848

4949
/**
5050
* @hidden
5151
* @internal
5252
*/
53-
ngAfterViewInit() {
53+
public ngAfterViewInit() {
5454
if (this.asMenuItems) {
55-
this.buttons.changes.subscribe((change: QueryList<IgxGridActionButtonComponent>) => {
56-
this.strip.cdr.detectChanges();
57-
});
55+
this.buttons.changes.subscribe(() => {
56+
this.strip.cdr.detectChanges();
57+
});
5858
}
5959
}
6060

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
<ng-container *ngIf="isRowContext">
3-
<igx-grid-action-button *ngIf="!disabled" [asMenuItem]="asMenuItems" iconName="edit" [labelText]="grid.resourceStrings.igx_grid_actions_edit_label" (onActionClick)="startEdit($event)"></igx-grid-action-button>
4-
<igx-grid-action-button *ngIf="addRow && isRootRow" [asMenuItem]="asMenuItems" iconName="add-row" iconSet="imx-icons" [labelText]="grid.resourceStrings.igx_grid_actions_add_label" (onActionClick)="addRowHandler($event)"></igx-grid-action-button>
5-
<igx-grid-action-button *ngIf="addChild && hasChildren" [asMenuItem]="asMenuItems" iconName="add-child" iconSet="imx-icons" [labelText]="grid.resourceStrings.igx_grid_actions_add_child_label" (onActionClick)="addRowHandler($event, true)"></igx-grid-action-button>
6-
<igx-grid-action-button *ngIf="!disabled" class="igx-action-strip__delete" classNames='igx-action-strip__menu-item--danger' [asMenuItem]="asMenuItems" iconName="delete" [labelText]="grid.resourceStrings.igx_grid_actions_delete_label" (onActionClick)="deleteRow($event)"></igx-grid-action-button>
3+
<igx-grid-action-button *ngIf="!disabled" [asMenuItem]="asMenuItems" iconName="edit" [labelText]="grid.resourceStrings.igx_grid_actions_edit_label" (actionClick)="startEdit($event)"></igx-grid-action-button>
4+
<igx-grid-action-button *ngIf="addRow && isRootRow" [asMenuItem]="asMenuItems" iconName="add-row" iconSet="imx-icons" [labelText]="grid.resourceStrings.igx_grid_actions_add_label" (actionClick)="addRowHandler($event)"></igx-grid-action-button>
5+
<igx-grid-action-button *ngIf="addChild && hasChildren" [asMenuItem]="asMenuItems" iconName="add-child" iconSet="imx-icons" [labelText]="grid.resourceStrings.igx_grid_actions_add_child_label" (actionClick)="addRowHandler($event, true)"></igx-grid-action-button>
6+
<igx-grid-action-button *ngIf="!disabled" class="igx-action-strip__delete" classNames='igx-action-strip__menu-item--danger' [asMenuItem]="asMenuItems" iconName="delete" [labelText]="grid.resourceStrings.igx_grid_actions_delete_label" (actionClick)="deleteRow($event)"></igx-grid-action-button>
77
</ng-container>
88

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ class IgxActionStripTestingComponent implements OnInit {
246246
@ViewChild('grid', { read: IgxGridComponent, static: true })
247247
public grid: IgxGridComponent;
248248

249-
data: any[];
250-
columns: any[];
249+
private data: any[];
250+
private columns: any[];
251251

252-
ngOnInit() {
252+
public ngOnInit() {
253253

254254
this.columns = [
255255
{ field: 'ID', width: '200px', hidden: false },

0 commit comments

Comments
 (0)