You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package provides a React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment.
18
+
Ez a csomag egy React renderelőt nyújt, ami React komponensek tiszta JavaScript objektumokként való renderelését teszi lehetővé a DOM és natív mobilkörnyezetek nélkül.
19
19
20
-
Essentially, this package makes it easy to grab a snapshot of the platform view hierarchy (similar to a DOM tree) rendered by a React DOM or React Native component without using a browser or [jsdom](https://github.com/tmpvar/jsdom).
20
+
Alapjában véve, ez a csomag a platform nézethierarchiájáról (hasonló a DOM fához) pillanatképek készítését teszi egyszerűvé, amiket egy React DOM, vagy React Native komponens renderel böngésző, vagy [jsdom](https://github.com/tmpvar/jsdom) használata nélkül.
You can use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: [Learn more about it](https://jestjs.io/docs/en/snapshot-testing).
41
+
Használhatod a Jest pillanatkép-tesztelő funkcióját a JSON fa automatikus fájlba való kimentéséhez, és hogy le tudd ellenőrizni, hogy a tesztjeid megváltoztak-e, vagy nem: [Itt tanulhatsz róla többet](https://jestjs.io/docs/en/snapshot-testing).
42
42
43
-
You can also traverse the output to find specific nodes and make assertions about them.
43
+
A kimenetet be is tudod járni, hogy konkrét csomópontokhoz tudj állítsokat írni.
Create a `TestRenderer`instance with the passed React element. It doesn't use the real DOM, but it still fully renders the component tree into memory so you can make assertions about it. Returns a [TestRenderer instance](#testrenderer-instance).
106
+
Egy `TestRenderer`példányt készít, az átadott React elemmel. Nem a valós DOM-ot használja, de így is kirendereli a teljes komponensfát a memóriába, hogy állításokat tudj róla írni. Egy [TestRenderer példányt](#testrenderer-instance) ad vissza.
107
107
108
108
### `TestRenderer.act()` {#testrendereract}
109
109
110
110
```javascript
111
111
TestRenderer.act(callback);
112
112
```
113
113
114
-
Similar to the [`act()` helper from `react-dom/test-utils`](/docs/test-utils.html#act), `TestRenderer.act`prepares a component for assertions. Use this version of `act()`to wrap calls to `TestRenderer.create`and`testRenderer.update`.
114
+
Hasonló a [`react-dom/test-utils` csomag `act()` segédmetódusához](/docs/test-utils.html#act), a `TestRenderer.act`előkészít egy kompnenst az állítások írásához. Használd az `act()`ezen verzióját a `TestRenderer.create`és`testRenderer.update` hívások becsomagolásához.
115
115
116
116
```javascript
117
117
import {create, act} from'react-test-renderer';
118
-
importAppfrom'./app.js'; //The component being tested
Return an object representing the rendered tree. This tree only contains the platform-specific nodes like `<div>` or`<View>` and their props, but doesn't contain any user-written components. This is handy for [snapshot testing](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest).
144
+
Egy, a renderelt fát képviselő objektumot ad vissza. Ez a fa csak platformspecifikus csomópontokat és azok propjait tartalmazza, mint a `<div>`, vagy`<View>`, a felhasználó által írt komponenseket viszont nem. Ez jól jön [pillanatkép teszteléskor](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest).
145
145
146
146
### `testRenderer.toTree()` {#testrenderertotree}
147
147
148
148
```javascript
149
149
testRenderer.toTree()
150
150
```
151
151
152
-
Return an object representing the rendered tree. The representation is more detailed than the one provided by `toJSON()`, and includes the user-written components. You probably don't need this method unless you're writing your own assertion library on top of the test renderer.
152
+
Egy, a renderelt fát képviselő objektumot ad vissza. A reprezentáció részeletesebb, mint amit a `toJSON()` ad vissza, és a felhasználó által írt komponenseket is tartalmazza. Valószínűleg erre a metódusra nem lesz szükséged, kivéve ha a saját állítási könyvtáradat írod a teszt renderelőre építve.
153
153
154
154
### `testRenderer.update()` {#testrendererupdate}
155
155
156
156
```javascript
157
157
testRenderer.update(element)
158
158
```
159
159
160
-
Re-render the in-memory tree with a new root element. This simulates a React update at the root. If the new element has the same type and key as the previous element, the tree will be updated; otherwise, it will re-mount a new tree.
160
+
Újrarendereli a memóriában lévő fát egy új gyökérelemmel. Ez egy React frissítést szimulál a gyökéren. Ha az új elemnek ugyanaz a típusa és kulcsa mint az előzőnek, a fa frissítve lesz; máskülönben egy új fa lesz létrehozva.
Return the instance corresponding to the root element, if available. This will not work if the root element is a function component because they don't have instances.
175
+
Ha elérhető, egy, a gyökérelemhez tartózó példányt ad vissza. Ha a gyökérelem egy függvénykomponens, ez nem fog működni, mivel a függvényeknek nincsenek példányaik.
177
176
178
177
### `testRenderer.root` {#testrendererroot}
179
178
180
179
```javascript
181
180
testRenderer.root
182
181
```
183
182
184
-
Returns the root "test instance" object that is useful for making assertions about specific nodes in the tree. You can use it to find other "test instances" deeper below.
183
+
A gyökér "tesztpéldány" objektumát adja vissza, ami hasznos a fában lévő specifikus csomópontokhoz való állítások írásához. Mélyebben lévő "tesztpéldányok" megtalálásához is használhatod.
185
184
186
185
### `testInstance.find()` {#testinstancefind}
187
186
188
187
```javascript
189
188
testInstance.find(test)
190
189
```
191
190
192
-
Find a single descendant test instance for which `test(testInstance)`returns `true`. If `test(testInstance)`does not return `true` for exactly one test instance, it will throw an error.
191
+
Megtalálja azt az egyetlen leszármazott tesztpéldányt, ami esetében a `test(testInstance)``true` értéket ad vissza. Egy hibát dob, aa a `test(testInstance)`nem csak egy tesztpéldány esetén ad vissza `true` értéket.
Find a single descendant test instance with the provided `type`. If there is not exactly one test instance with the provided`type`, it will throw an error.
199
+
Megtalálja azt az egyetlen leszármazott tesztpéldányt, aminek a típusa megegyezik a megadott `type`-pal. Egy hibát dob, ha nem csak egy tesztpéldány létezik a megadott`type` típussal.
Find a single descendant test instance with the provided `props`. If there is not exactly one test instance with the provided`props`, it will throw an error.
207
+
Megtalálja azt az egyetlen leszármazott tesztpéldányt, aminek a propjai megegyeznek a megadott `props`-szal. Egy hibát dob, ha nem csak egy tesztpéldány létezik a megadott`props` propokkal.
The component instance corresponding to this test instance. It is only available for class components, as function components don't have instances. It matches the `this`value inside the given component.
239
+
Ennek a tesztpéldánynak megfelelő komponenspéldány. Csak osztálykomponenseknél elérhető, mivel függvénykomponenseknek nincsenek példányai. A `this`érték megegyezik az adott komponensben.
241
240
242
241
### `testInstance.type` {#testinstancetype}
243
242
244
243
```javascript
245
244
testInstance.type
246
245
```
247
246
248
-
The component type corresponding to this test instance. For example, a `<Button/>`component has a type of`Button`.
247
+
Ennek a tesztpéldánynak megfelelő komponenstípus. Például, a `<Button/>`komponens típusa`Button`.
249
248
250
249
### `testInstance.props` {#testinstanceprops}
251
250
252
251
```javascript
253
252
testInstance.props
254
253
```
255
254
256
-
The props corresponding to this test instance. For example, a `<Button size="small" />`component has `{size: 'small'}` as props.
255
+
Ennek a tesztpéldánynak megfelelő propok. Például, a `<Button size="small" />`propjai `{size: 'small'}`.
0 commit comments