diff --git a/packages/components/src/navigator/test/index.js b/packages/components/src/navigator/test/index.js new file mode 100644 index 00000000000000..3aa2840d0972fc --- /dev/null +++ b/packages/components/src/navigator/test/index.js @@ -0,0 +1,218 @@ +/** + * External dependencies + */ +import { render, screen, fireEvent } from '@testing-library/react'; + +/** + * Internal dependencies + */ +import { Navigator, NavigatorScreen, useNavigator } from '../'; + +jest.mock( 'framer-motion', () => { + const actual = jest.requireActual( 'framer-motion' ); + return { + __esModule: true, + ...actual, + AnimatePresence: ( { children } ) =>
{ children }
, + motion: { + ...actual.motion, + div: require( 'react' ).forwardRef( ( { children }, ref ) => ( +
{ children }
+ ) ), + }, + }; +} ); + +const PATHS = { + HOME: '/', + CHILD: '/child', + NOT_FOUND: '/not-found', +}; + +function NavigatorButton( { path, isBack = false, onClick, ...props } ) { + const navigator = useNavigator(); + return ( +