Skip to content

Commit 1e52ad5

Browse files
Merge pull request #15883 from IgniteUI/rivanova/fix-15848-master
fix(grid-validation): add open/close animations for error tooltip - 20.0.x
2 parents 906ac1f + b8f7d1c commit 1e52ad5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {
1+
import { useAnimation } from '@angular/animations';
2+
import {
23
ChangeDetectionStrategy,
34
ChangeDetectorRef,
45
Component,
@@ -52,6 +53,7 @@ import { IgxFocusDirective } from '../directives/focus/focus.directive';
5253
import { IgxInputDirective } from '../directives/input/input.directive';
5354
import { IgxInputGroupComponent } from '../input-group/input-group.component';
5455
import { IgxChipComponent } from '../chips/chip.component';
56+
import { fadeOut, scaleInCenter } from 'igniteui-angular/animations';
5557

5658
/**
5759
* Providing reference to `IgxGridCellComponent`:
@@ -883,7 +885,9 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
883885
modal: false,
884886
positionStrategy: new AutoPositionStrategy({
885887
horizontalStartPoint: HorizontalAlignment.Center,
886-
horizontalDirection: HorizontalAlignment.Center
888+
horizontalDirection: HorizontalAlignment.Center,
889+
openAnimation: useAnimation(scaleInCenter, { params: { duration: '150ms' } }),
890+
closeAnimation: useAnimation(fadeOut, { params: { duration: '75ms' } })
887891
})
888892
}
889893
);

projects/igniteui-angular/src/lib/grids/grid/grid-validation.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { UIInteractions } from '../../test-utils/ui-interactions.spec';
1717
import { IGridFormGroupCreatedEventArgs } from '../common/grid.interface';
1818
import { IgxTreeGridComponent } from '../tree-grid/tree-grid.component';
1919
import { IgxGridComponent } from './grid.component';
20+
import { AutoPositionStrategy, HorizontalAlignment, IgxOverlayService, VerticalAlignment } from '../../services/public_api';
2021

2122
describe('IgxGrid - Validation #grid', () => {
2223

@@ -187,6 +188,18 @@ describe('IgxGrid - Validation #grid', () => {
187188
const erorrMessage = cell.errorTooltip.first.elementRef.nativeElement.children[0].textContent;
188189
expect(erorrMessage).toEqual(' Entry should be at least 4 character(s) long ');
189190

191+
const overlayService = TestBed.inject(IgxOverlayService);
192+
const info = overlayService.getOverlayById(cell.errorTooltip.first.overlayId);
193+
const positionSettings = info.settings.positionStrategy.settings;
194+
195+
expect(info.settings.positionStrategy instanceof AutoPositionStrategy).toBe(true);
196+
expect(positionSettings.horizontalStartPoint).toEqual(HorizontalAlignment.Center);
197+
expect(positionSettings.horizontalDirection).toEqual(HorizontalAlignment.Center);
198+
expect(positionSettings.verticalStartPoint).toEqual(VerticalAlignment.Bottom);
199+
expect(positionSettings.verticalDirection).toEqual(VerticalAlignment.Bottom);
200+
expect(positionSettings.openAnimation.options.params).toEqual({ duration: '150ms' });
201+
expect(positionSettings.closeAnimation.options.params).toEqual({ duration: '75ms' });
202+
190203
cell.errorTooltip.first.close();
191204
tick();
192205
fixture.detectChanges();

0 commit comments

Comments
 (0)