Skip to content

Commit aa4fa8e

Browse files
feat: done raw
1 parent 5a8d015 commit aa4fa8e

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

content/docs/addons-test-utils.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ isElementOfType(
166166
)
167167
```
168168

169-
Returns `true` if `element` is a React element whose type is of a React `componentClass`.
169+
Trả về `true` if `element` là một React element mà có kiểu thuộc React `componentClass`.
170170

171171
* * *
172172

@@ -176,7 +176,7 @@ Returns `true` if `element` is a React element whose type is of a React `compone
176176
isDOMComponent(instance)
177177
```
178178

179-
Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
179+
Trả về `true` nếu `instance` là một DOM component (như là `<div>` hoặc `<span>`).
180180

181181
* * *
182182

@@ -186,7 +186,7 @@ Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
186186
isCompositeComponent(instance)
187187
```
188188

189-
Returns `true` if `instance` is a user-defined component, such as a class or a function.
189+
Trả về `true` nếu `instance` là một component do người dùng xác định, như là class component hoặc function component.
190190

191191
* * *
192192

@@ -199,7 +199,7 @@ isCompositeComponentWithType(
199199
)
200200
```
201201

202-
Returns `true` if `instance` is a component whose type is of a React `componentClass`.
202+
Trả về `true` nếu `instance` là một component mà có kiểu thuộc React `componentClass`.
203203

204204
* * *
205205

@@ -212,7 +212,7 @@ findAllInRenderedTree(
212212
)
213213
```
214214

215-
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.
215+
Duyệt qua tất cả các component trong `tree` và dồn tất cả các component nơi mà `test(component)` `true`. Điều này tuy không hữu ích cho mình, nhưng nó được sử dụng làm nền tảng cho các hộp test khác.
216216

217217
* * *
218218

@@ -225,7 +225,7 @@ scryRenderedDOMComponentsWithClass(
225225
)
226226
```
227227

228-
Finds all DOM elements of components in the rendered tree that are DOM components with the class name matching `className`.
228+
Tìm tất cả các DOM element thuộc các component trong tree rendered mà DOM component có tên class phù hợp `className`.
229229

230230
* * *
231231

@@ -238,7 +238,7 @@ findRenderedDOMComponentWithClass(
238238
)
239239
```
240240

241-
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.
241+
Như là [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) nhưng sẽ chỉ có một kết quả, và trả về một kết quả duy nhất, hoặc throw ra exception nếu có bất kỳ kết quả nào khác trùng nhau cạnh một kết quả duy nhất.
242242

243243
* * *
244244

@@ -251,7 +251,7 @@ scryRenderedDOMComponentsWithTag(
251251
)
252252
```
253253

254-
Finds all DOM elements of components in the rendered tree that are DOM components with the tag name matching `tagName`.
254+
Tìm tất cả các DOM element trong các component trong rendered tree mà có DOM component có tên của thẻ trùng với `tagName`.
255255

256256
* * *
257257

@@ -264,7 +264,7 @@ findRenderedDOMComponentWithTag(
264264
)
265265
```
266266

267-
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.
267+
Như [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) nhưng sẽ chỉ có một kết quả, và trả về một kết quả duy nhất, hoặc throw ra exception nếu có bất kỳ kết quả nào khác trùng nhau cạnh một kết quả duy nhất.
268268

269269
* * *
270270

@@ -277,7 +277,7 @@ scryRenderedComponentsWithType(
277277
)
278278
```
279279

280-
Finds all instances of components with type equal to `componentClass`.
280+
Tìm tất cả các trường hợp của các thành phần có kiểu như `componentClass`.
281281

282282
* * *
283283

@@ -290,7 +290,7 @@ findRenderedComponentWithType(
290290
)
291291
```
292292

293-
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.
293+
Tương tự như [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) nhưng sẽ chỉ có một kết quả, và trả về một kết quả duy nhất, hoặc throw ra exception nếu có bất kỳ kết quả nào khác trùng nhau cạnh một kết quả duy nhất.
294294

295295
***
296296

@@ -300,20 +300,20 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu
300300
renderIntoDocument(element)
301301
```
302302

303-
Render a React element into a detached DOM node in the document. **This function requires a DOM.** It is effectively equivalent to:
303+
Render một React element vào trong một node DOM riêng trong một document. **Function này yêu cầu một DOM.** Nó tương tự với:
304304

305305
```js
306306
const domContainer = document.createElement('div');
307307
ReactDOM.render(element, domContainer);
308308
```
309309

310-
> Note:
310+
> Lưu ý:
311311
>
312-
> 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.
312+
> Bạn cần có `window`, `window.document` `window.document.createElement` có sẵn ở toàn cục **trước khi** bạn import `React`. Nếu không, React sẽ nghĩ rằng nó không thể truy cập DOM và các phương thức như `setState` không hoạt động.
313313
314314
* * *
315315

316-
## Other Utilities {#other-utilities}
316+
## Các tiện ích khác {#other-utilities}
317317

318318
### `Simulate` {#simulate}
319319

@@ -324,19 +324,19 @@ Simulate.{eventName}(
324324
)
325325
```
326326

327-
Simulate an event dispatch on a DOM node with optional `eventData` event data.
327+
Mô phỏng một sự kiện gửi đi trên một node DOM với tùy chọn `eventData` sự kiện của dữ liệu.
328328

329-
`Simulate` has a method for [every event that React understands](/docs/events.html#supported-events).
329+
`Simulate` có một method cho [tất cả sự kiện mà React hiểu](/docs/events.html#supported-events).
330330

331-
**Clicking an element**
331+
**Bấm vào một element**
332332

333333
```javascript
334334
// <button ref={(node) => this.button = node}>...</button>
335335
const node = this.button;
336336
ReactTestUtils.Simulate.click(node);
337337
```
338338

339-
**Changing the value of an input field and then pressing ENTER.**
339+
**Thay đổi giá trị của trường đầu vào rồi nhấn ENTER.**
340340

341341
```javascript
342342
// <input ref={(node) => this.textInput = node} />
@@ -346,8 +346,8 @@ ReactTestUtils.Simulate.change(node);
346346
ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
347347
```
348348

349-
> Note
349+
> Lưu ý
350350
>
351-
> 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.
351+
> Bạn sẽ phải cung cấp bất kỳ sự kiện property mà bạn đang dùng trong component của bạn (v.d. keyCode, which, etc...) React không tạo ra bất kỳ gì trong nó cho bạn.
352352
353353
* * *

0 commit comments

Comments
 (0)