MCPcopy Create free account
hub / github.com/callstack/react-native-paper / setup

Function setup

src/components/__tests__/Tooltip.test.tsx:38–69  ·  view source on GitHub ↗
(
    propOverrides?: Partial<React.ComponentProps<typeof Tooltip>>,
    measure = {}
  )

Source from the content-addressed store, hash-verified

36 };
37
38 const setup = (
39 propOverrides?: Partial<React.ComponentProps<typeof Tooltip>>,
40 measure = {}
41 ) => {
42 const defaultProps = {
43 children: <DummyComponent />,
44 title: 'some tooltip text',
45 ...propOverrides,
46 };
47
48 const { x, y, width, height, pageX, pageY } = {
49 x: 0,
50 y: 0,
51 width: 80,
52 height: 50,
53 pageX: 220,
54 pageY: 200,
55 ...measure,
56 };
57
58 jest
59 .spyOn(View.prototype, 'measure')
60 .mockImplementation((cb) => cb(x, y, width, height, pageX, pageY));
61
62 const wrapper = render(
63 <PaperProvider>
64 <Tooltip {...defaultProps} />
65 </PaperProvider>
66 );
67
68 return { wrapper };
69 };
70
71 describe('Mobile', () => {
72 beforeAll(() => {

Callers 1

Tooltip.test.tsxFile · 0.85

Calls 1

renderFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…