Skip to content

Commit 9d0010e

Browse files
author
Eric Olkowski
committed
Fixed failing tests
1 parent 2b0f09a commit 9d0010e

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

packages/react-core/src/components/Alert/Alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
162162
}, [shouldDismiss, hasAnimations, isDismissed]);
163163

164164
React.useEffect(() => {
165-
const prefersReducedMotion = !window.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
166165
const handleOnTransitionEnd = (event: TransitionEvent) => {
166+
const prefersReducedMotion = !window.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
167167
const parentAlertGroupItem = getParentAlertGroupItem();
168168
if (
169169
parentAlertGroupItem?.contains(event.target as Node) &&

packages/react-core/src/components/Alert/AlertActionCloseButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export const AlertActionCloseButton: React.FunctionComponent<AlertActionCloseBut
4343
};
4444

4545
React.useEffect(() => {
46-
const prefersReducedMotion = !window.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
4746
const handleOnTransitionEnd = (event: TransitionEvent) => {
47+
const prefersReducedMotion = !window.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
4848
const parentAlertGroupItem = getParentAlertGroupItem();
4949
if (
5050
shouldDismissOnTransition &&

packages/react-core/src/components/Alert/__tests__/AlertGroup.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test('alertgroup closes when alerts are closed', async () => {
7373
const user = userEvent.setup();
7474

7575
render(
76-
<AlertGroup isToast appendTo={document.body}>
76+
<AlertGroup hasAnimations={false} isToast appendTo={document.body}>
7777
<Alert
7878
isLiveRegion
7979
title={'Test Alert'}

packages/react-integration/demo-app-ts/src/components/demos/AlertGroupDemo/AlertGroupDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AlertGroupDemo extends React.Component<{}, AlertGroupDemoState> {
7373
</Button>
7474
</InputGroupItem>
7575
</InputGroup>
76-
<AlertGroup isToast>
76+
<AlertGroup hasAnimations={false} isToast>
7777
{this.state.alerts.map(({ title, variant, key }) => (
7878
<Alert
7979
isLiveRegion

packages/react-integration/demo-app-ts/src/components/demos/AlertGroupDemo/AlertGroupTimeoutFromBottomDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const AlertGroupTimeoutFromBottomDemo: React.FunctionComponent = () => {
3737
<Button variant="secondary" onClick={onClick}>
3838
Add alert
3939
</Button>
40-
<AlertGroup>{alerts}</AlertGroup>
40+
<AlertGroup hasAnimations={false}>{alerts}</AlertGroup>
4141
</>
4242
);
4343
};

0 commit comments

Comments
 (0)