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
var ReactTestUtils =require('react-dom/test-utils'); // ES5 with npm
13
+
var ReactTestUtils =require('react-dom/test-utils'); // ES5 npm-mel
14
14
```
15
15
16
-
## Overview {#overview}
16
+
## Áttekintés {#overview}
17
17
18
-
`ReactTestUtils`makes it easy to test React components in the testing framework of your choice. At Facebook we use [Jest](https://facebook.github.io/jest/) for painless JavaScript testing. Learn how to get started with Jest through the Jest website's [React Tutorial](https://jestjs.io/docs/tutorial-react).
18
+
A `ReactTestUtils`egyszerűvé teszi a React komponensek tesztelését az általad választott tesztelői keretrendszerben. A Facebooknál a [Jest](https://facebook.github.io/jest/)-et használjuk a fájdalommentes JavaScript tesztelés érdekében. A Jest weboldalán lévő [React Tutorial](https://jestjs.io/docs/tutorial-react) segítségével megtanulhatod, hogy kezdhetsz neki a tesztelésnek.
19
19
20
-
> Note:
20
+
> Megjegyzés:
21
21
>
22
-
> We recommend using [React Testing Library](https://testing-library.com/react)which is designed to enable and encourage writing tests that use your components as the end users do.
22
+
> Mi a [React Testing Library](https://testing-library.com/react)használatát ajánljuk, ami úgy lett tervezve, hogy olyan komponenstesztek írására bátorítson, amik a végfelhasználó cselekedeit tükrözi.
23
23
>
24
-
> Alternatively, Airbnb has released a testing utility called [Enzyme](https://airbnb.io/enzyme/), which makes it easy to assert, manipulate, and traverse your React Components' output.
24
+
> Alternatívaként, az Airbnb is kiadott egy tesztelői segédeszközt [Enzyme](https://airbnb.io/enzyme/) néven, ami egyszerűbbé teszi a React komponenseid kimenetéhez állításokat írni, azt manipulálni és bejárni.
25
25
26
26
-[`act()`](#act)
27
27
-[`mockComponent()`](#mockcomponent)
@@ -40,17 +40,17 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
40
40
-[`renderIntoDocument()`](#renderintodocument)
41
41
-[`Simulate`](#simulate)
42
42
43
-
## Reference {#reference}
43
+
## Referencia {#reference}
44
44
45
45
### `act()` {#act}
46
46
47
-
To prepare a component for assertions, wrap the code rendering it and performing updates inside an`act()`call. This makes your test run closer to how React works in the browser.
47
+
Egy komponens állításokhoz való felkészítéshez vedd körül az azt renderelő és frissítéseket végrehajtó kódot egy `act()`hívással. Ez közelebb viszi a tesztek futtatását ahhoz, ahogyan a React működik a böngészőben.
48
48
49
-
>Note
49
+
>Megjegyzés
50
50
>
51
-
>If you use`react-test-renderer`, it also provides an`act`export that behaves the same way.
51
+
>Ha a`react-test-renderer`-t használod, az is szolgáltat egy`act`exportot, ami hasonlóan működik.
52
52
53
-
For example, let's say we have this`Counter`component:
53
+
Például, mondjuk hogy van ez a`Counter`komponensünk:
54
54
55
55
```js
56
56
classCounterextendsReact.Component {
@@ -60,10 +60,10 @@ class Counter extends React.Component {
expect(label.textContent).toBe('1 alkalommal kattintottál');
121
+
expect(document.title).toBe('1 alkalommal kattintottál');
122
122
});
123
123
```
124
124
125
-
-Don't forget that dispatching DOM events only works when the DOM container is added to the`document`. You can use a library like [React Testing Library](https://testing-library.com/react) to reduce the boilerplate code.
125
+
-Ne feledd, hogy DOM események kiküldése csak akkor működik, ha a DOM konténer hozzá lett adva a`document`-hez. A sablonkód minimalizálásához használj egy könyvtárat, mint a [React Testing Library](https://testing-library.com/react).
126
126
127
-
-The[`recipes`](/docs/testing-recipes.html)document contains more details on how `act()`behaves, with examples and usage.
127
+
-A[`receptek`](/docs/testing-recipes.html)dokumentum több részletet tartalmaz az `act()`működéséről példákkal, és annak használatáról.
128
128
129
129
* * *
130
130
@@ -137,11 +137,11 @@ mockComponent(
137
137
)
138
138
```
139
139
140
-
Pass a mocked component module to this method to augment it with useful methods that allow it to be used as a dummy React component. Instead of rendering as usual, the component will become a simple `<div>` (or other tag if `mockTagName`is provided) containing any provided children.
140
+
Adj át egy leutánzott (mocked) komponensmodult ennek a metódusnak, hogy azt kiterjeszd hasznos metódusokkal, amik lehetővé teszik ezt úgy használni, mint egy ál-React komponenst. Szokásos renderelés helyett a komponens egy egyszerű `<div>`-vé válik (vagy más címkévé, ha a `mockTagName`meg lett adva), ami minden szolgáltatott gyermeket tartalmaz.
141
141
142
-
> Note:
142
+
> Megjegyzés:
143
143
>
144
-
> `mockComponent()`is a legacy API. We recommend using [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock)instead.
144
+
> A `mockComponent()`egy elavult API. Helyette a [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock)használatát ajánljuk.
145
145
146
146
* * *
147
147
@@ -151,7 +151,7 @@ Pass a mocked component module to this method to augment it with useful methods
151
151
isElement(element)
152
152
```
153
153
154
-
Returns `true` if `element`is any React element.
154
+
Ha az `element`egy bármilyen React elem, `true` értéket ad vissza.
155
155
156
156
* * *
157
157
@@ -164,7 +164,7 @@ isElementOfType(
164
164
)
165
165
```
166
166
167
-
Returns `true` if `element`is a React element whose type is of a React`componentClass`.
167
+
Ha az `element`egy bármilyen React elem, aminek a típusa`componentClass`, akkor `true` értéket ad vissza.
168
168
169
169
* * *
170
170
@@ -174,7 +174,7 @@ Returns `true` if `element` is a React element whose type is of a React `compone
174
174
isDOMComponent(instance)
175
175
```
176
176
177
-
Returns `true` if `instance`is a DOM component (such as a `<div>` or`<span>`).
177
+
Ha az `instance`egy DOM komponens (mint például `<div>`, vagy`<span>`), akkor `true` értéket ad vissza.
178
178
179
179
* * *
180
180
@@ -184,7 +184,7 @@ Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
184
184
isCompositeComponent(instance)
185
185
```
186
186
187
-
Returns `true` if `instance`is a user-defined component, such as a class or a function.
187
+
Ha az `instance`egy felhasználó által definiált komponens, mint például egy osztály vagy egy függvény, akkor `true` értéket ad vissza.
188
188
189
189
* * *
190
190
@@ -197,7 +197,7 @@ isCompositeComponentWithType(
197
197
)
198
198
```
199
199
200
-
Returns `true` if `instance`is a component whose type is of a React `componentClass`.
200
+
Ha az `instance`egy React komponens, aminek a típusa egy `componentClass`, akkor `true` értéket ad vissza.
201
201
202
202
* * *
203
203
@@ -210,7 +210,7 @@ findAllInRenderedTree(
210
210
)
211
211
```
212
212
213
-
Traverse all components in`tree` and accumulate all components where `test(component)`is `true`. This is not that useful on its own, but it's used as a primitive for other test utils.
213
+
Bejár minden komponenst a`tree`-ben (fán) és összegyűjti az összes komponenst, ahol a `test(component)``true`. Ez így magában nem túl hasznos, inkább primitívként, más tesztelői segédeszközökben használt.
Like [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.
239
+
Mint a [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass), de csak egy eredményre számít, és csak ezt az egy eredményt adja vissza, vagy egy kivételt dob, ha több egyezés is van.
Like [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.
265
+
Mint a [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag), de csak egy eredményre számít, és csak ezt az egy eredményt adja vissza, vagy egy kivételt dob, ha több egyezés is van.
Same as[`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) but expects there to be one result and returns that one result, or throws exception if there is any other number of matches besides one.
291
+
Mint a[`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype), de csak egy eredményre számít, és csak ezt az egy eredményt adja vissza, vagy egy kivételt dob, ha több egyezés is van.
292
292
293
293
***
294
294
@@ -298,20 +298,20 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu
298
298
renderIntoDocument(element)
299
299
```
300
300
301
-
Render a React element into a detached DOM node in the document. **This function requires a DOM.**It is effectively equivalent to:
301
+
Egy React elemet renderel egy leválasztott DOM csomópontba, a dokumentumban. **Ez a függvény megköveteli a DOM jelenlétét.**Ez végülis ekvivalens ezzel:
302
302
303
303
```js
304
304
constdomContainer=document.createElement('div');
305
305
ReactDOM.render(element, domContainer);
306
306
```
307
307
308
-
> Note:
308
+
> Megegyezés:
309
309
>
310
-
> You will need to have `window`, `window.document`and `window.document.createElement`globally available **before** you import `React`. Otherwise React will think it can't access the DOM and methods like `setState`won't work.
310
+
> Szükséged lesz a `window`, `window.document`és a `window.document.createElement`globális jelenlétére a `React` beimportálása **előtt**. Máskülönben a React azt fogja hinni, hogy nem fér hozzá a DOM-hoz és olyan metódusok, mint a `setState`nem fognak működni.
311
311
312
312
* * *
313
313
314
-
## Other Utilities {#other-utilities}
314
+
## Egyéb segédeszközök {#other-utilities}
315
315
316
316
### `Simulate` {#simulate}
317
317
@@ -322,30 +322,30 @@ Simulate.{eventName}(
322
322
)
323
323
```
324
324
325
-
Simulate an event dispatch on a DOM node with optional`eventData`event data.
325
+
Egy esemény kiküldését szimulálja egy DOM csompóponton, az opcionális`eventData`eseménnyel kapcsolatos adattal.
326
326
327
-
`Simulate`has a method for [every event that React understands](/docs/events.html#supported-events).
327
+
A `Simulate`rendelkezik egy metódussal [minden eseményhez, amit a React megért](/docs/events.html#supported-events).
> You will have to provide any event property that you're using in your component (e.g. keyCode, which, etc...) as React is not creating any of these for you.
349
+
> Minden eseménytulajdonságot szolgáltatnod kell, amit a komponensed használ (pl.: keyCode, which, stb...), mivel a React ezeket nem fogja neked létrehozni.
0 commit comments