Skip to content

Commit ad127ad

Browse files
authored
Merge branch 'master' into CDN-links
2 parents cf1f3db + 6b92185 commit ad127ad

15 files changed

+610
-322
lines changed

content/blog/2019-02-23-is-react-translated-yet.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ We started of with an initial trial period of three languages: Spanish, Japanese
4343

4444
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!
4545

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!
4747

4848
## The Bot {#the-bot}
4949

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
22
id: shallow-renderer
3-
title: Shallow Renderer
3+
title: 얕은 렌더러
44
permalink: docs/shallow-renderer.html
55
layout: docs
66
category: Reference
77
---
88

9-
**Importing**
9+
**불러오기**
1010

1111
```javascript
1212
import ShallowRenderer from 'react-test-renderer/shallow'; // ES6
13-
var ShallowRenderer = require('react-test-renderer/shallow'); // ES5 with npm
13+
var ShallowRenderer = require('react-test-renderer/shallow'); // npm에서 ES5를 사용하는 경우
1414
```
1515

16-
## Overview {#overview}
16+
## 개요 {#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+
React를 위한 유닛 테스트를 작성할 때 얕은 렌더링이 유용할 수 있습니다. 얕은 렌더링은 컴포넌트를 "한 단계 깊이"로 렌더링할 수 있으며 인스턴스화 또는 렌더링 되지 않는 자식 컴포넌트의 동작에 대해 걱정 없이 렌더링 메소드가 무엇을 반환하는지에 대해 검증할 수 있습니다. 이 작업은 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+
다음과 같이 검증할 수 있습니다.
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+
얕은 테스팅은 현재 몇 가지 제한 사항이 있습니다. 다시 말해 refs를 지원하지 않습니다.
5151

52-
> Note:
52+
> 주의
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+
> 우리는 또한 Enzyme의 [Shallow Rendering API](https://airbnb.io/enzyme/docs/api/shallow.html)를 확인해 볼 것을 권장합니다. 같은 기능에 대해 더 높은 수준의 API를 제공합니다.
5555
56-
## Reference {#reference}
56+
## 참조 {#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+
shallowRenderer는 테스트 중인 컴포넌트를 렌더링하는 "장소(place)"로 생각할 수 있으며 이것으로부터 컴포넌트의 출력을 추출할 수 있습니다.
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을 요구하지 않으며 오직 한 단계 깊이만을 렌더링합니다. 이것은 컴포넌트의 자식들이 어떻게 구현되었는지 신경 쓰지 않고 독립적으로 테스트할 수 있음을 의미합니다.
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+
`shallowRenderer.render()`가 호출된 후 `shallowRenderer.getRenderOutput()`을 사용하여 얕게 렌더링 된 출력을 얻을 수 있습니다.
6767

68-
You can then begin to assert facts about the output.
68+
그러면 출력에 대해 검증을 시작할 수 있습니다.

content/docs/addons-test-utils.md

+46-42
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: test-utils
3-
title: Test Utilities
3+
title: 테스팅 도구
44
permalink: docs/test-utils.html
55
layout: docs
66
category: Reference
@@ -10,18 +10,18 @@ category: Reference
1010

1111
```javascript
1212
import ReactTestUtils from 'react-dom/test-utils'; // ES6
13-
var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
13+
var ReactTestUtils = require('react-dom/test-utils'); // npm과 ES5
1414
```
1515

16-
## Overview {#overview}
16+
## 개요 {#overview}
1717

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를 시작하는 방법에 대해서 알아보세요.
1919

20-
> Note:
20+
> 주의
2121
>
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) 사용을 권장합니다. 이 라이브러리는 사용자가 컴포넌트를 사용하는 것처럼 테스트를 작성할 수 있도록 설계되었습니다.
2323
>
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 컴포넌트의 출력을 쉽게 검증하고 조작하고 탐색할 수 있게 해줍니다.
2525
2626
- [`act()`](#act)
2727
- [`mockComponent()`](#mockcomponent)
@@ -40,20 +40,21 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
4040
- [`renderIntoDocument()`](#renderintodocument)
4141
- [`Simulate`](#simulate)
4242

43-
## Reference {#reference}
43+
## 참조사항 {#reference}
4444

4545
### `act()` {#act}
4646

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를 브라우저 내에서 동작하는 것과 비슷한 환경에서 테스트할 수 있습니다.
4848

49-
>Note
49+
>주의
5050
>
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` 컴포넌트가 있다고 해봅시다.
5254

53-
For example, let's say we have this `Counter` component:
5455

5556
```js
56-
class App extends React.Component {
57+
class Counter extends React.Component {
5758
constructor(props) {
5859
super(props);
5960
this.state = {count: 0};
@@ -83,7 +84,7 @@ class App extends React.Component {
8384
}
8485
```
8586

86-
Here is how we can test it:
87+
이런 방식으로 테스트 할 수 있습니다.
8788

8889
```js{3,20-22,29-31}
8990
import React from 'react';
@@ -104,7 +105,7 @@ afterEach(() => {
104105
});
105106
106107
it('can render and update a counter', () => {
107-
// Test first render and componentDidMount
108+
// 첫 render와 componentDidMount를 테스트
108109
act(() => {
109110
ReactDOM.render(<Counter />, container);
110111
});
@@ -113,7 +114,7 @@ it('can render and update a counter', () => {
113114
expect(label.textContent).toBe('You clicked 0 times');
114115
expect(document.title).toBe('You clicked 0 times');
115116
116-
// Test second render and componentDidUpdate
117+
// 두 번째 render와 componentDidUpdate를 테스트
117118
act(() => {
118119
button.dispatchEvent(new MouseEvent('click', {bubbles: true}));
119120
});
@@ -122,7 +123,7 @@ it('can render and update a counter', () => {
122123
});
123124
```
124125

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)와 같은 것들을 사용할 수 있습니다.
126127

127128
* * *
128129

@@ -135,11 +136,12 @@ mockComponent(
135136
)
136137
```
137138

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+
139141

140-
> Note:
142+
> 주의
141143
>
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)을 사용하는 것을 추천합니다.
143145
144146
* * *
145147

@@ -149,7 +151,7 @@ Pass a mocked component module to this method to augment it with useful methods
149151
isElement(element)
150152
```
151153

152-
Returns `true` if `element` is any React element.
154+
`element`가 React의 element라면 `true`를 반환합니다.
153155

154156
* * *
155157

@@ -162,7 +164,7 @@ isElementOfType(
162164
)
163165
```
164166

165-
Returns `true` if `element` is a React element whose type is of a React `componentClass`.
167+
`element``componentClass` 타입의 React element라면 `true`를 반환합니다.
166168

167169
* * *
168170

@@ -172,7 +174,7 @@ Returns `true` if `element` is a React element whose type is of a React `compone
172174
isDOMComponent(instance)
173175
```
174176

175-
Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
177+
`instance``<div>``<span>`같은 DOM 컴포넌트라면 `true`를 반환합니다.
176178

177179
* * *
178180

@@ -182,7 +184,7 @@ Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
182184
isCompositeComponent(instance)
183185
```
184186

185-
Returns `true` if `instance` is a user-defined component, such as a class or a function.
187+
`instance`가 클래스나 함수 같이 사용자가 정의한 컴포넌트라면 `true`를 반환합니다.
186188

187189
* * *
188190

@@ -195,7 +197,7 @@ isCompositeComponentWithType(
195197
)
196198
```
197199

198-
Returns `true` if `instance` is a component whose type is of a React `componentClass`.
200+
`instance``componentClass` 타입을 가진 컴포넌트라면 `true`를 반환합니다.
199201

200202
* * *
201203

@@ -208,7 +210,7 @@ findAllInRenderedTree(
208210
)
209211
```
210212

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`일 때 모든 컴포넌트를 축적합니다. 이 함수는 그 자체만으로는 유용하지 않지만, 다른 테스트 도구의 기반이 됩니다.
212214

213215
* * *
214216

@@ -221,7 +223,7 @@ scryRenderedDOMComponentsWithClass(
221223
)
222224
```
223225

224-
Finds all DOM elements of components in the rendered tree that are DOM components with the class name matching `className`.
226+
렌더링 된 트리에서 조건 `className`에 만족하는 class명을 가지고 있는 DOM 컴포넌트의 DOM 엘리먼트를 모두 검색합니다.
225227

226228
* * *
227229

@@ -234,7 +236,7 @@ findRenderedDOMComponentWithClass(
234236
)
235237
```
236238

237-
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)와 기능이 유사하나 결과값이 하나라고 가정하고 그 결과값만을 반환합니다. 두 개 이상의 결과값이 있다면 예외를 반환합니다.
238240

239241
* * *
240242

@@ -247,7 +249,7 @@ scryRenderedDOMComponentsWithTag(
247249
)
248250
```
249251

250-
Finds all DOM elements of components in the rendered tree that are DOM components with the tag name matching `tagName`.
252+
렌더링 된 트리 내에서 조건 `tagName`에 만족하는 tag명을 가진 DOM 컴포넌트의 DOM 엘리먼트를 모두 검색합니다.
251253

252254
* * *
253255

@@ -260,7 +262,7 @@ findRenderedDOMComponentWithTag(
260262
)
261263
```
262264

263-
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)와 기능이 유사하나 결과값이 하나라고 가정하고 그 결과값만을 반환합니다. 두 개 이상의 결과값이 있다면 예외를 뱉습니다.
264266

265267
* * *
266268

@@ -273,7 +275,7 @@ scryRenderedComponentsWithType(
273275
)
274276
```
275277

276-
Finds all instances of components with type equal to `componentClass`.
278+
`componentClass` 타입을 가진 모든 인스턴스를 검색합니다.
277279

278280
* * *
279281

@@ -286,7 +288,7 @@ findRenderedComponentWithType(
286288
)
287289
```
288290

289-
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)와 기능이 유사하나 결과값이 하나라고 가정하고 그 결과값만을 반환합니다. 두 개 이상의 결과값이 있다면 예외를 뱉습니다.
290292

291293
***
292294

@@ -296,20 +298,20 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu
296298
renderIntoDocument(element)
297299
```
298300

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이 필요합니다.** 이 함수는 다음 코드와 같은 기능을 합니다.
300302

301303
```js
302304
const domContainer = document.createElement('div');
303305
ReactDOM.render(element, domContainer);
304306
```
305307

306-
> Note:
308+
> 주의
307309
>
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`와 같은 메서드들이 작동하지 않을 것 입니다.
309311
310312
* * *
311313

312-
## Other Utilities {#other-utilities}
314+
## 다른 테스팅 도구들 {#other-utilities}
313315

314316
### `Simulate` {#simulate}
315317

@@ -320,19 +322,20 @@ Simulate.{eventName}(
320322
)
321323
```
322324

323-
Simulate an event dispatch on a DOM node with optional `eventData` event data.
325+
이벤트 데이터인 `eventData`를 옵션으로 준 DOM 노드에 붙이는 이벤트를 시뮬레이팅합니다.
324326

325-
`Simulate` has a method for [every event that React understands](/docs/events.html#supported-events).
327+
`Simulate`[React가 이해하는 모든 이벤트](/docs/events.html#supported-events)를 위한 메서드를 가집니다.
326328

327-
**Clicking an element**
329+
330+
**엘리먼트 클릭**
328331

329332
```javascript
330333
// <button ref={(node) => this.button = node}>...</button>
331334
const node = this.button;
332335
ReactTestUtils.Simulate.click(node);
333336
```
334337

335-
**Changing the value of an input field and then pressing ENTER.**
338+
**입력 필드의 값을 바꾼 뒤 ENTER키 누르기**
336339

337340
```javascript
338341
// <input ref={(node) => this.textInput = node} />
@@ -342,8 +345,9 @@ ReactTestUtils.Simulate.change(node);
342345
ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
343346
```
344347

345-
> Note
348+
> 주의
346349
>
347-
> 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에서는 이러한 이벤트 프로퍼티를 자동으로 만들어 주지 않습니다.
351+
348352

349353
* * *

0 commit comments

Comments
 (0)