48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { getMotionContainerPropsForNavigation, getMotionItemPropsForNavigation, STAGGER_FAST, FADE_UP } from '../motion';
|
|
|
|
describe('getMotionContainerPropsForNavigation', () => {
|
|
it('returns initial hidden for POP navigation', () => {
|
|
expect(getMotionContainerPropsForNavigation(true, STAGGER_FAST, 'POP')).toEqual({
|
|
variants: STAGGER_FAST,
|
|
initial: 'hidden',
|
|
animate: 'show',
|
|
});
|
|
});
|
|
|
|
it('skips initial animation for PUSH navigation', () => {
|
|
expect(getMotionContainerPropsForNavigation(true, STAGGER_FAST, 'PUSH')).toEqual({
|
|
variants: STAGGER_FAST,
|
|
initial: false,
|
|
animate: 'show',
|
|
});
|
|
});
|
|
|
|
it('disables motion when not enabled', () => {
|
|
expect(getMotionContainerPropsForNavigation(false, STAGGER_FAST, 'POP')).toEqual({
|
|
initial: false,
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('getMotionItemPropsForNavigation', () => {
|
|
it('returns animate props for POP navigation', () => {
|
|
expect(getMotionItemPropsForNavigation(true, FADE_UP, 'POP')).toEqual({
|
|
variants: FADE_UP,
|
|
initial: 'hidden',
|
|
animate: 'show',
|
|
});
|
|
});
|
|
|
|
it('skips initial animation for PUSH navigation', () => {
|
|
expect(getMotionItemPropsForNavigation(true, FADE_UP, 'PUSH')).toEqual({
|
|
variants: FADE_UP,
|
|
initial: false,
|
|
animate: 'show',
|
|
});
|
|
});
|
|
|
|
it('returns empty props when motion disabled', () => {
|
|
expect(getMotionItemPropsForNavigation(false, FADE_UP, 'POP')).toEqual({});
|
|
});
|
|
});
|