Skip to content

Commit

Permalink
Merge pull request #317 from josemarluedke/chore/disable-overlay
Browse files Browse the repository at this point in the history
chore: disable overlay transitions when running in tests
  • Loading branch information
josemarluedke authored Nov 6, 2024
2 parents 80778bc + ba6991e commit 5cbe54b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/overlays/src/components/overlay.gts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Portal, findParentPortal, type PortalSignature } from './portal';
import { getElementByAttribute } from '../-private/dom';
import type { ModifierLike } from '@glint/template';
import type { CssTransitionSignature } from 'ember-css-transitions/modifiers/css-transition';
import { isTesting, macroCondition } from '@embroider/macros';

function hasNestedPortals(element: HTMLElement): boolean {
const portal = findParentPortal(element);
Expand Down Expand Up @@ -204,7 +205,7 @@ class Overlay extends Component<OverlaySignature> {

setupContent = modifier((el: HTMLDivElement) => {
let transitionDuration = this.args.transitionDuration || 200;
if (this.args.disableTransitions === true) {
if (!this.isAnimationEnabled) {
transitionDuration = 0;
}
later(() => {
Expand Down Expand Up @@ -263,6 +264,9 @@ class Overlay extends Component<OverlaySignature> {
}

get isAnimationEnabled(): boolean {
if (macroCondition(isTesting())) {
return false;
}
return !(this.args.disableTransitions === true);
}

Expand Down

0 comments on commit 5cbe54b

Please sign in to comment.