Skip to content

Commit 81db23d

Browse files
sakit0koba04
authored andcommitted
Translate shallow-renderer (#56)
* translate shallow-renderer * レンダリング => レンダー * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]> * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]> * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]> * 英字、数字の前後に空白を入れる修正 * 不要に訳し過ぎていたと思う部分を修正 * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]> * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]> * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]> * Update content/docs/addons-shallow-renderer.md Co-Authored-By: sakito21 <[email protected]>
1 parent 17d99b3 commit 81db23d

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

content/docs/addons-shallow-renderer.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ id: shallow-renderer
33
title: Shallow Renderer
44
permalink: docs/shallow-renderer.html
55
layout: docs
6-
category: Reference
6+
category: リファレンス
77
---
88

9-
**Importing**
9+
**インポート**
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
16+
## 概要
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+
React の単体テストを実装するとき、Shallow Renderer が役立つでしょう。浅いレンダー (shallow rendering) を使用すると、インスタンス化またはレンダーされていない子コンポーネントの振る舞いを心配することなく、「1 階層深く」レンダーしてレンダーメソッドが返すものを assert できます。これに DOM は必要ありません。
1919

20-
For example, if you have the following component:
20+
たとえば、以下のコンポーネントがある場合:
2121

2222
```javascript
2323
function MyComponent() {
@@ -30,7 +30,7 @@ function MyComponent() {
3030
}
3131
```
3232

33-
Then you can assert:
33+
以下のように assert できます:
3434

3535
```javascript
3636
import ShallowRenderer from 'react-test-renderer/shallow';
@@ -47,22 +47,22 @@ expect(result.props.children).toEqual([
4747
]);
4848
```
4949

50-
Shallow testing currently has some limitations, namely not supporting refs.
50+
浅いレンダーによるテストには現在いくつかの制限があります。すなわち ref をサポートしていません。
5151

52-
> Note:
52+
> 補足:
5353
>
54-
> We also recommend checking out Enzyme's [Shallow Rendering API](http://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality.
54+
> また Enzyme[Shallow Rendering API](http://airbnb.io/enzyme/docs/api/shallow.html) をチェックすることをお勧めします。それは同じ機能上でより良くより高いレベルの API を提供します。
5555
56-
## Reference
56+
## リファレンス
5757

5858
### `shallowRenderer.render()`
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+
shallowRenderer は、テストしているコンポーネントをレンダーするための「場所」と捉えることができ、そこからコンポーネントの出力を抽出できます。
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+
`shallowRenderer.render()` [`ReactDOM.render()`](/docs/react-dom.html#render) に似ていますが、 DOM を必要とせず、1 階層だけレンダーします。つまり、テスト対象のコンポーネントが持つ子コンポーネントの実装から分離してテストを実行できます。
6363

6464
### `shallowRenderer.getRenderOutput()`
6565

66-
After `shallowRenderer.render()` has been called, you can use `shallowRenderer.getRenderOutput()` to get the shallowly rendered output.
66+
`shallowRenderer.render()` が呼び出された後、`shallowRenderer.getRenderOutput()` を使用して浅くレンダーされた出力を取得できます。
6767

68-
You can then begin to assert facts about the output.
68+
そして出力から得た結果の assert を開始できます。

0 commit comments

Comments
 (0)