Skip to content

Commit 768800b

Browse files
committed
translate addons-shallow-renderer
1 parent 37ff6a6 commit 768800b

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
---
22
id: shallow-renderer
3-
title: Shallow Renderer
3+
title: Sekély renderelő
44
permalink: docs/shallow-renderer.html
55
layout: docs
66
category: Reference
77
---
88

9-
**Importing**
9+
**Importálás**
1010

1111
```javascript
1212
import ShallowRenderer from 'react-test-renderer/shallow'; // ES6
1313
var ShallowRenderer = require('react-test-renderer/shallow'); // ES5 with npm
1414
```
1515

16-
## Overview {#overview}
16+
## Áttekintés {#overview}
1717

18-
When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM.
18+
Amikor egységteszteket írsz Reacthez, a sekély renderelés hasznos lehet. A sekély renderelés lehetővé teszi egy komponens renderelését "egy szint mélységig", és tényeket tudsz megerősíteni arról, hogy a render metódus mit ad vissza anélkül, hogy a gyermekkomponensek viselkedésétől kéne aggódnod, amik nem lesznek renderelve. Ez nem igényel DOM-ot.
1919

20-
For example, if you have the following component:
20+
Például ha van ez a komponensed:
2121

2222
```javascript
2323
function MyComponent() {
2424
return (
2525
<div>
26-
<span className="heading">Title</span>
26+
<span className="heading">Cím</span>
2727
<Subcomponent foo="bar" />
2828
</div>
2929
);
3030
}
3131
```
3232

33-
Then you can assert:
33+
Akkor az alábbit állíthatod:
3434

3535
```javascript
3636
import ShallowRenderer from 'react-test-renderer/shallow';
3737

38-
// in your test:
38+
// a tesztedben:
3939
const renderer = new ShallowRenderer();
4040
renderer.render(<MyComponent />);
4141
const result = renderer.getRenderOutput();
4242

4343
expect(result.type).toBe('div');
4444
expect(result.props.children).toEqual([
45-
<span className="heading">Title</span>,
45+
<span className="heading">Cím</span>,
4646
<Subcomponent foo="bar" />
4747
]);
4848
```
4949

50-
Shallow testing currently has some limitations, namely not supporting refs.
50+
A sekély renderelésnek jelnelg vannak korlátai, ugyanis nem támogatja a ref-eket.
5151

52-
> Note:
52+
> Megjegyzés:
5353
>
54-
> We also recommend checking out Enzyme's [Shallow Rendering API](https://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality.
54+
> Ajánljuk továbbá, hogy nézz rá az Enzyme [Shallow Rendering API](https://airbnb.io/enzyme/docs/api/shallow.html)-jára. Ez szebb, felsőbb-szintű API-ket szolgáltat ugyanazzal a funkcionalitással.
5555
56-
## Reference {#reference}
56+
## Referencia {#reference}
5757

5858
### `shallowRenderer.render()` {#shallowrendererrender}
5959

60-
You can think of the shallowRenderer as a "place" to render the component you're testing, and from which you can extract the component's output.
60+
Gondolhatsz úgy a shallowRenderer-re, mint egy "helyre", ahova a tesztelt komponenst renderelheted és ahonnan ki tudod vonni a komponens kimenetét.
6161

62-
`shallowRenderer.render()` is similar to [`ReactDOM.render()`](/docs/react-dom.html#render) but it doesn't require DOM and only renders a single level deep. This means you can test components isolated from how their children are implemented.
62+
A `shallowRenderer.render()` hasonló a [`ReactDOM.render()`](/docs/react-dom.html#render)-hez, de nincs szüksége DOM-ra, és csak csak egy szint mélységig renderel. Ez azt jelenti, hogy a komponenseket elzártan tudod tesztelni a gyermekeik implementációjától.
6363

6464
### `shallowRenderer.getRenderOutput()` {#shallowrenderergetrenderoutput}
6565

66-
After `shallowRenderer.render()` has been called, you can use `shallowRenderer.getRenderOutput()` to get the shallowly rendered output.
66+
A `shallowRenderer.render()` meghívása után használhatod a `shallowRenderer.getRenderOutput()` metódust, hogy megkapd a sekélyen renderelt kimenetet.
6767

68-
You can then begin to assert facts about the output.
68+
Ezután nekiálhatsz tényeket megerősíteni a kimenetről.

0 commit comments

Comments
 (0)