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
Copy file name to clipboardExpand all lines: content/blog/2019-02-23-is-react-translated-yet.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ We started of with an initial trial period of three languages: Spanish, Japanese
43
43
44
44
After the trial period, we were ready to accept more languages. I created [a script](https://github.com/reactjs/reactjs.org-translation/blob/master/scripts/create.js) to automate the creation of the new language repo, and a site, [Is React Translated Yet?](https://isreacttranslatedyet.com), to track progress on the different translations. We started *10* new translations on our first day alone!
45
45
46
-
Because of the automation, the rest of the maintance went mostly smoothly. We eventually created a [Slack channel](https://rt-slack-invite.herokuapp.com) to make it easier for translators to share information, and I released a guide solidifying the [responsibilities of maintainers](https://github.com/reactjs/reactjs.org-translation/blob/master/maintainer-guide.md). Allowing translators to talk with each other was a great boon -- for example, the Arabic, Persian, and Hebrew translations were able to talk to each other in order to get [right-to-left text](https://en.wikipedia.org/wiki/Right-to-left) working!
46
+
Because of the automation, the rest of the maintenance went mostly smoothly. We eventually created a [Slack channel](https://rt-slack-invite.herokuapp.com) to make it easier for translators to share information, and I released a guide solidifying the [responsibilities of maintainers](https://github.com/reactjs/reactjs.org-translation/blob/master/maintainer-guide.md). Allowing translators to talk with each other was a great boon -- for example, the Arabic, Persian, and Hebrew translations were able to talk to each other in order to get [right-to-left text](https://en.wikipedia.org/wiki/Right-to-left) working!
var ShallowRenderer =require('react-test-renderer/shallow'); //ES5 with npm
13
+
var ShallowRenderer =require('react-test-renderer/shallow'); //npm에서 ES5를 사용하는 경우
14
14
```
15
15
16
-
## Overview {#overview}
16
+
## 개요 {#overview}
17
17
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를 위한 유닛 테스트를 작성할 때 얕은 렌더링이 유용할 수 있습니다. 얕은 렌더링은 컴포넌트를 "한 단계 깊이"로 렌더링할 수 있으며 인스턴스화 또는 렌더링 되지 않는 자식 컴포넌트의 동작에 대해 걱정 없이 렌더링 메소드가 무엇을 반환하는지에 대해 검증할 수 있습니다. 이 작업은 DOM이 필요하지 않습니다.
Shallow testing currently has some limitations, namely not supporting refs.
50
+
얕은 테스팅은 현재 몇 가지 제한 사항이 있습니다. 다시 말해 refs를 지원하지 않습니다.
51
51
52
-
> Note:
52
+
> 주의
53
53
>
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
+
> 우리는 또한 Enzyme의 [Shallow Rendering API](https://airbnb.io/enzyme/docs/api/shallow.html)를 확인해 볼 것을 권장합니다. 같은 기능에 대해 더 높은 수준의 API를 제공합니다.
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는 테스트 중인 컴포넌트를 렌더링하는 "장소(place)"로 생각할 수 있으며 이것으로부터 컴포넌트의 출력을 추출할 수 있습니다.
61
61
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을 요구하지 않으며 오직 한 단계 깊이만을 렌더링합니다. 이것은 컴포넌트의 자식들이 어떻게 구현되었는지 신경 쓰지 않고 독립적으로 테스트할 수 있음을 의미합니다.
var ReactTestUtils =require('react-dom/test-utils'); //ES5 with npm
13
+
var ReactTestUtils =require('react-dom/test-utils'); //npm과 ES5
14
14
```
15
15
16
-
## Overview {#overview}
16
+
## 개요 {#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
+
`ReactTestUtils`는 여러분이 선택한 테스팅 프레임워크에서 테스트를 쉽게 진행할 수 있도록 해 줍니다. Facebook에서는 [Jest](https://facebook.github.io/jest/)를 이용해 더욱 쉽게 JavaScript 테스트를 하고 있습니다. Jest 웹사이트의 [React 자습서](https://jestjs.io/docs/tutorial-react) 문서를 통해 Jest를 시작하는 방법에 대해서 알아보세요.
19
19
20
-
> Note:
20
+
> 주의
21
21
>
22
-
> We recommend using [`react-testing-library`](https://git.io/react-testing-library)which is designed to enable and encourage writing tests that use your components as the end users do.
22
+
> Facebook에서는 [`react-testing-library`](https://git.io/react-testing-library)사용을 권장합니다. 이 라이브러리는 사용자가 컴포넌트를 사용하는 것처럼 테스트를 작성할 수 있도록 설계되었습니다.
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
+
> 대안으로는 Airbnb에서 출시한 테스팅 도구인 [Enzyme](https://airbnb.io/enzyme/)이 있습니다. Enzyme은 React 컴포넌트의 출력을 쉽게 검증하고 조작하고 탐색할 수 있게 해줍니다.
25
25
26
26
-[`act()`](#act)
27
27
-[`mockComponent()`](#mockcomponent)
@@ -40,20 +40,21 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
40
40
-[`renderIntoDocument()`](#renderintodocument)
41
41
-[`Simulate`](#simulate)
42
42
43
-
## Reference {#reference}
43
+
## 참조사항 {#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
+
컴포넌트의 진단을 준비하기 위해서는 컴포넌트를 렌더링하고 갱신해주는 코드를 `act()`를 호출한 것의 안에 넣어줘야 합니다. 이를 통해 React를 브라우저 내에서 동작하는 것과 비슷한 환경에서 테스트할 수 있습니다.
48
48
49
-
>Note
49
+
>주의
50
50
>
51
-
>If you use `react-test-renderer`, it also provides an `act` export that behaves the same way.
51
+
>`react-test-renderer`를 사용한다면, 똑같이 작동하는 `act` export가 제공됩니다.
52
+
53
+
예를 들어, 다음과 같은 `Counter` 컴포넌트가 있다고 해봅시다.
52
54
53
-
For example, let's say we have this `Counter` component:
54
55
55
56
```js
56
-
classAppextendsReact.Component {
57
+
classCounterextendsReact.Component {
57
58
constructor(props) {
58
59
super(props);
59
60
this.state= {count:0};
@@ -83,7 +84,7 @@ class App extends React.Component {
83
84
}
84
85
```
85
86
86
-
Here is how we can test it:
87
+
이런 방식으로 테스트 할 수 있습니다.
87
88
88
89
```js{3,20-22,29-31}
89
90
import React from 'react';
@@ -104,7 +105,7 @@ afterEach(() => {
104
105
});
105
106
106
107
it('can render and update a counter', () => {
107
-
// Test first render and componentDidMount
108
+
// 첫 render와 componentDidMount를 테스트
108
109
act(() => {
109
110
ReactDOM.render(<Counter />, container);
110
111
});
@@ -113,7 +114,7 @@ it('can render and update a counter', () => {
@@ -122,7 +123,7 @@ it('can render and update a counter', () => {
122
123
});
123
124
```
124
125
125
-
Don't forget that dispatching DOM events only works when the DOM container is added to the `document`. You can use a helper like[`react-testing-library`](https://github.com/kentcdodds/react-testing-library) to reduce the boilerplate code.
126
+
DOM 이벤트를 붙이는 것은 DOM 컨테이너가 `document` 객체에 추가되었을 때에만 가능하다는 것을 기억하십시오. 불필요하게 반복 되는 코드를 줄이기 위해서[`react-testing-library`](https://github.com/kentcdodds/react-testing-library)와 같은 것들을 사용할 수 있습니다.
126
127
127
128
* * *
128
129
@@ -135,11 +136,12 @@ mockComponent(
135
136
)
136
137
```
137
138
138
-
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.
139
+
모의 컴포넌트 모듈을 이 메서드에 넘겨 유용한 메서드들을 붙여 증강해 더미 리액트 컴포넌트로 사용할 수 있습니다. 보통의 경우처럼 렌더링 하지 않고 그 대신 컴포넌트는 간단하게 `<div>` 태그가 됩니다. `mockTagName`값을 넘겨준다면 `<div>`대신 다른 태그로 만들어 줄 수 있습니다.
140
+
139
141
140
-
> Note:
142
+
> 주의
141
143
>
142
-
> `mockComponent()` is a legacy API. We recommend using [shallow rendering](/docs/shallow-renderer.html)or[`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock) instead.
144
+
> `mockComponent()`는 더이상 쓰이지 않는 API입니다. 저희는 [얕은 복사](/docs/shallow-renderer.html)혹은[`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock)을 사용하는 것을 추천합니다.
143
145
144
146
* * *
145
147
@@ -149,7 +151,7 @@ Pass a mocked component module to this method to augment it with useful methods
149
151
isElement(element)
150
152
```
151
153
152
-
Returns `true` if `element` is any React element.
154
+
`element`가 React의 element라면 `true`를 반환합니다.
153
155
154
156
* * *
155
157
@@ -162,7 +164,7 @@ isElementOfType(
162
164
)
163
165
```
164
166
165
-
Returns `true` if `element` is a React element whose type is of a React `componentClass`.
167
+
`element`가 `componentClass` 타입의 React element라면 `true`를 반환합니다.
166
168
167
169
* * *
168
170
@@ -172,7 +174,7 @@ Returns `true` if `element` is a React element whose type is of a React `compone
172
174
isDOMComponent(instance)
173
175
```
174
176
175
-
Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
177
+
`instance`가 `<div>`나 `<span>`같은 DOM 컴포넌트라면 `true`를 반환합니다.
176
178
177
179
* * *
178
180
@@ -182,7 +184,7 @@ Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
182
184
isCompositeComponent(instance)
183
185
```
184
186
185
-
Returns `true` if `instance` is a user-defined component, such as a class or a function.
187
+
`instance`가 클래스나 함수 같이 사용자가 정의한 컴포넌트라면 `true`를 반환합니다.
186
188
187
189
* * *
188
190
@@ -195,7 +197,7 @@ isCompositeComponentWithType(
195
197
)
196
198
```
197
199
198
-
Returns `true` if `instance` is a component whose type is of a React `componentClass`.
200
+
`instance`가 `componentClass` 타입을 가진 컴포넌트라면 `true`를 반환합니다.
199
201
200
202
* * *
201
203
@@ -208,7 +210,7 @@ findAllInRenderedTree(
208
210
)
209
211
```
210
212
211
-
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
+
`tree`의 모든 컴포넌트를 탐색하여 `test(component)`가 `true`일 때 모든 컴포넌트를 축적합니다. 이 함수는 그 자체만으로는 유용하지 않지만, 다른 테스트 도구의 기반이 됩니다.
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
+
[`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass)와 기능이 유사하나 결과값이 하나라고 가정하고 그 결과값만을 반환합니다. 두 개 이상의 결과값이 있다면 예외를 반환합니다.
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
+
[`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag)와 기능이 유사하나 결과값이 하나라고 가정하고 그 결과값만을 반환합니다. 두 개 이상의 결과값이 있다면 예외를 뱉습니다.
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
+
[`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype)와 기능이 유사하나 결과값이 하나라고 가정하고 그 결과값만을 반환합니다. 두 개 이상의 결과값이 있다면 예외를 뱉습니다.
290
292
291
293
***
292
294
@@ -296,20 +298,20 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu
296
298
renderIntoDocument(element)
297
299
```
298
300
299
-
Render a React element into a detached DOM node in the document. **This function requires a DOM.**It is effectively equivalent to:
301
+
React 엘리먼트를 document내의 떨어져 있는 DOM 노드에 렌더링합니다. **이 함수를 쓰려면 DOM이 필요합니다.**이 함수는 다음 코드와 같은 기능을 합니다.
300
302
301
303
```js
302
304
constdomContainer=document.createElement('div');
303
305
ReactDOM.render(element, domContainer);
304
306
```
305
307
306
-
> Note:
308
+
> 주의
307
309
>
308
-
> 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
+
> `window`, `window.document`와 `window.document.createElement`는 `React`를 **가져와서 사용하기 전에도**전역적으로 사용할 수 있습니다. 만약 그렇지 않다면 React는 DOM에 접근할 수 없다고 간주할 것이며 `setState`와 같은 메서드들이 작동하지 않을 것 입니다.
309
311
310
312
* * *
311
313
312
-
## Other Utilities {#other-utilities}
314
+
## 다른 테스팅 도구들 {#other-utilities}
313
315
314
316
### `Simulate` {#simulate}
315
317
@@ -320,19 +322,20 @@ Simulate.{eventName}(
320
322
)
321
323
```
322
324
323
-
Simulate an event dispatch on a DOM node with optional `eventData` event data.
325
+
이벤트 데이터인 `eventData`를 옵션으로 준 DOM 노드에 붙이는 이벤트를 시뮬레이팅합니다.
324
326
325
-
`Simulate` has a method for [every event that React understands](/docs/events.html#supported-events).
327
+
`Simulate`는 [React가 이해하는 모든 이벤트](/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.
350
+
> 컴포넌트 내에서 사용하고 있는 keyCode, which와 같은 이벤트 프로퍼티는 별도로 제공해주어야 합니다. React에서는 이러한 이벤트 프로퍼티를 자동으로 만들어 주지 않습니다.
0 commit comments