Skip to content

Commit 462d1ad

Browse files
committed
chore: more refs
1 parent b32f8f8 commit 462d1ad

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/CSSMotion.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import { getTransitionName, supportTransition } from './util/motion';
1818

1919
export interface CSSMotionRef {
2020
nativeElement: HTMLElement;
21-
inMotion: () => boolean;
21+
inMotion: boolean;
22+
enableMotion: boolean;
2223
}
2324

2425
export type CSSMotionConfig =
@@ -172,9 +173,11 @@ export function genCSSMotion(config: CSSMotionConfig) {
172173
},
173174
inMotion: {
174175
enumerable: true,
175-
get: () => {
176-
return () => getStatus() !== STATUS_NONE;
177-
},
176+
get: () => getStatus() !== STATUS_NONE,
177+
},
178+
enableMotion: {
179+
enumerable: true,
180+
get: () => supportMotion,
178181
},
179182
});
180183
return obj;

tests/StrictMode.spec.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ describe('StrictMode', () => {
5050
act(() => {
5151
jest.runAllTimers();
5252
});
53-
expect(ref.current.inMotion()).toBeTruthy();
53+
expect(ref.current.inMotion).toBeTruthy();
5454
expect(node).not.toHaveClass('transition-appear-start');
5555
expect(node).toHaveClass('transition-appear-active');
5656

5757
// Trigger End
5858
fireEvent.transitionEnd(node);
5959
expect(node).not.toHaveClass('transition-appear');
6060

61-
expect(ref.current.inMotion()).toBeFalsy();
61+
expect(ref.current.inMotion).toBeFalsy();
6262
expect(ref.current.nativeElement).toBe(node);
6363
});
6464
});

0 commit comments

Comments
 (0)