Skip to content

Commit 28088aa

Browse files
fix(components/popovers)!: replace @angular/animations with CSS transitions (#4313)
BREAKING CHANGE `SkyPopoverComponent` has replaced `@angular/animations` with CSS transitions. Tests that interact with popovers may need to add `provideNoopSkyAnimations()` from `@skyux/core` to their `TestBed` providers to disable SKY UX CSS transitions during tests. ``` import { provideNoopSkyAnimations } from '@skyux/core'; TestBed.configureTestingModule({ providers: [provideNoopSkyAnimations()], }); ```
1 parent 88d7b0f commit 28088aa

File tree

16 files changed

+102
-125
lines changed

16 files changed

+102
-125
lines changed

libs/components/code-examples/src/lib/modules/popovers/popover/basic/example.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
22
import { ComponentFixture, TestBed } from '@angular/core/testing';
3-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
3+
import { provideNoopSkyAnimations } from '@skyux/core';
44
import { SkyPopoverAlignment, SkyPopoverPlacement } from '@skyux/popovers';
55
import { SkyPopoverHarness } from '@skyux/popovers/testing';
66

@@ -40,7 +40,8 @@ describe('Basic popover', () => {
4040

4141
beforeEach(() => {
4242
TestBed.configureTestingModule({
43-
imports: [PopoversPopoverBasicExampleComponent, NoopAnimationsModule],
43+
imports: [PopoversPopoverBasicExampleComponent],
44+
providers: [provideNoopSkyAnimations()],
4445
});
4546
});
4647

libs/components/datetime/src/lib/modules/datepicker/calendar/daypicker-cell.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
fakeAsync,
66
tick,
77
} from '@angular/core/testing';
8-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
98
import { SkyAppTestUtility, expect } from '@skyux-sdk/testing';
9+
import { provideNoopSkyAnimations } from '@skyux/core';
1010

1111
import { SkyDatepickerModule } from '../datepicker.module';
1212

@@ -81,8 +81,9 @@ describe('daypicker cell', () => {
8181
beforeEach(() => {
8282
TestBed.configureTestingModule({
8383
declarations: [],
84-
imports: [SkyDatepickerModule, NoopAnimationsModule],
84+
imports: [SkyDatepickerModule],
8585
providers: [
86+
provideNoopSkyAnimations(),
8687
{
8788
provide: SkyDatepickerCalendarInnerComponent,
8889
useValue: calendarInnerComponent,

libs/components/forms/src/lib/modules/input-box/input-box.component.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { AbstractControl } from '@angular/forms';
99
import { By } from '@angular/platform-browser';
1010
import { SkyAppTestUtility, expect, expectAsync } from '@skyux-sdk/testing';
11+
import { provideNoopSkyAnimations } from '@skyux/core';
1112
import {
1213
SkyHelpTestingController,
1314
SkyHelpTestingModule,
@@ -487,6 +488,7 @@ describe('Input box component', () => {
487488
TestBed.configureTestingModule({
488489
imports: [InputBoxFixturesModule, SkyHelpTestingModule],
489490
providers: [
491+
provideNoopSkyAnimations(),
490492
{
491493
provide: SkyThemeService,
492494
useValue: mockThemeSvc,
@@ -1193,6 +1195,7 @@ describe('Input box component', () => {
11931195
TestBed.configureTestingModule({
11941196
imports: [InputBoxFixturesModule],
11951197
providers: [
1198+
provideNoopSkyAnimations(),
11961199
{
11971200
provide: SkyThemeService,
11981201
useValue: mockThemeSvc,

libs/components/popovers/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
},
1717
"homepage": "https://github.com/blackbaud/skyux#readme",
1818
"peerDependencies": {
19-
"@angular/animations": "^21.2.0",
2019
"@angular/cdk": "^21.2.0",
2120
"@angular/common": "^21.2.0",
2221
"@angular/core": "^21.2.0",

libs/components/popovers/src/lib/modules/popover/fixtures/popover.component.fixture.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
AfterViewInit,
3-
Component,
4-
ElementRef,
5-
OnInit,
6-
ViewChild,
7-
} from '@angular/core';
1+
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
82

93
import { Subject } from 'rxjs';
104

@@ -22,7 +16,7 @@ import { SkyPopoverTrigger } from '../types/popover-trigger';
2216
styleUrls: ['./popover.component.fixture.scss'],
2317
standalone: false,
2418
})
25-
export class PopoverFixtureComponent implements OnInit, AfterViewInit {
19+
export class PopoverFixtureComponent implements AfterViewInit {
2620
//#region directive properties
2721

2822
public alignment: SkyPopoverAlignment | undefined;
@@ -74,12 +68,6 @@ export class PopoverFixtureComponent implements OnInit, AfterViewInit {
7468

7569
public popoverType: 'info' | 'danger' | undefined;
7670

77-
public ngOnInit(): void {
78-
if (this.popoverRef) {
79-
this.popoverRef.enableAnimations = false;
80-
}
81-
}
82-
8371
public ngAfterViewInit(): void {
8472
// Avoid expression changed after checked errors in unit tests.
8573
setTimeout(() => {
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { NgModule } from '@angular/core';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
2+
import { provideNoopSkyAnimations } from '@skyux/core';
33

44
import { SkyPopoverModule } from '../popover.module';
55

66
import { PopoverFixtureComponent } from './popover.component.fixture';
77

88
@NgModule({
9-
imports: [NoopAnimationsModule, SkyPopoverModule],
9+
imports: [SkyPopoverModule],
1010
exports: [PopoverFixtureComponent],
1111
declarations: [PopoverFixtureComponent],
12+
providers: [provideNoopSkyAnimations()],
1213
})
1314
export class PopoverFixturesModule {}

libs/components/popovers/src/lib/modules/popover/popover-animation-state.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

libs/components/popovers/src/lib/modules/popover/popover-animation.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

libs/components/popovers/src/lib/modules/popover/popover-content.component.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<div
22
#popoverRef
33
class="sky-popover-container sky-popover-max-height"
4-
[@.disabled]="!enableAnimations"
5-
[@skyPopoverAnimation]="animationState"
4+
skyTransitionEndHandler
5+
transitionPropertyToTrack="opacity"
66
[class.sky-popover-hidden]="!placement"
77
[ngClass]="[
88
'sky-popover-alignment-' + horizontalAlignment,
99
'sky-popover-placement-' + placement,
1010
'sky-popover-' + popoverType
1111
]"
12-
(@skyPopoverAnimation.done)="onAnimationEvent($event)"
13-
(@skyPopoverAnimation.start)="onAnimationEvent($event)"
12+
[class.sky-popover-visible]="isOpen()"
13+
[transitionTrigger]="isOpen()"
14+
(transitionEnd)="onAnimationsComplete()"
1415
>
1516
<div
1617
class="sky-popover"

libs/components/popovers/src/lib/modules/popover/popover-content.component.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ $popover-max-width: 276px;
2626
)
2727
)
2828
);
29+
opacity: 0;
30+
transition: opacity var(--sky-transition-time-short);
31+
32+
@starting-style {
33+
opacity: 0;
34+
}
35+
36+
&.sky-popover-visible {
37+
opacity: 1;
38+
transition-duration: var(--sky-transition-time-medium);
39+
}
2940

3041
&.sky-popover-hidden {
3142
visibility: hidden;

0 commit comments

Comments
 (0)