react-native-cross-components
Version:
Beautiful React-Native components using RN Paper by Callstack
1 lines • 7 kB
Source Map (JSON)
{"file":"/Users/thomas/Source/react-native-core/source/components/buttons/CrossButton.test.tsx","mappings":";;;;;AAsBA,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAC5B,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAvB7B,kDAA0B;AAC1B,gEAA+D;AAC/D,8EAA+C;AAC/C,yCAAsC;AAEtC,SAAS,KAAK,CACZ,QAAgB,EAChB,KAAW,EACX,IAAa,EACb,OAAoB;IAEpB,OAAO,6BAAY,CAAC,MAAM,CACxB,8BAAC,qBAAW,IACV,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,EAAE,EAAE,EAC7B,IAAI,EAAE,IAAI,IAAI,EAAE,GAChB,CACH,CAAC;AACJ,CAAC;AAKD,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;YAC7C,MAAM,SAAS,GAAsB,EAAE,CAAC;YACxC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;gBAC/B,MAAM,CAAC,SAAS,CAAC,CAAC,eAAe,EAAE,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;gBACxD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC;YAC1C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;YAC/D,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;gBACjC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBACtC,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OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;oBACrC,MAAM,EAAE,mBAAmB;iBAC5B,CAAC,CAAC;gBACH,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACtB,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/source/components/buttons/CrossButton.test.tsx"],"sourcesContent":["import React from 'react';\nimport CrossButton, { ICrossButtonProps } from './CrossButton';\nimport TestRenderer from 'react-test-renderer';\nimport { styles } from '../../styles';\n\nfunction setup(\n iconName: string,\n title?: any,\n size?: number,\n onPress?: () => void\n) {\n return TestRenderer.create(\n <CrossButton\n iconName={iconName}\n title={title}\n color='blue'\n onPress={onPress || jest.fn()}\n size={size || 64}\n />\n );\n}\n\njest.unmock('react-native');\njest.unmock('./CrossButton');\n\ndescribe('components', () => {\n describe('<CrossButton />', () => {\n describe('`ICrossButtonProps` interface', () => {\n const propsMock: ICrossButtonProps = {};\n it('Should match snapshot', () => {\n expect(propsMock).toMatchSnapshot();\n });\n\n it('Should have `color` property that is undefined', () => {\n expect(propsMock.color).toBeUndefined();\n });\n });\n\n describe('With `title` and `iconName` properties provided', () => {\n it('Component should render', () => {\n const wrapper = setup('home', 'home');\n expect(wrapper.toJSON()).toMatchSnapshot();\n });\n\n it('Should have paper <Button />', () => {\n const wrapper = setup('home', 'home');\n const child = wrapper.root.findByProps({ mode: 'text' });\n expect(child.type).toEqual('Button');\n });\n\n it('Should have paper `<Button />` with `mode` property set to \"text\"', () => {\n const wrapper = setup('home', 'home');\n const child = wrapper.root.findByProps({ mode: 'text' });\n expect(child).toBeDefined();\n });\n\n it('Should have paper `<FontAwesome />` icon with `size` property set to `99`', () => {\n const wrapper = setup('home', 'home', 99);\n const child = wrapper.root.findByProps({ size: 99 });\n expect(child.props.color).toBe('blue');\n });\n\n it('Should have paper `<FontAwesome />` icon with `size` property set to `99`', () => {\n const wrapper = setup('home', 'home', 99);\n const child = wrapper.root.findByProps({ size: 99 });\n expect(child).toBeDefined();\n });\n });\n\n describe('With `iconName` but without `title` property provided', () => {\n it('Component should render', () => {\n const wrapper = setup('map', undefined);\n expect(wrapper.toJSON()).toMatchSnapshot();\n });\n\n it('Should have `<FontAwesome.Button />` with `name` set to \"map\"', () => {\n const wrapper = setup('map', undefined);\n const child = wrapper.root.findByProps({ name: 'map' });\n expect(child).toBeDefined();\n });\n\n it('Should have `<FontAwesome.Button />` with `style` set to \"container\"', () => {\n const wrapper = setup('map', undefined);\n const child = wrapper.root.findByProps({ name: 'map' });\n expect(child.props.style).toBe(styles.container);\n });\n\n it('<FontAwesome.Button /> onPress should be called', () => {\n let called = false;\n const onCalled = () => (called = !called);\n\n const wrapper = setup('map', undefined, undefined, onCalled);\n const child = wrapper.root.findByProps({\n testID: 'FontAwesomeButton',\n });\n child.props.onPress();\n expect(called).toBeTruthy();\n });\n });\n });\n});\n"],"version":3}