@testing-library/react-native 10.0.0 → 10.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,22 +102,20 @@ flow-typed install react-test-renderer
102
102
  ## Example
103
103
 
104
104
  ```jsx
105
- import { render, fireEvent } from '@testing-library/react-native';
105
+ import { render, screen, fireEvent } from '@testing-library/react-native';
106
106
  import { QuestionsBoard } from '../QuestionsBoard';
107
107
 
108
108
  test('form submits two answers', () => {
109
109
  const allQuestions = ['q1', 'q2'];
110
110
  const mockFn = jest.fn();
111
111
 
112
- const { getAllByLabelText, getByText } = render(
113
- <QuestionsBoard questions={allQuestions} onSubmit={mockFn} />
114
- );
112
+ render(<QuestionsBoard questions={allQuestions} onSubmit={mockFn} />);
115
113
 
116
- const answerInputs = getAllByLabelText('answer input');
114
+ const answerInputs = screen.getAllByLabelText('answer input');
117
115
 
118
116
  fireEvent.changeText(answerInputs[0], 'a1');
119
117
  fireEvent.changeText(answerInputs[1], 'a2');
120
- fireEvent.press(getByText('Submit'));
118
+ fireEvent.press(screen.getByText('Submit'));
121
119
 
122
120
  expect(mockFn).toBeCalledWith({
123
121
  '1': { q: 'q1', a: 'a1' },
package/build/cleanup.js CHANGED
@@ -5,9 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.addToCleanupQueue = addToCleanupQueue;
7
7
  exports.default = cleanup;
8
+
9
+ var _screen = require("./screen");
10
+
8
11
  let cleanupQueue = new Set();
9
12
 
10
13
  function cleanup() {
14
+ (0, _screen.clearRenderResult)();
11
15
  cleanupQueue.forEach(fn => fn());
12
16
  cleanupQueue.clear();
13
17
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cleanup.ts"],"names":["cleanupQueue","Set","cleanup","forEach","fn","clear","addToCleanupQueue","add"],"mappings":";;;;;;;AAGA,IAAIA,YAAY,GAAG,IAAIC,GAAJ,EAAnB;;AAEe,SAASC,OAAT,GAAmB;AAChCF,EAAAA,YAAY,CAACG,OAAb,CAAsBC,EAAD,IAAQA,EAAE,EAA/B;AACAJ,EAAAA,YAAY,CAACK,KAAb;AACD;;AAEM,SAASC,iBAAT,CAA2BF,EAA3B,EAAgD;AACrDJ,EAAAA,YAAY,CAACO,GAAb,CAAiBH,EAAjB;AACD","sourcesContent":["import * as React from 'react';\n\ntype CleanUpFunction = (nextElement?: React.ReactElement<any>) => void;\nlet cleanupQueue = new Set<CleanUpFunction>();\n\nexport default function cleanup() {\n cleanupQueue.forEach((fn) => fn());\n cleanupQueue.clear();\n}\n\nexport function addToCleanupQueue(fn: CleanUpFunction) {\n cleanupQueue.add(fn);\n}\n"],"file":"cleanup.js"}
1
+ {"version":3,"sources":["../src/cleanup.ts"],"names":["cleanupQueue","Set","cleanup","forEach","fn","clear","addToCleanupQueue","add"],"mappings":";;;;;;;;AACA;;AAGA,IAAIA,YAAY,GAAG,IAAIC,GAAJ,EAAnB;;AAEe,SAASC,OAAT,GAAmB;AAChC;AACAF,EAAAA,YAAY,CAACG,OAAb,CAAsBC,EAAD,IAAQA,EAAE,EAA/B;AACAJ,EAAAA,YAAY,CAACK,KAAb;AACD;;AAEM,SAASC,iBAAT,CAA2BF,EAA3B,EAAgD;AACrDJ,EAAAA,YAAY,CAACO,GAAb,CAAiBH,EAAjB;AACD","sourcesContent":["import * as React from 'react';\nimport { clearRenderResult } from './screen';\n\ntype CleanUpFunction = (nextElement?: React.ReactElement<any>) => void;\nlet cleanupQueue = new Set<CleanUpFunction>();\n\nexport default function cleanup() {\n clearRenderResult();\n cleanupQueue.forEach((fn) => fn());\n cleanupQueue.clear();\n}\n\nexport function addToCleanupQueue(fn: CleanUpFunction) {\n cleanupQueue.add(fn);\n}\n"],"file":"cleanup.js"}
@@ -363,6 +363,8 @@ declare module '@testing-library/react-native' {
363
363
  options?: RenderOptions
364
364
  ) => RenderAPI;
365
365
 
366
+ declare export var screen: RenderAPI;
367
+
366
368
  declare export var cleanup: () => void;
367
369
  declare export var fireEvent: FireEventAPI;
368
370
 
package/build/matches.js CHANGED
@@ -14,7 +14,8 @@ function matches(matcher, text, normalizer = getDefaultNormalizer(), exact = tru
14
14
  const normalizedText = normalizer(text);
15
15
 
16
16
  if (typeof matcher === 'string') {
17
- return exact ? normalizedText === matcher : normalizedText.toLowerCase().includes(matcher.toLowerCase());
17
+ const normalizedMatcher = normalizer(matcher);
18
+ return exact ? normalizedText === normalizedMatcher : normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());
18
19
  } else {
19
20
  return matcher.test(normalizedText);
20
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/matches.ts"],"names":["matches","matcher","text","normalizer","getDefaultNormalizer","exact","normalizedText","toLowerCase","includes","test","trim","collapseWhitespace","replace"],"mappings":";;;;;;;;AAGO,SAASA,OAAT,CACLC,OADK,EAELC,IAFK,EAGLC,UAAwB,GAAGC,oBAAoB,EAH1C,EAILC,KAAc,GAAG,IAJZ,EAKI;AACT,MAAI,OAAOH,IAAP,KAAgB,QAApB,EAA8B;AAC5B,WAAO,KAAP;AACD;;AAED,QAAMI,cAAc,GAAGH,UAAU,CAACD,IAAD,CAAjC;;AACA,MAAI,OAAOD,OAAP,KAAmB,QAAvB,EAAiC;AAC/B,WAAOI,KAAK,GACRC,cAAc,KAAKL,OADX,GAERK,cAAc,CAACC,WAAf,GAA6BC,QAA7B,CAAsCP,OAAO,CAACM,WAAR,EAAtC,CAFJ;AAGD,GAJD,MAIO;AACL,WAAON,OAAO,CAACQ,IAAR,CAAaH,cAAb,CAAP;AACD;AACF;;AAOM,SAASF,oBAAT,CAA8B;AACnCM,EAAAA,IAAI,GAAG,IAD4B;AAEnCC,EAAAA,kBAAkB,GAAG;AAFc,IAGf,EAHf,EAGiC;AACtC,SAAQT,IAAD,IAAkB;AACvB,QAAII,cAAc,GAAGJ,IAArB;AACAI,IAAAA,cAAc,GAAGI,IAAI,GAAGJ,cAAc,CAACI,IAAf,EAAH,GAA2BJ,cAAhD;AACAA,IAAAA,cAAc,GAAGK,kBAAkB,GAC/BL,cAAc,CAACM,OAAf,CAAuB,MAAvB,EAA+B,GAA/B,CAD+B,GAE/BN,cAFJ;AAGA,WAAOA,cAAP;AACD,GAPD;AAQD","sourcesContent":["export type NormalizerFn = (textToNormalize: string) => string;\nexport type TextMatch = string | RegExp;\n\nexport function matches(\n matcher: TextMatch,\n text: string,\n normalizer: NormalizerFn = getDefaultNormalizer(),\n exact: boolean = true\n): boolean {\n if (typeof text !== 'string') {\n return false;\n }\n\n const normalizedText = normalizer(text);\n if (typeof matcher === 'string') {\n return exact\n ? normalizedText === matcher\n : normalizedText.toLowerCase().includes(matcher.toLowerCase());\n } else {\n return matcher.test(normalizedText);\n }\n}\n\ntype NormalizerConfig = {\n trim?: boolean;\n collapseWhitespace?: boolean;\n};\n\nexport function getDefaultNormalizer({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerConfig = {}): NormalizerFn {\n return (text: string) => {\n let normalizedText = text;\n normalizedText = trim ? normalizedText.trim() : normalizedText;\n normalizedText = collapseWhitespace\n ? normalizedText.replace(/\\s+/g, ' ')\n : normalizedText;\n return normalizedText;\n };\n}\n"],"file":"matches.js"}
1
+ {"version":3,"sources":["../src/matches.ts"],"names":["matches","matcher","text","normalizer","getDefaultNormalizer","exact","normalizedText","normalizedMatcher","toLowerCase","includes","test","trim","collapseWhitespace","replace"],"mappings":";;;;;;;;AAGO,SAASA,OAAT,CACLC,OADK,EAELC,IAFK,EAGLC,UAAwB,GAAGC,oBAAoB,EAH1C,EAILC,KAAc,GAAG,IAJZ,EAKI;AACT,MAAI,OAAOH,IAAP,KAAgB,QAApB,EAA8B;AAC5B,WAAO,KAAP;AACD;;AAED,QAAMI,cAAc,GAAGH,UAAU,CAACD,IAAD,CAAjC;;AACA,MAAI,OAAOD,OAAP,KAAmB,QAAvB,EAAiC;AAC/B,UAAMM,iBAAiB,GAAGJ,UAAU,CAACF,OAAD,CAApC;AACA,WAAOI,KAAK,GACRC,cAAc,KAAKC,iBADX,GAERD,cAAc,CAACE,WAAf,GAA6BC,QAA7B,CAAsCF,iBAAiB,CAACC,WAAlB,EAAtC,CAFJ;AAGD,GALD,MAKO;AACL,WAAOP,OAAO,CAACS,IAAR,CAAaJ,cAAb,CAAP;AACD;AACF;;AAOM,SAASF,oBAAT,CAA8B;AACnCO,EAAAA,IAAI,GAAG,IAD4B;AAEnCC,EAAAA,kBAAkB,GAAG;AAFc,IAGf,EAHf,EAGiC;AACtC,SAAQV,IAAD,IAAkB;AACvB,QAAII,cAAc,GAAGJ,IAArB;AACAI,IAAAA,cAAc,GAAGK,IAAI,GAAGL,cAAc,CAACK,IAAf,EAAH,GAA2BL,cAAhD;AACAA,IAAAA,cAAc,GAAGM,kBAAkB,GAC/BN,cAAc,CAACO,OAAf,CAAuB,MAAvB,EAA+B,GAA/B,CAD+B,GAE/BP,cAFJ;AAGA,WAAOA,cAAP;AACD,GAPD;AAQD","sourcesContent":["export type NormalizerFn = (textToNormalize: string) => string;\nexport type TextMatch = string | RegExp;\n\nexport function matches(\n matcher: TextMatch,\n text: string,\n normalizer: NormalizerFn = getDefaultNormalizer(),\n exact: boolean = true\n): boolean {\n if (typeof text !== 'string') {\n return false;\n }\n\n const normalizedText = normalizer(text);\n if (typeof matcher === 'string') {\n const normalizedMatcher = normalizer(matcher);\n return exact\n ? normalizedText === normalizedMatcher\n : normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());\n } else {\n return matcher.test(normalizedText);\n }\n}\n\ntype NormalizerConfig = {\n trim?: boolean;\n collapseWhitespace?: boolean;\n};\n\nexport function getDefaultNormalizer({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerConfig = {}): NormalizerFn {\n return (text: string) => {\n let normalizedText = text;\n normalizedText = trim ? normalizedText.trim() : normalizedText;\n normalizedText = collapseWhitespace\n ? normalizedText.replace(/\\s+/g, ' ')\n : normalizedText;\n return normalizedText;\n };\n}\n"],"file":"matches.js"}
package/build/pure.d.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  import act from './act';
2
2
  import cleanup from './cleanup';
3
3
  import fireEvent from './fireEvent';
4
- import render from './render';
4
+ import render, { RenderResult } from './render';
5
5
  import waitFor from './waitFor';
6
6
  import waitForElementToBeRemoved from './waitForElementToBeRemoved';
7
7
  import { within, getQueriesForElement } from './within';
8
8
  import { getDefaultNormalizer } from './matches';
9
9
  import { renderHook } from './renderHook';
10
+ import { screen } from './screen';
11
+ export type { RenderResult };
12
+ export declare type RenderAPI = RenderResult;
10
13
  export { act };
11
14
  export { cleanup };
12
15
  export { fireEvent };
@@ -16,3 +19,4 @@ export { waitForElementToBeRemoved };
16
19
  export { within, getQueriesForElement };
17
20
  export { getDefaultNormalizer };
18
21
  export { renderHook };
22
+ export { screen };
package/build/pure.js CHANGED
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "renderHook", {
45
45
  return _renderHook.renderHook;
46
46
  }
47
47
  });
48
+ Object.defineProperty(exports, "screen", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _screen.screen;
52
+ }
53
+ });
48
54
  Object.defineProperty(exports, "waitFor", {
49
55
  enumerable: true,
50
56
  get: function () {
@@ -82,5 +88,7 @@ var _matches = require("./matches");
82
88
 
83
89
  var _renderHook = require("./renderHook");
84
90
 
91
+ var _screen = require("./screen");
92
+
85
93
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
86
94
  //# sourceMappingURL=pure.js.map
package/build/pure.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/pure.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["import act from './act';\nimport cleanup from './cleanup';\nimport fireEvent from './fireEvent';\nimport render from './render';\nimport waitFor from './waitFor';\nimport waitForElementToBeRemoved from './waitForElementToBeRemoved';\nimport { within, getQueriesForElement } from './within';\nimport { getDefaultNormalizer } from './matches';\nimport { renderHook } from './renderHook';\n\nexport { act };\nexport { cleanup };\nexport { fireEvent };\nexport { render };\nexport { waitFor };\nexport { waitForElementToBeRemoved };\nexport { within, getQueriesForElement };\nexport { getDefaultNormalizer };\nexport { renderHook };\n"],"file":"pure.js"}
1
+ {"version":3,"sources":["../src/pure.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["import act from './act';\nimport cleanup from './cleanup';\nimport fireEvent from './fireEvent';\nimport render, { RenderResult } from './render';\nimport waitFor from './waitFor';\nimport waitForElementToBeRemoved from './waitForElementToBeRemoved';\nimport { within, getQueriesForElement } from './within';\nimport { getDefaultNormalizer } from './matches';\nimport { renderHook } from './renderHook';\nimport { screen } from './screen';\n\nexport type { RenderResult };\nexport type RenderAPI = RenderResult;\n\nexport { act };\nexport { cleanup };\nexport { fireEvent };\nexport { render };\nexport { waitFor };\nexport { waitForElementToBeRemoved };\nexport { within, getQueriesForElement };\nexport { getDefaultNormalizer };\nexport { renderHook };\nexport { screen };\n"],"file":"pure.js"}
package/build/render.d.ts CHANGED
@@ -4,6 +4,7 @@ declare type Options = {
4
4
  wrapper?: React.ComponentType<any>;
5
5
  createNodeMock?: (element: React.ReactElement) => any;
6
6
  };
7
+ export declare type RenderResult = ReturnType<typeof render>;
7
8
  /**
8
9
  * Renders test component deeply using react-test-renderer and exposes helpers
9
10
  * to assert on the output.
package/build/render.js CHANGED
@@ -19,6 +19,8 @@ var _debugDeep = _interopRequireDefault(require("./helpers/debugDeep"));
19
19
 
20
20
  var _within = require("./within");
21
21
 
22
+ var _screen = require("./screen");
23
+
22
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
25
 
24
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -48,7 +50,7 @@ function render(component, {
48
50
  };
49
51
 
50
52
  (0, _cleanup.addToCleanupQueue)(unmount);
51
- return { ...(0, _within.getQueriesForElement)(instance),
53
+ const result = { ...(0, _within.getQueriesForElement)(instance),
52
54
  update,
53
55
  unmount,
54
56
  container: instance,
@@ -57,6 +59,8 @@ function render(component, {
57
59
  toJSON: renderer.toJSON,
58
60
  debug: debug(instance, renderer)
59
61
  };
62
+ (0, _screen.setRenderResult)(result);
63
+ return result;
60
64
  }
61
65
 
62
66
  function renderWithAct(component, options) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render.tsx"],"names":["render","component","wrapper","Wrapper","createNodeMock","wrap","innerElement","renderer","renderWithAct","undefined","update","updateWithAct","instance","root","unmount","container","rerender","toJSON","debug","options","TestRenderer","create","debugImpl","message","json","shallow"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAUA;AACA;AACA;AACA;AACe,SAASA,MAAT,CACbC,SADa,EAEb;AAAEC,EAAAA,OAAO,EAAEC,OAAX;AAAoBC,EAAAA;AAApB,IAAg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FF,EAGiB;AACf,WAASe,SAAT,CAAmBC,OAAnB,EAAqC;AACnC,UAAMC,IAAI,GAAGjB,QAAQ,CAACU,MAAT,EAAb;;AACA,QAAIO,IAAJ,EAAU;AACR,aAAO,wBAAUA,IAAV,EAAgBD,OAAhB,CAAP;AACD;AACF;;AACDD,EAAAA,SAAS,CAACG,OAAV,GAAqBF,OAAD,IAAsB,2BAAaX,QAAb,EAAuBW,OAAvB,CAA1C;;AACA,SAAOD,SAAP;AACD","sourcesContent":["import TestRenderer from 'react-test-renderer';\nimport type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport debugShallow from './helpers/debugShallow';\nimport debugDeep from './helpers/debugDeep';\nimport { getQueriesForElement } from './within';\n\ntype Options = {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n};\ntype TestRendererOptions = {\n createNodeMock: (element: React.ReactElement) => any;\n};\n\n/**\n * Renders test component deeply using react-test-renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n { wrapper: Wrapper, createNodeMock }: Options = {}\n) {\n const wrap = (innerElement: React.ReactElement) =>\n Wrapper ? <Wrapper>{innerElement}</Wrapper> : innerElement;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n return {\n ...getQueriesForElement(instance),\n update,\n unmount,\n container: instance,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n };\n}\n\nfunction renderWithAct(\n component: React.ReactElement,\n options?: TestRendererOptions\n): ReactTestRenderer {\n let renderer: ReactTestRenderer;\n\n act(() => {\n renderer = TestRenderer.create(component, options);\n });\n\n // @ts-ignore act is sync, so renderer is always initialised here\n return renderer;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\ninterface DebugFunction {\n (message?: string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(message?: string) {\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, message);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"file":"render.js"}
1
+ {"version":3,"sources":["../src/render.tsx"],"names":["render","component","wrapper","Wrapper","createNodeMock","wrap","innerElement","renderer","renderWithAct","undefined","update","updateWithAct","instance","root","unmount","result","container","rerender","toJSON","debug","options","TestRenderer","create","debugImpl","message","json","shallow"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAYA;AACA;AACA;AACA;AACe,SAASA,MAAT,CACbC,SADa,EAEb;AAAEC,EAAAA,OAAO,EAAEC,OAAX;AAAoBC,EAAAA;AAApB,IAAgD,EAFnC,EAGb;AACA,QAAMC,IAAI,GAAIC,YAAD,IACXH,OAAO,gBAAG,oBAAC,OAAD,QAAUG,YAAV,CAAH,GAAuCA,YADhD;;AAGA,QAAMC,QAAQ,GAAGC,aAAa,CAC5BH,IAAI,CAACJ,SAAD,CADwB,EAE5BG,cAAc,GAAG;AAAEA,IAAAA;AAAF,GAAH,GAAwBK,SAFV,CAA9B;AAIA,QAAMC,MAAM,GAAGC,aAAa,CAACJ,QAAD,EAAWF,IAAX,CAA5B;AACA,QAAMO,QAAQ,GAAGL,QAAQ,CAACM,IAA1B;;AACA,QAAMC,OAAO,GAAG,MAAM;AACpB,sBAAI,MAAM;AACRP,MAAAA,QAAQ,CAACO,OAAT;AACD,KAFD;AAGD,GAJD;;AAMA,kCAAkBA,OAAlB;AAEA,QAAMC,MAAM,GAAG,EACb,GAAG,kCAAqBH,QAArB,CADU;AAEbF,IAAAA,MAFa;AAGbI,IAAAA,OAHa;AAIbE,IAAAA,SAAS,EAAEJ,QAJE;AAKbK,IAAAA,QAAQ,EAAEP,MALG;AAKK;AAClBQ,IAAAA,MAAM,EAAEX,QAAQ,CAACW,MANJ;AAObC,IAAAA,KAAK,EAAEA,KAAK,CAACP,QAAD,EAAWL,QAAX;AAPC,GAAf;AAUA,+BAAgBQ,MAAhB;AACA,SAAOA,MAAP;AACD;;AAED,SAASP,aAAT,CACEP,SADF,EAEEmB,OAFF,EAGqB;AACnB,MAAIb,QAAJ;AAEA,oBAAI,MAAM;AACRA,IAAAA,QAAQ,GAAGc,2BAAaC,MAAb,CAAoBrB,SAApB,EAA+BmB,OAA/B,CAAX;AACD,GAFD,EAHmB,CAOnB;;AACA,SAAOb,QAAP;AACD;;AAED,SAASI,aAAT,CACEJ,QADF,EAEEF,IAFF,EAGE;AACA,SAAO,UAAUJ,SAAV,EAAyC;AAC9C,sBAAI,MAAM;AACRM,MAAAA,QAAQ,CAACG,MAAT,CAAgBL,IAAI,CAACJ,SAAD,CAApB;AACD,KAFD;AAGD,GAJD;AAKD;;AAOD,SAASkB,KAAT,CACEP,QADF,EAEEL,QAFF,EAGiB;AACf,WAASgB,SAAT,CAAmBC,OAAnB,EAAqC;AACnC,UAAMC,IAAI,GAAGlB,QAAQ,CAACW,MAAT,EAAb;;AACA,QAAIO,IAAJ,EAAU;AACR,aAAO,wBAAUA,IAAV,EAAgBD,OAAhB,CAAP;AACD;AACF;;AACDD,EAAAA,SAAS,CAACG,OAAV,GAAqBF,OAAD,IAAsB,2BAAaZ,QAAb,EAAuBY,OAAvB,CAA1C;;AACA,SAAOD,SAAP;AACD","sourcesContent":["import TestRenderer from 'react-test-renderer';\nimport type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport debugShallow from './helpers/debugShallow';\nimport debugDeep from './helpers/debugDeep';\nimport { getQueriesForElement } from './within';\nimport { setRenderResult } from './screen';\n\ntype Options = {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n};\ntype TestRendererOptions = {\n createNodeMock: (element: React.ReactElement) => any;\n};\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using react-test-renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n { wrapper: Wrapper, createNodeMock }: Options = {}\n) {\n const wrap = (innerElement: React.ReactElement) =>\n Wrapper ? <Wrapper>{innerElement}</Wrapper> : innerElement;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n container: instance,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n };\n\n setRenderResult(result);\n return result;\n}\n\nfunction renderWithAct(\n component: React.ReactElement,\n options?: TestRendererOptions\n): ReactTestRenderer {\n let renderer: ReactTestRenderer;\n\n act(() => {\n renderer = TestRenderer.create(component, options);\n });\n\n // @ts-ignore act is sync, so renderer is always initialised here\n return renderer;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\ninterface DebugFunction {\n (message?: string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(message?: string) {\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, message);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"file":"render.js"}
@@ -0,0 +1,4 @@
1
+ import { RenderResult } from './render';
2
+ export declare let screen: RenderResult;
3
+ export declare function setRenderResult(output: RenderResult): void;
4
+ export declare function clearRenderResult(): void;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clearRenderResult = clearRenderResult;
7
+ exports.screen = void 0;
8
+ exports.setRenderResult = setRenderResult;
9
+ const SCREEN_ERROR = '`render` method has not been called';
10
+
11
+ const notImplemented = () => {
12
+ throw new Error(SCREEN_ERROR);
13
+ };
14
+
15
+ const notImplementedDebug = () => {
16
+ throw new Error(SCREEN_ERROR);
17
+ };
18
+
19
+ notImplementedDebug.shallow = notImplemented;
20
+ const defaultScreen = {
21
+ get container() {
22
+ throw new Error(SCREEN_ERROR);
23
+ },
24
+
25
+ debug: notImplementedDebug,
26
+ update: notImplemented,
27
+ unmount: notImplemented,
28
+ rerender: notImplemented,
29
+ toJSON: notImplemented,
30
+ getByLabelText: notImplemented,
31
+ getAllByLabelText: notImplemented,
32
+ queryByLabelText: notImplemented,
33
+ queryAllByLabelText: notImplemented,
34
+ findByLabelText: notImplemented,
35
+ findAllByLabelText: notImplemented,
36
+ getByA11yHint: notImplemented,
37
+ getByHintText: notImplemented,
38
+ getAllByA11yHint: notImplemented,
39
+ getAllByHintText: notImplemented,
40
+ queryByA11yHint: notImplemented,
41
+ queryByHintText: notImplemented,
42
+ queryAllByA11yHint: notImplemented,
43
+ queryAllByHintText: notImplemented,
44
+ findByA11yHint: notImplemented,
45
+ findByHintText: notImplemented,
46
+ findAllByA11yHint: notImplemented,
47
+ findAllByHintText: notImplemented,
48
+ getByRole: notImplemented,
49
+ getAllByRole: notImplemented,
50
+ queryByRole: notImplemented,
51
+ queryAllByRole: notImplemented,
52
+ findByRole: notImplemented,
53
+ findAllByRole: notImplemented,
54
+ getByA11yStates: notImplemented,
55
+ getAllByA11yStates: notImplemented,
56
+ queryByA11yStates: notImplemented,
57
+ queryAllByA11yStates: notImplemented,
58
+ findByA11yStates: notImplemented,
59
+ findAllByA11yStates: notImplemented,
60
+ getByA11yState: notImplemented,
61
+ getAllByA11yState: notImplemented,
62
+ queryByA11yState: notImplemented,
63
+ queryAllByA11yState: notImplemented,
64
+ findByA11yState: notImplemented,
65
+ findAllByA11yState: notImplemented,
66
+ getByA11yValue: notImplemented,
67
+ getAllByA11yValue: notImplemented,
68
+ queryByA11yValue: notImplemented,
69
+ queryAllByA11yValue: notImplemented,
70
+ findByA11yValue: notImplemented,
71
+ findAllByA11yValue: notImplemented,
72
+ UNSAFE_getByProps: notImplemented,
73
+ UNSAFE_getAllByProps: notImplemented,
74
+ UNSAFE_queryByProps: notImplemented,
75
+ UNSAFE_queryAllByProps: notImplemented,
76
+ UNSAFE_getByType: notImplemented,
77
+ UNSAFE_getAllByType: notImplemented,
78
+ UNSAFE_queryByType: notImplemented,
79
+ UNSAFE_queryAllByType: notImplemented,
80
+ getByPlaceholderText: notImplemented,
81
+ getAllByPlaceholderText: notImplemented,
82
+ queryByPlaceholderText: notImplemented,
83
+ queryAllByPlaceholderText: notImplemented,
84
+ findByPlaceholderText: notImplemented,
85
+ findAllByPlaceholderText: notImplemented,
86
+ getByDisplayValue: notImplemented,
87
+ getAllByDisplayValue: notImplemented,
88
+ queryByDisplayValue: notImplemented,
89
+ queryAllByDisplayValue: notImplemented,
90
+ findByDisplayValue: notImplemented,
91
+ findAllByDisplayValue: notImplemented,
92
+ getByTestId: notImplemented,
93
+ getAllByTestId: notImplemented,
94
+ queryByTestId: notImplemented,
95
+ queryAllByTestId: notImplemented,
96
+ findByTestId: notImplemented,
97
+ findAllByTestId: notImplemented,
98
+ getByText: notImplemented,
99
+ getAllByText: notImplemented,
100
+ queryByText: notImplemented,
101
+ queryAllByText: notImplemented,
102
+ findByText: notImplemented,
103
+ findAllByText: notImplemented
104
+ };
105
+ let screen = defaultScreen;
106
+ exports.screen = screen;
107
+
108
+ function setRenderResult(output) {
109
+ exports.screen = screen = output;
110
+ }
111
+
112
+ function clearRenderResult() {
113
+ exports.screen = screen = defaultScreen;
114
+ }
115
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/screen.ts"],"names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","shallow","defaultScreen","container","debug","update","unmount","rerender","toJSON","getByLabelText","getAllByLabelText","queryByLabelText","queryAllByLabelText","findByLabelText","findAllByLabelText","getByA11yHint","getByHintText","getAllByA11yHint","getAllByHintText","queryByA11yHint","queryByHintText","queryAllByA11yHint","queryAllByHintText","findByA11yHint","findByHintText","findAllByA11yHint","findAllByHintText","getByRole","getAllByRole","queryByRole","queryAllByRole","findByRole","findAllByRole","getByA11yStates","getAllByA11yStates","queryByA11yStates","queryAllByA11yStates","findByA11yStates","findAllByA11yStates","getByA11yState","getAllByA11yState","queryByA11yState","queryAllByA11yState","findByA11yState","findAllByA11yState","getByA11yValue","getAllByA11yValue","queryByA11yValue","queryAllByA11yValue","findByA11yValue","findAllByA11yValue","UNSAFE_getByProps","UNSAFE_getAllByProps","UNSAFE_queryByProps","UNSAFE_queryAllByProps","UNSAFE_getByType","UNSAFE_getAllByType","UNSAFE_queryByType","UNSAFE_queryAllByType","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","queryAllByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","queryAllByDisplayValue","findByDisplayValue","findAllByDisplayValue","getByTestId","getAllByTestId","queryByTestId","queryAllByTestId","findByTestId","findAllByTestId","getByText","getAllByText","queryByText","queryAllByText","findByText","findAllByText","screen","setRenderResult","output","clearRenderResult"],"mappings":";;;;;;;;AAGA,MAAMA,YAAY,GAAG,qCAArB;;AAEA,MAAMC,cAAc,GAAG,MAAM;AAC3B,QAAM,IAAIC,KAAJ,CAAUF,YAAV,CAAN;AACD,CAFD;;AAIA,MAAMG,mBAAmB,GAAG,MAAM;AACh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Y;AA4DlC8D,EAAAA,uBAAuB,EAAE9D,cA5DS;AA6DlC+D,EAAAA,sBAAsB,EAAE/D,cA7DU;AA8DlCgE,EAAAA,yBAAyB,EAAEhE,cA9DO;AA+DlCiE,EAAAA,qBAAqB,EAAEjE,cA/DW;AAgElCkE,EAAAA,wBAAwB,EAAElE,cAhEQ;AAiElCmE,EAAAA,iBAAiB,EAAEnE,cAjEe;AAkElCoE,EAAAA,oBAAoB,EAAEpE,cAlEY;AAmElCqE,EAAAA,mBAAmB,EAAErE,cAnEa;AAoElCsE,EAAAA,sBAAsB,EAAEtE,cApEU;AAqElCuE,EAAAA,kBAAkB,EAAEvE,cArEc;AAsElCwE,EAAAA,qBAAqB,EAAExE,cAtEW;AAuElCyE,EAAAA,WAAW,EAAEzE,cAvEqB;AAwElC0E,EAAAA,cAAc,EAAE1E,cAxEkB;AAyElC2E,EAAAA,aAAa,EAAE3E,cAzEmB;AA0ElC4E,EAAAA,gBAAgB,EAAE5E,cA1EgB;AA2ElC6E,EAAAA,YAAY,EAAE7E,cA3EoB;AA4ElC8E,EAAAA,eAAe,EAAE9E,cA5EiB;AA6ElC+E,EAAAA,SAAS,EAAE/E,cA7EuB;AA8ElCgF,EAAAA,YAAY,EAAEhF,cA9EoB;AA+ElCiF,EAAAA,WAAW,EAAEjF,cA/EqB;AAgFlCkF,EAAAA,cAAc,EAAElF,cAhFkB;AAiFlCmF,EAAAA,UAAU,EAAEnF,cAjFsB;AAkFlCoF,EAAAA,aAAa,EAAEpF;AAlFmB,CAApC;AAqFO,IAAIqF,MAAoB,GAAGjF,aAA3B;;;AAEA,SAASkF,eAAT,CAAyBC,MAAzB,EAA+C;AACpD,mBAAAF,MAAM,GAAGE,MAAT;AACD;;AAEM,SAASC,iBAAT,GAA6B;AAClC,mBAAAH,MAAM,GAAGjF,aAAT;AACD","sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` method has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\nconst notImplementedDebug = () => {\n throw new Error(SCREEN_ERROR);\n};\nnotImplementedDebug.shallow = notImplemented;\n\nconst defaultScreen: RenderResult = {\n get container(): ReactTestInstance {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplementedDebug,\n update: notImplemented,\n unmount: notImplemented,\n rerender: notImplemented,\n toJSON: notImplemented,\n getByLabelText: notImplemented,\n getAllByLabelText: notImplemented,\n queryByLabelText: notImplemented,\n queryAllByLabelText: notImplemented,\n findByLabelText: notImplemented,\n findAllByLabelText: notImplemented,\n getByA11yHint: notImplemented,\n getByHintText: notImplemented,\n getAllByA11yHint: notImplemented,\n getAllByHintText: notImplemented,\n queryByA11yHint: notImplemented,\n queryByHintText: notImplemented,\n queryAllByA11yHint: notImplemented,\n queryAllByHintText: notImplemented,\n findByA11yHint: notImplemented,\n findByHintText: notImplemented,\n findAllByA11yHint: notImplemented,\n findAllByHintText: notImplemented,\n getByRole: notImplemented,\n getAllByRole: notImplemented,\n queryByRole: notImplemented,\n queryAllByRole: notImplemented,\n findByRole: notImplemented,\n findAllByRole: notImplemented,\n getByA11yStates: notImplemented,\n getAllByA11yStates: notImplemented,\n queryByA11yStates: notImplemented,\n queryAllByA11yStates: notImplemented,\n findByA11yStates: notImplemented,\n findAllByA11yStates: notImplemented,\n getByA11yState: notImplemented,\n getAllByA11yState: notImplemented,\n queryByA11yState: notImplemented,\n queryAllByA11yState: notImplemented,\n findByA11yState: notImplemented,\n findAllByA11yState: notImplemented,\n getByA11yValue: notImplemented,\n getAllByA11yValue: notImplemented,\n queryByA11yValue: notImplemented,\n queryAllByA11yValue: notImplemented,\n findByA11yValue: notImplemented,\n findAllByA11yValue: notImplemented,\n UNSAFE_getByProps: notImplemented,\n UNSAFE_getAllByProps: notImplemented,\n UNSAFE_queryByProps: notImplemented,\n UNSAFE_queryAllByProps: notImplemented,\n UNSAFE_getByType: notImplemented,\n UNSAFE_getAllByType: notImplemented,\n UNSAFE_queryByType: notImplemented,\n UNSAFE_queryAllByType: notImplemented,\n getByPlaceholderText: notImplemented,\n getAllByPlaceholderText: notImplemented,\n queryByPlaceholderText: notImplemented,\n queryAllByPlaceholderText: notImplemented,\n findByPlaceholderText: notImplemented,\n findAllByPlaceholderText: notImplemented,\n getByDisplayValue: notImplemented,\n getAllByDisplayValue: notImplemented,\n queryByDisplayValue: notImplemented,\n queryAllByDisplayValue: notImplemented,\n findByDisplayValue: notImplemented,\n findAllByDisplayValue: notImplemented,\n getByTestId: notImplemented,\n getAllByTestId: notImplemented,\n queryByTestId: notImplemented,\n queryAllByTestId: notImplemented,\n findByTestId: notImplemented,\n findAllByTestId: notImplemented,\n getByText: notImplemented,\n getAllByText: notImplemented,\n queryByText: notImplemented,\n queryAllByText: notImplemented,\n findByText: notImplemented,\n findAllByText: notImplemented,\n};\n\nexport let screen: RenderResult = defaultScreen;\n\nexport function setRenderResult(output: RenderResult) {\n screen = output;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"file":"screen.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/react-native",
3
- "version": "10.0.0",
3
+ "version": "10.1.1",
4
4
  "description": "Simple and complete React Native testing utilities that encourage good testing practices.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -363,6 +363,8 @@ declare module '@testing-library/react-native' {
363
363
  options?: RenderOptions
364
364
  ) => RenderAPI;
365
365
 
366
+ declare export var screen: RenderAPI;
367
+
366
368
  declare export var cleanup: () => void;
367
369
  declare export var fireEvent: FireEventAPI;
368
370