Skip to content

Commit

Permalink
revert: ref back of func
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Feb 11, 2025
1 parent 4494497 commit f387335
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/CSSMotion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { getTransitionName, supportTransition } from './util/motion';

export interface CSSMotionRef {
nativeElement: HTMLElement;
inMotion: boolean;
enableMotion: boolean;
inMotion: () => boolean;
enableMotion: () => boolean;
}

export type CSSMotionConfig =
Expand Down Expand Up @@ -173,11 +173,11 @@ export function genCSSMotion(config: CSSMotionConfig) {
},
inMotion: {
enumerable: true,
get: () => getStatus() !== STATUS_NONE,
get: () => () => getStatus() !== STATUS_NONE,
},
enableMotion: {
enumerable: true,
get: () => supportMotion,
get: () => () => supportMotion,
},
});
return obj;
Expand Down
6 changes: 3 additions & 3 deletions tests/StrictMode.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('StrictMode', () => {
</React.StrictMode>,
);

expect(ref.current.enableMotion).toBeTruthy();
expect(ref.current.enableMotion()).toBeTruthy();

const node = container.querySelector('.motion-box');
expect(node).toHaveClass('transition-appear', 'transition-appear-start');
Expand All @@ -52,15 +52,15 @@ describe('StrictMode', () => {
act(() => {
jest.runAllTimers();
});
expect(ref.current.inMotion).toBeTruthy();
expect(ref.current.inMotion()).toBeTruthy();
expect(node).not.toHaveClass('transition-appear-start');
expect(node).toHaveClass('transition-appear-active');

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

expect(ref.current.inMotion).toBeFalsy();
expect(ref.current.inMotion()).toBeFalsy();
expect(ref.current.nativeElement).toBe(node);
});
});

0 comments on commit f387335

Please sign in to comment.