Skip to content

Commit f607936

Browse files
Merge branch '18.0.x' of https://github.com/IgniteUI/igniteui-angular into ganastasov/fix-14187-18.0.x
2 parents 02aad71 + a767f0e commit f607936

File tree

15 files changed

+288
-111
lines changed

15 files changed

+288
-111
lines changed

projects/igniteui-angular/migrations/update-18_0_0/index.spec.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe(`Update to ${version}`, () => {
1919
options: {
2020
styles: [
2121
"/testSrc/styles.scss"
22-
]
22+
] as (string | object)[]
2323
}
2424
}
2525
}
@@ -450,6 +450,36 @@ describe(`Update to ${version}`, () => {
450450
);
451451
});
452452

453+
it('should add default CSS rule to set all components to their previous Large defaults with complex file ref configs', async () => {
454+
const _configJson = JSON.parse(appTree.readContent('/angular.json'));
455+
_configJson.projects.testProj.architect.build.options.styles = [{ input: '/testSrc/styles.scss' }];
456+
appTree.overwrite('/angular.json', JSON.stringify(_configJson));
457+
458+
const tree = await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
459+
expect(tree.readContent('/testSrc/styles.scss')).toEqual(
460+
`
461+
@use "mockStyles.scss";
462+
@forward something;
463+
// Specifies large size for all components to match the previous defaults
464+
// This may not be needed for your project. Please consult https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/update-guide for more details.
465+
:root {
466+
--ig-size: var(--ig-size-large);
467+
}
468+
`
469+
);
470+
});
471+
472+
it('should not throw when applying default CSS rule with complex file ref configs', async () => {
473+
const _configJson = JSON.parse(appTree.readContent('/angular.json'));
474+
_configJson.projects.testProj.architect.build.options.styles = [{ notInput: '/testSrc/styles.scss' }];
475+
appTree.overwrite('/angular.json', JSON.stringify(_configJson));
476+
try {
477+
await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
478+
} catch (e) {
479+
fail(e);
480+
}
481+
});
482+
453483
it('should rename the $active-item-color property to the $icon-selected-color', async () => {
454484
appTree.create(
455485
`/testSrc/appPrefix/component/test.component.scss`,

projects/igniteui-angular/migrations/update-18_0_0/index.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Rule, SchematicContext, SchematicsException, Tree } from "@angular-devkit/schematics";
2-
import { FileChange, findElementNodes, getAttribute, getSourceOffset, hasAttribute, parseFile } from '../common/util';
2+
import { FileChange, findElementNodes, getAttribute, getProjects, getSourceOffset, getWorkspace, hasAttribute, parseFile } from '../common/util';
33
import { nativeImport } from 'igniteui-angular/migrations/common/import-helper.js';
44
import type { Element } from '@angular/compiler';
55
import { BoundPropertyObject, InputPropertyType, UpdateChanges } from "../common/UpdateChanges";
@@ -78,16 +78,26 @@ export default (): Rule => async (host: Tree, context: SchematicContext) => {
7878
});
7979

8080
const updateMainCSSFile = (host: Tree, context: SchematicContext): Tree => {
81-
const angularConfigBuffer = host.read('angular.json');
82-
if (!angularConfigBuffer) {
81+
const workspace = getWorkspace(host);
82+
if (!workspace) {
8383
throw new SchematicsException('Could not find angular.json');
8484
}
85-
const angularConfig = JSON.parse(angularConfigBuffer.toString('utf-8'));
8685

87-
for (const project of Object.values<any>(angularConfig.projects)) {
86+
const projects = getProjects(workspace);
87+
for (const project of projects) {
8888
const srcRoot = project.sourceRoot || project.root || '';
89-
const stylesPath = (project.architect?.build?.options?.styles?.filter(s => s.startsWith(srcRoot))[0]) as string;
90-
89+
const stylesPath = project.architect?.build?.options?.styles
90+
?.map((s) => {
91+
if (typeof s === 'string') {
92+
return s;
93+
}
94+
// ref - https://angular.dev/reference/configs/workspace-config#styles-and-scripts-configuration
95+
if (s instanceof Object && 'input' in s) {
96+
return s.input as string;
97+
}
98+
})
99+
.filter((s) => s?.startsWith(srcRoot))[0];
100+
91101
if (!stylesPath) {
92102
context.logger.error(`No styles file found in angular.json for project: ${project}`);
93103
}

projects/igniteui-angular/src/lib/directives/tooltip/tooltip-target.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
9999
*/
100100
@Input('igxTooltipTarget')
101101
public override set target(target: any) {
102-
if (target !== null && target !== '') {
102+
if (target instanceof IgxTooltipDirective) {
103103
this._target = target;
104104
}
105105
}

projects/igniteui-angular/src/lib/directives/tooltip/tooltip.directive.spec.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fakeAsync, TestBed, tick, flush, waitForAsync } from '@angular/core/testing';
22
import { By } from '@angular/platform-browser';
33
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
4-
import { IgxTooltipSingleTargetComponent, IgxTooltipMultipleTargetsComponent, IgxTooltipPlainStringComponent } from '../../test-utils/tooltip-components.spec';
4+
import { IgxTooltipSingleTargetComponent, IgxTooltipMultipleTargetsComponent, IgxTooltipPlainStringComponent, IgxTooltipWithToggleActionComponent } from '../../test-utils/tooltip-components.spec';
55
import { UIInteractions } from '../../test-utils/ui-interactions.spec';
66
import { configureTestSuite } from '../../test-utils/configure-suite';
77
import { HorizontalAlignment, VerticalAlignment, AutoPositionStrategy } from '../../services/public_api';
@@ -24,7 +24,8 @@ describe('IgxTooltip', () => {
2424
NoopAnimationsModule,
2525
IgxTooltipSingleTargetComponent,
2626
IgxTooltipMultipleTargetsComponent,
27-
IgxTooltipPlainStringComponent
27+
IgxTooltipPlainStringComponent,
28+
IgxTooltipWithToggleActionComponent
2829
]
2930
}).compileComponents();
3031
UIInteractions.clearOverlay();
@@ -554,6 +555,36 @@ describe('IgxTooltip', () => {
554555
verifyTooltipPosition(tooltipNativeElement, buttonOne, false);
555556
}));
556557
});
558+
559+
describe('Tooltip integration', () => {
560+
beforeEach(waitForAsync(() => {
561+
fix = TestBed.createComponent(IgxTooltipWithToggleActionComponent);
562+
fix.detectChanges();
563+
tooltipNativeElement = fix.debugElement.query(By.directive(IgxTooltipDirective)).nativeElement;
564+
tooltipTarget = fix.componentInstance.tooltipTarget as IgxTooltipTargetDirective;
565+
button = fix.debugElement.query(By.directive(IgxTooltipTargetDirective));
566+
}));
567+
568+
it('Correctly sets tooltip target when defined before igxToggleAction directive on same host - issue #14196', fakeAsync(() => {
569+
expect(tooltipTarget.target.element).toBe(tooltipNativeElement);
570+
expect(fix.componentInstance.toggleDir.collapsed).toBe(true);
571+
572+
hoverElement(button);
573+
flush();
574+
575+
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
576+
577+
UIInteractions.simulateClickEvent(button.nativeElement);
578+
fix.detectChanges();
579+
580+
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
581+
582+
UIInteractions.simulateClickEvent(button.nativeElement);
583+
fix.detectChanges();
584+
585+
expect(fix.componentInstance.toggleDir.collapsed).toBe(false);
586+
}));
587+
});
557588
});
558589

559590
const hoverElement = (element) => element.nativeElement.dispatchEvent(new MouseEvent('mouseenter'));

projects/igniteui-angular/src/lib/grids/common/events.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { IBaseSearchInfo } from '../../directives/text-highlight/text-highlight.
1010

1111
/** The event arguments when data from a grid is being copied. */
1212
export interface IGridClipboardEvent {
13-
/** `data` can be of any type and referes to the data that is being copied/stored to the clipboard */
13+
/** `data` can be of any type and refers to the data that is being copied/stored to the clipboard */
1414
data: any[];
1515
/**
16-
* `cancel` returns whether an external event has interepted the copying
17-
* If the value becomes "true", it returns/exits from the method, instanciating the interface
16+
* `cancel` returns whether an external event has intercepted the copying
17+
* If the value becomes "true", it returns/exits from the method, instantiating the interface
1818
*/
1919
cancel: boolean;
2020
}
@@ -67,7 +67,7 @@ export interface IGridEditDoneEventArgs extends IBaseEventArgs {
6767
rowData: any;
6868
/**
6969
* Represents the previous (before editing) value of the edited cell.
70-
* It's used when the event has been stoped/exited.
70+
* It's used when the event has been stopped/exited.
7171
*/
7272
oldValue: any;
7373
/**
@@ -93,7 +93,7 @@ export interface IGridEditDoneEventArgs extends IBaseEventArgs {
9393
owner?: GridType;
9494
/**
9595
* Optional
96-
* Indicates if the editing cosists of adding a new row
96+
* Indicates if the editing consists of adding a new row
9797
*/
9898
isAddRow?: boolean;
9999
/**
@@ -151,7 +151,7 @@ export interface IPinColumnEventArgs extends IBaseEventArgs {
151151
insertAtIndex: number;
152152
/**
153153
* Returns the actual pin state of the column.
154-
* If pinning/unpinning is succesfull, value of `isPinned` will change accordingly when read in the "-ing" and "-ed" event.
154+
* If pinning/unpinning is successful, value of `isPinned` will change accordingly when read in the "-ing" and "-ed" event.
155155
*/
156156
isPinned: boolean;
157157
}
@@ -160,7 +160,7 @@ export interface IPinColumnEventArgs extends IBaseEventArgs {
160160
* The event arguments before a column's pin state is changed.
161161
* `insertAtIndex`specifies at which index in the pinned/unpinned area the column is inserted.
162162
* Can be changed in the `columnPin` event.
163-
* `isPinned` returns the actual pin state of the column. When pinning/unpinning is succesfull,
163+
* `isPinned` returns the actual pin state of the column. When pinning/unpinning is successful,
164164
* the value of `isPinned` will change accordingly when read in the "-ing" and "-ed" event.
165165
*/
166166
export interface IPinColumnCancellableEventArgs extends IPinColumnEventArgs, CancelableEventArgs {
@@ -190,7 +190,7 @@ export interface IRowDataEventArgs extends IBaseEventArgs {
190190

191191
/** The event arguments when a column is being resized */
192192
export interface IColumnResizeEventArgs extends IBaseEventArgs {
193-
/** Represents the informantion of the column that is being resized */
193+
/** Represents the information of the column that is being resized */
194194
column: ColumnType;
195195
/** Represents the old width of the column before the resizing */
196196
prevWidth: string;
@@ -236,7 +236,7 @@ export interface IRowSelectionEventArgs extends CancelableEventArgs, IBaseEventA
236236
}
237237

238238
/**
239-
* The event arguments when the selection state of a column is being chaged
239+
* The event arguments when the selection state of a column is being changed
240240
* The event is cancelable
241241
*/
242242
export interface IColumnSelectionEventArgs extends CancelableEventArgs, IBaseEventArgs {
@@ -288,8 +288,8 @@ export interface IGridToolbarExportEventArgs extends IBaseEventArgs {
288288
*/
289289
options: IgxExporterOptionsBase;
290290
/**
291-
* `cancel` returns whether the event has been interepted and stopped
292-
* If the value becomes "true", it returns/exits from the method, instanciating the interface
291+
* `cancel` returns whether the event has been intercepted and stopped
292+
* If the value becomes "true", it returns/exits from the method, instantiating the interface
293293
*/
294294
cancel: boolean;
295295
}
@@ -298,7 +298,7 @@ export interface IGridToolbarExportEventArgs extends IBaseEventArgs {
298298
export interface IColumnMovingStartEventArgs extends IBaseEventArgs {
299299
/**
300300
* Represents the column that is being moved.
301-
* The `ColumnType` contains the informatoin (the grid it belongs to, css data, settings, etc.) of the column in its properties
301+
* The `ColumnType` contains the information (the grid it belongs to, css data, settings, etc.) of the column in its properties
302302
*/
303303
source: ColumnType;
304304
}
@@ -307,12 +307,12 @@ export interface IColumnMovingStartEventArgs extends IBaseEventArgs {
307307
export interface IColumnMovingEventArgs extends IBaseEventArgs {
308308
/**
309309
* Represents the column that is being moved.
310-
* The `ColumnType` contains the informatoin (the grid it belongs to, css data, settings, etc.) of the column in its properties
310+
* The `ColumnType` contains the information (the grid it belongs to, css data, settings, etc.) of the column in its properties
311311
*/
312312
source: ColumnType;
313313
/**
314-
* `cancel` returns whether the event has been interepted and stopped
315-
* If the value becomes "true", it returns/exits from the method, instanciating the interface
314+
* `cancel` returns whether the event has been intercepted and stopped
315+
* If the value becomes "true", it returns/exits from the method, instantiating the interface
316316
*/
317317
cancel: boolean;
318318
}
@@ -321,17 +321,17 @@ export interface IColumnMovingEventArgs extends IBaseEventArgs {
321321
export interface IColumnMovingEndEventArgs extends IBaseEventArgs {
322322
/**
323323
* The source of the event represents the column that is being moved.
324-
* The `ColumnType` contains the informatoin (the grid it belongs to, css data, settings, etc.) of the column in its properties
324+
* The `ColumnType` contains the information (the grid it belongs to, css data, settings, etc.) of the column in its properties
325325
*/
326326
source: ColumnType;
327327
/**
328328
* The target of the event represents the column, the source is being moved to.
329-
* The `ColumnType` contains the informatoin (the grid it belongs to, css data, settings, etc.) of the column in its properties
329+
* The `ColumnType` contains the information (the grid it belongs to, css data, settings, etc.) of the column in its properties
330330
*/
331331
target: ColumnType;
332332
/**
333-
* `cancel` returns whether the event has been interepted and stopped
334-
* If the value becomes "true", it returns/exits from the method, instanciating the interface
333+
* `cancel` returns whether the event has been intercepted and stopped
334+
* If the value becomes "true", it returns/exits from the method, instantiating the interface
335335
*/
336336
cancel: boolean;
337337
}
@@ -345,12 +345,12 @@ export interface IGridKeydownEventArgs extends IBaseEventArgs {
345345
targetType: GridKeydownTargetType;
346346
/** Represents the information and details of the object itself */
347347
target: any;
348-
/** Represents the original event, that occured. */
348+
/** Represents the original event, that occurred. */
349349
event: Event;
350350
/**
351351
* The event is cancelable
352-
* `cancel` returns whether the event has been interepted and stopped
353-
* If the value becomes "true", it returns/exits from the method, instanciating the interface
352+
* `cancel` returns whether the event has been intercepted and stopped
353+
* If the value becomes "true", it returns/exits from the method, instantiating the interface
354354
*/
355355
cancel: boolean;
356356
}
@@ -360,7 +360,7 @@ export interface ICellPosition {
360360
/** It returns the position (index) of the row, the cell is in */
361361
rowIndex: number;
362362
/**
363-
* It returns the position (index) of the colunm, the cell is in
363+
* It returns the position (index) of the column, the cell is in
364364
* Counts only the visible (non hidden) columns
365365
*/
366366
visibleColumnIndex: number;
@@ -391,7 +391,7 @@ export interface IRowDragStartEventArgs extends CancelableEventArgs, IBaseEventA
391391
dragElement: HTMLElement;
392392
}
393393

394-
/** Рepresents event arguments related to the row's expansion state being changed in a grid */
394+
/** Represents event arguments related to the row's expansion state being changed in a grid */
395395
export interface IRowToggleEventArgs extends IBaseEventArgs {
396396
/**
397397
* Represents the ID of the row that emitted the event (which state is changed)
@@ -406,13 +406,13 @@ export interface IRowToggleEventArgs extends IBaseEventArgs {
406406
expanded: boolean;
407407
/**
408408
* Optional
409-
* Represents the original event, that has triggered the expantion/collapse
409+
* Represents the original event, that has triggered the expansion/collapse
410410
*/
411411
event?: Event;
412412
/**
413413
* The event is cancelable
414-
* `cancel` returns whether the event has been interepted and stopped
415-
* If the value becomes "true", it returns/exits from the method, instanciating the interface
414+
* `cancel` returns whether the event has been intercepted and stopped
415+
* If the value becomes "true", it returns/exits from the method, instantiating the interface
416416
*/
417417
cancel: boolean;
418418
}
@@ -459,7 +459,7 @@ export interface IColumnToggledEventArgs extends IBaseEventArgs {
459459
checked: boolean;
460460
}
461461

462-
/** Emmited when the active node is changed */
462+
/** Emitted when the active node is changed */
463463
export interface IActiveNodeChangeEventArgs extends IBaseEventArgs {
464464
/** Represents the row index of the active node */
465465
row: number;
@@ -491,7 +491,7 @@ export interface ISortingEventArgs extends IBaseEventArgs, CancelableEventArgs {
491491
sortingExpressions?: ISortingExpression | Array<ISortingExpression>;
492492
/**
493493
* Optional
494-
* Represents the gouping expressions applied to the grid.
494+
* Represents the grouping expressions applied to the grid.
495495
* It can be a single grouping expression or an array of them
496496
* The expression contains information like the sorting expression and criteria by which the elements will be grouped
497497
*/
@@ -515,7 +515,7 @@ export interface IColumnVisibilityChangedEventArgs extends IBaseEventArgs {
515515
/** Represents the column the event originated from */
516516
column: any;
517517
/**
518-
* The new hidden state that the column will have, if operation is succesfull.
518+
* The new hidden state that the column will have, if operation is successful.
519519
* Will be `true` when hiding and `false` when showing.
520520
*/
521521
newValue: boolean;

0 commit comments

Comments
 (0)