react-native-cross-components
Version:
Beautiful React-Native components using RN Paper by Callstack
1 lines • 5.85 kB
Source Map (JSON)
{"file":"/Users/thomas/Source/react-native-core/source/components/modals/CrossBusyIndicator.test.tsx","mappings":";;;;;AAQA,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAC5B,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACpC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;AAV9C,kDAA0B;AAC1B,8EAAsE;AAGtE,8EAA+E;AAC/E,+CAAsD;AACtD,4EAAuC;AAMvC,SAAS,KAAK,CAAC,OAAyC;IACtD,MAAM,KAAK,mBACT,MAAM,EAAE,IAAI,EACZ,qBAAqB,EAAE,IAAI,EAC3B,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IACrC,OAAO,CACX,CAAC;IAEF,MAAM,OAAO,GAAG,6BAAY,CAAC,MAAM,CAAC,8BAAC,4BAAkB,oBAAK,KAAK,EAAI,CAAC,CAAC;IAEvE,OAAO;QACL,KAAK;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;YAC5B,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC5D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;gBAC/B,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE,KAAK;gBACb,qBAAqB,EA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AK,CAAC;gBACxB,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE,IAAI;gBACZ,qBAAqB,EAAE,IAAI;gBAC3B,QAAQ,EAAE,QAAQ;aACnB,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,+BAAgB,CAAC,CAAC;YACxD,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACtB,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC5D,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;gBACxB,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE,IAAI;gBACZ,qBAAqB,EAAE,IAAI;gBAC3B,UAAU,EAAE;oBACV,cAAc,EAAE,IAAI;iBACrB;aACF,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,4BAAK,CAAC;iBACzC,QAAQ,CAAC,CAAC,CAAsB,CAAC;YACpC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/source/components/modals/CrossBusyIndicator.test.tsx"],"sourcesContent":["import React from 'react';\nimport TestRenderer, { ReactTestInstance } from 'react-test-renderer';\nimport _ from 'lodash';\n\nimport CrossBusyIndicator, { IBusyIndicatorProps } from './CrossBusyIndicator';\nimport { TouchableOpacity, Text } from 'react-native';\nimport Modal from 'react-native-modal';\n\njest.unmock('react-native');\njest.unmock('./CrossBusyIndicator');\njest.mock('react-native-modal', () => 'View');\n\nfunction setup(options?: IBusyIndicatorProps | undefined) {\n const props: IBusyIndicatorProps = {\n isBusy: true,\n isCancelButtonVisible: true,\n type: 'BallIndicator',\n onCancel: () => console.log('Cancelled'),\n ...options,\n };\n\n const wrapper = TestRenderer.create(<CrossBusyIndicator {...props} />);\n\n return {\n props,\n wrapper,\n };\n}\n\ndescribe('components', () => {\n describe('<CrossBusyIndicator />', () => {\n it('Should render self and subcomponents', () => {\n const { wrapper } = setup();\n expect(wrapper.toJSON()).toMatchSnapshot();\n });\n\n it('Should not have <Modal /> when `isBusy` is `false`', () => {\n const { wrapper, props } = setup({\n type: 'DotIndicator',\n isBusy: false,\n isCancelButtonVisible: true,\n });\n expect(props.isBusy).toBeFalsy();\n\n const children = wrapper.root.findAllByProps({ visible: false });\n expect(children.length).toBe(0);\n });\n\n it('Should have <CrossSpinner /> of type \"DotIndicator\"', () => {\n const { wrapper } = setup({\n type: 'DotIndicator',\n isBusy: true,\n isCancelButtonVisible: true,\n });\n const child = wrapper.root.findByProps({\n type: 'DotIndicator',\n });\n expect(child).toBeDefined();\n });\n\n it('Should have <Text /> with value \"Cancel\"', () => {\n const { wrapper } = setup();\n const child = wrapper.root.findAllByType(Text).slice(-1)[0];\n expect(child.props.children).toBe('Cancel');\n });\n\n it('Cancel button onCancel should be called', () => {\n let called = false;\n const onCalled = () => (called = !called);\n\n const { wrapper } = setup({\n type: 'DotIndicator',\n isBusy: true,\n isCancelButtonVisible: true,\n onCancel: onCalled,\n });\n\n const child = wrapper.root.findByType(TouchableOpacity);\n child.props.onPress();\n expect(called).toBeTruthy();\n });\n\n it('Modal should have \"swipeDirection\" with value \"up\"', () => {\n const { wrapper } = setup({\n type: 'DotIndicator',\n isBusy: true,\n isCancelButtonVisible: true,\n modalProps: {\n swipeDirection: 'up',\n },\n });\n\n const child = wrapper.root.findByType(Modal)\n .children[0] as ReactTestInstance;\n expect(child.props.swipeDirection).toBe('up');\n });\n });\n});\n"],"version":3}