Skip to content

Commit bd38580

Browse files
committed
Translation #part01 of test-utilities.
1 parent 853891f commit bd38580

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

content/docs/addons-test-utils.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
id: test-utils
3-
title: Test Utilities
3+
title: Test Araçları
44
permalink: docs/test-utils.html
55
layout: docs
66
category: Reference
77
---
88

9-
**Importing**
9+
**Ekleme**
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'); // ES5 npm ile
1414
```
1515

1616
## Overview {#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](http://facebook.github.io/jest/docs/en/tutorial-react.html#content).
18+
`ReactTestUtils`, React bileşenlerini seçtiğiniz test çerçevesinde test etmeyi kolaylaştırır. Facebook'ta kolay bir şekilde JavaScript testi için [Jest](https://facebook.github.io/jest/)'i kullanmaktayız. Jest web sitesinde [React](http://facebook.github.io/jest/docs/en/tutorial-react.html#content) ile Jest'e nasıl başlayacağınızı öğrenebilirsiniz.
1919

20-
> Note:
20+
> Not:
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+
> Bileşenlerinizi son kullanıcılarmışcasına gibi kullanan test testlerini etkinleştirmek ve kullanabilmek için tasarlanmış [`react-testing-library`](https://git.io/react-testing-library) kullanmanızı öneririz.
2323
>
24-
> Alternatively, Airbnb has released a testing utility called [Enzyme](http://airbnb.io/enzyme/), which makes it easy to assert, manipulate, and traverse your React Components' output.
24+
> Alternatif olarak, Airbnb, React bileşenlerinin çıktısını belirlemenizi, değiştirmenizi ve değiştirmenizi kolaylaştıran [Enzyme](http://airbnb.io/enzyme/) adında bir test programı yayınladı.
2525
2626
- [`act()`](#act)
2727
- [`mockComponent()`](#mockcomponent)
@@ -40,17 +40,17 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
4040
- [`renderIntoDocument()`](#renderintodocument)
4141
- [`Simulate`](#simulate)
4242

43-
## Reference {#reference}
43+
## Referanslar {#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+
Bileşen testlerini hazırlamak için, kodunuzu paket haline getirin ve bunu `act()` çağrısıyla içeride güncelleme gerçekleştirebilirsiniz. Bu sizin testinizi React'in tarayıcıda çalışma biçimine çok yakın bir şekilde çalıştırmanızı sağlar.
4848

49-
>Note
49+
>Not
5050
>
51-
>If you use `react-test-renderer`, it also provides an `act` export that behaves the same way.
51+
>Eğer `react-test-renderer`'ı kullanırsanız, bu size `act` çıktısının aynı şekilde davranmasını sağlar.
5252
53-
For example, let's say we have this `Counter` component:
53+
Örneğin `Counter` bileşenimizin olduğunu düşünün:
5454

5555
```js
5656
class App extends React.Component {
@@ -60,10 +60,10 @@ class App extends React.Component {
6060
this.handleClick = this.handleClick.bind(this);
6161
}
6262
componentDidMount() {
63-
document.title = `You clicked ${this.state.count} times`;
63+
document.title = `${this.state.count} kez tıkladınız`;
6464
}
6565
componentDidUpdate() {
66-
document.title = `You clicked ${this.state.count} times`;
66+
document.title = `${this.state.count} kez tıkladınız`;
6767
}
6868
handleClick() {
6969
this.setState(state => ({
@@ -73,17 +73,17 @@ class App extends React.Component {
7373
render() {
7474
return (
7575
<div>
76-
<p>You clicked {this.state.count} times</p>
76+
<p>{this.state.count} kez tıkladınız</p>
7777
<button onClick={this.handleClick}>
78-
Click me
78+
Beni tıkla
7979
</button>
8080
</div>
8181
);
8282
}
8383
}
8484
```
8585

86-
Here is how we can test it:
86+
Şu şekilde test edebiliriz:
8787

8888
```js{3,20-22,29-31}
8989
import React from 'react';
@@ -103,8 +103,8 @@ afterEach(() => {
103103
container = null;
104104
});
105105
106-
it('can render and update a counter', () => {
107-
// Test first render and componentDidMount
106+
it('sayacı ekrana çizebilir ve güncelleyebilir', () => {
107+
// İlk render ve componentDidMount'u test eder
108108
act(() => {
109109
ReactDOM.render(<Counter />, container);
110110
});
@@ -113,12 +113,12 @@ it('can render and update a counter', () => {
113113
expect(label.textContent).toBe('You clicked 0 times');
114114
expect(document.title).toBe('You clicked 0 times');
115115
116-
// Test second render and componentDidUpdate
116+
// İkinci render and componentDidUpdate'u test eder
117117
act(() => {
118118
button.dispatchEvent(new MouseEvent('click', {bubbles: true}));
119119
});
120-
expect(label.textContent).toBe('You clicked 1 times');
121-
expect(document.title).toBe('You clicked 1 times');
120+
expect(label.textContent).toBe('1 kez tıkladınız');
121+
expect(document.title).toBe('1 kez tıkladınız');
122122
});
123123
```
124124

0 commit comments

Comments
 (0)