From caccd70900e470d812be2f8e6b32a95c14c838a6 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Mon, 11 Feb 2019 19:00:41 +0700 Subject: [PATCH 1/9] translate test utilities page --- content/docs/addons-test-utils.md | 78 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index bbbf5755c..67e400e5e 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -1,27 +1,27 @@ --- id: test-utils -title: Test Utilities +title: Utilitas Tes permalink: docs/test-utils.html layout: docs category: Reference --- -**Importing** +**Pengimporan** ```javascript import ReactTestUtils from 'react-dom/test-utils'; // ES6 -var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm +var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm ``` -## Overview {#overview} +## Ikhtisar {#ikhtisar} -`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). +`ReactTestUtils` mempermudah kita melakukan tes pada komponen React dengan _framework_ tes pilihan Anda. Di Facebook kami menggunakan [Jest](https://facebook.github.io/jest/) untuk tes javascript yang tidak merepotkan. Belajar cara mulai menggunakan Jest melalui _website_ Jest [React Tutorial](http://facebook.github.io/jest/docs/en/tutorial-react.html#content). -> Note: +> Catatan: > -> 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. +> Kami menyarankan Anda untuk menggunakan [`react-testing-library`](https://git.io/react-testing-library) yang didesain untuk memungkinkan dan mendorong penulisan tes yang menggunakan komponen seperti pengguna. > -> 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. +> Pilihan lain, Airbnb telah merilis utilitas tes bernama [Enzyme](http://airbnb.io/enzyme/), yang mempermudah kita dalam menyatakan, memanipulasi, dan melewati keluaran dari komponen React Anda. - [`act()`](#act) - [`mockComponent()`](#mockcomponent) @@ -40,17 +40,17 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm - [`renderIntoDocument()`](#renderintodocument) - [`Simulate`](#simulate) -## Reference {#reference} +## Referensi {#referensi} ### `act()` {#act} -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. +Untuk menyiapkan komponen sebelum penegasan, bungkus kode yang melakukan _rendering_ komponen tersebut dan lakukan pembaruan di dalam panggilan `act()`. Hal ini membuat tes Anda berjalan menyerupai bagaimana React bekerja di _browser_. ->Note +>Catatan > ->If you use `react-test-renderer`, it also provides an `act` export that behaves the same way. +>Jika Anda menggunakan `react-test-renderer`, `react-test-renderer` juga menyediakan sebuah `act` ekspor yang sama. -For example, let's say we have this `Counter` component: +Sebagai contoh, katakanlah kita punya `Counter` komponen: ```js class App extends React.Component { @@ -83,7 +83,7 @@ class App extends React.Component { } ``` -Here is how we can test it: +Ini adalah contoh bagaimana kita bisa tes komponen ini: ```js{3,20-22,29-31} import React from 'react'; @@ -122,7 +122,7 @@ it('can render and update a counter', () => { }); ``` -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. +Jangan lupa dalam mengirim perihal DOM hanya dapat dilakukan ketika penampung DOM sudah ditambahkan ke `document`. Anda dapat menggunakan penunjang seperti [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) untuk mengurangi kode _boilerplate_. * * * @@ -135,11 +135,11 @@ mockComponent( ) ``` -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 `
` (or other tag if `mockTagName` is provided) containing any provided children. +Oper sebuah komponen tiruan ke _method_ ini untuk menambahkan _method-method_ berguna yang memperbolehkan komponen tersebut untuk digunakan sebagai komponen React tiruan. Sebagai ganti dari _rendering_ seperti biasa, komponen tiruan ini akan menjadi `
` simpel (atau tag lain jika `mockTagName` disediakan) yang menampung anak komponen yang disediakan. -> Note: +> Catatan: > -> `mockComponent()` is a legacy API. We recommend using [shallow rendering](/docs/test-utils.html#shallow-rendering) or [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock) instead. +> `mockComponent()` adalah sebuah API peninggalan. Kami menyarankan Anda menggunakan [shallow rendering](/docs/test-utils.html#shallow-rendering) atau [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock). * * * @@ -149,7 +149,7 @@ Pass a mocked component module to this method to augment it with useful methods isElement(element) ``` -Returns `true` if `element` is any React element. +Mengembalikan `true` jika `element` adalah sebuah React elemen. * * * @@ -162,7 +162,7 @@ isElementOfType( ) ``` -Returns `true` if `element` is a React element whose type is of a React `componentClass`. +Mengembalikan `true` jika `element` adalah sebuah React elemen yang memiliki tipe dari React `componentClass`. * * * @@ -172,7 +172,7 @@ Returns `true` if `element` is a React element whose type is of a React `compone isDOMComponent(instance) ``` -Returns `true` if `instance` is a DOM component (such as a `
` or ``). +Mengembalikan `true` jika `instance` adalah sebuah komponen DOM (seperti sebuah `
` atau ``). * * * @@ -182,7 +182,7 @@ Returns `true` if `instance` is a DOM component (such as a `
` or ``). isCompositeComponent(instance) ``` -Returns `true` if `instance` is a user-defined component, such as a class or a function. +Mengembalikan `true` jika `instance` adalah sebuah komponen yang ditetapkan oleh pengguna, seperti sebuah kelas atau sebuah fungsi. * * * @@ -195,7 +195,7 @@ isCompositeComponentWithType( ) ``` -Returns `true` if `instance` is a component whose type is of a React `componentClass`. +Mengembalikan `true` jika `instance` adalah sebuah komponen yang memiliki tipe dari React `componentClass`. * * * @@ -208,7 +208,7 @@ findAllInRenderedTree( ) ``` -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. +Melewati semua komponen dalam `tree` dan mengumpulkan semua komponen yang `test(component)` adalah `true`. Ini tidak begitu bermanfaat dengan dirinya sendiri, tetapi digunakan sebagai primitif untuk alat uji lainnya. * * * @@ -221,7 +221,7 @@ scryRenderedDOMComponentsWithClass( ) ``` -Finds all DOM elements of components in the rendered tree that are DOM components with the class name matching `className`. +Mencari semua DOM elemen dalam _rendered tree_ yang merupakan komponen DOM yang memiliki nama kelas sama dengan `className`. * * * @@ -234,7 +234,7 @@ findRenderedDOMComponentWithClass( ) ``` -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. +Seperti [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar protes jika ada lebih dari satu yang cocok. * * * @@ -247,7 +247,7 @@ scryRenderedDOMComponentsWithTag( ) ``` -Finds all DOM elements of components in the rendered tree that are DOM components with the tag name matching `tagName`. +Mencari semua DOM elemen dalam _rendered tree_ yang merupakan komponen DOM dengan nama label yang sama dengan `tagName`. * * * @@ -260,7 +260,7 @@ findRenderedDOMComponentWithTag( ) ``` -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. +Seperti [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar protes jika ada lebih dari satu yang cocok. * * * @@ -273,7 +273,7 @@ scryRenderedComponentsWithType( ) ``` -Finds all instances of components with type equal to `componentClass`. +Mencari semua instansi dari komponen dengan tipe yang sama dengan `componentClass`. * * * @@ -286,7 +286,7 @@ findRenderedComponentWithType( ) ``` -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. +Sama seperti [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar protes jika ada lebih dari satu yang cocok. *** @@ -296,16 +296,16 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu renderIntoDocument(element) ``` -Render a React element into a detached DOM node in the document. **This function requires a DOM.** It is effectively equivalent to: +Menggambar sebuah elemen React ke dalam sebuah DOM _node_ terpisah dalam _document_. **Fungsi ini membutuhkan sebuah DOM.** Secara efektif hal ini sama dengan: ```js const domContainer = document.createElement('div'); ReactDOM.render(element, domContainer); ``` -> Note: +> Catatan: > -> 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. +> Anda harus memiliki `window`, `window.document` dan `window.document.createElement` tersedia secara global **sebelum** Anda import `React`. Jika tidak React akan berpikir tidak dapat mengakses DOM dan _method-method_ seperti `setState` tidak akan bekerja. * * * @@ -320,11 +320,11 @@ Simulate.{eventName}( ) ``` -Simulate an event dispatch on a DOM node with optional `eventData` event data. +Mensimulasikan pengiriman sebuah perihal pada suatu DOM _node_ dengan pilihan `eventData` _event_ data. -`Simulate` has a method for [every event that React understands](/docs/events.html#supported-events). +`Simulate` memiliki sebuah _method_ untuk [every event that React understands](/docs/events.html#supported-events). -**Clicking an element** +**Mengklik sebuah elemen** ```javascript // @@ -332,7 +332,7 @@ const node = this.button; ReactTestUtils.Simulate.click(node); ``` -**Changing the value of an input field and then pressing ENTER.** +**Mengubah nilai dari sebuah bidang masukan lalu menekan ENTER.** ```javascript // this.textInput = node} /> @@ -342,8 +342,8 @@ ReactTestUtils.Simulate.change(node); ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13}); ``` -> Note +> Catatan > -> 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. +> Anda harus menyediakan _event_ properti yang Anda gunakan dalam komponen (contoh keyCode, which, dll...) karena React tidak membuat _event_ tersebut untuk Anda. * * * From f8347c8280eef24f92751bffa2fa8a52970609e2 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Tue, 12 Feb 2019 13:10:01 +0700 Subject: [PATCH 2/9] change Pengimporan --- content/docs/addons-test-utils.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index 67e400e5e..7c475ef43 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -6,7 +6,7 @@ layout: docs category: Reference --- -**Pengimporan** +**Cara Import** ```javascript import ReactTestUtils from 'react-dom/test-utils'; // ES6 From 5ed87719368d5265877f41a98f0d0d12d5cd75e3 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Tue, 12 Feb 2019 17:53:42 +0700 Subject: [PATCH 3/9] adjust some common terms --- content/docs/addons-test-utils.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index 7c475ef43..93f9b8f5d 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -15,7 +15,7 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm ## Ikhtisar {#ikhtisar} -`ReactTestUtils` mempermudah kita melakukan tes pada komponen React dengan _framework_ tes pilihan Anda. Di Facebook kami menggunakan [Jest](https://facebook.github.io/jest/) untuk tes javascript yang tidak merepotkan. Belajar cara mulai menggunakan Jest melalui _website_ Jest [React Tutorial](http://facebook.github.io/jest/docs/en/tutorial-react.html#content). +`ReactTestUtils` mempermudah kita melakukan tes pada komponen React dengan _framework_ tes pilihan Anda. Di Facebook kami menggunakan [Jest](https://facebook.github.io/jest/) untuk tes JavaScript yang tidak merepotkan. Belajar cara mulai menggunakan Jest melalui situs Jest [React Tutorial](http://facebook.github.io/jest/docs/en/tutorial-react.html#content). > Catatan: > @@ -234,7 +234,7 @@ findRenderedDOMComponentWithClass( ) ``` -Seperti [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar protes jika ada lebih dari satu yang cocok. +Seperti [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar _exception_ jika ada lebih dari satu yang cocok. * * * From a5f14194b59b86730f1d94f489fb7ef637610f6c Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Tue, 12 Feb 2019 18:03:28 +0700 Subject: [PATCH 4/9] adjust some words --- content/docs/addons-test-utils.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index 93f9b8f5d..d4e34b1e8 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -260,7 +260,7 @@ findRenderedDOMComponentWithTag( ) ``` -Seperti [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar protes jika ada lebih dari satu yang cocok. +Seperti [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar _exception_ jika ada lebih dari satu yang cocok. * * * @@ -286,7 +286,7 @@ findRenderedComponentWithType( ) ``` -Sama seperti [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar protes jika ada lebih dari satu yang cocok. +Sama seperti [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar _exception_ jika ada lebih dari satu yang cocok. *** From e43ac008ffec34487772e6b6c61a575e898f1932 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Thu, 14 Feb 2019 14:24:27 +0700 Subject: [PATCH 5/9] change some words --- content/docs/addons-test-utils.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index d4e34b1e8..8d9c59f20 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -19,7 +19,7 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm > Catatan: > -> Kami menyarankan Anda untuk menggunakan [`react-testing-library`](https://git.io/react-testing-library) yang didesain untuk memungkinkan dan mendorong penulisan tes yang menggunakan komponen seperti pengguna. +> Kami menyarankan Anda untuk menggunakan [`react-testing-library`](https://git.io/react-testing-library) yang didesain untuk memfasilitasi dan mendorong penulisan tes yang menggunakan komponen Anda selayaknya seorang pengguna sebenarnya. > > Pilihan lain, Airbnb telah merilis utilitas tes bernama [Enzyme](http://airbnb.io/enzyme/), yang mempermudah kita dalam menyatakan, memanipulasi, dan melewati keluaran dari komponen React Anda. From 2430c441fdae3716d1209903f83b3ff3590799d4 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Fri, 15 Feb 2019 10:41:49 +0700 Subject: [PATCH 6/9] translate strings in block of code --- content/docs/addons-test-utils.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index 8d9c59f20..dc35ddc54 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -60,10 +60,10 @@ class App extends React.Component { this.handleClick = this.handleClick.bind(this); } componentDidMount() { - document.title = `You clicked ${this.state.count} times`; + document.title = `Anda menekan sebanyak ${this.state.count} kali`; } componentDidUpdate() { - document.title = `You clicked ${this.state.count} times`; + document.title = `Anda menekan sebanyak ${this.state.count} kali`; } handleClick() { this.setState(state => ({ @@ -73,9 +73,9 @@ class App extends React.Component { render() { return (
-

You clicked {this.state.count} times

+

Anda telah menekan sebanyak {this.state.count} kali

); @@ -103,22 +103,22 @@ afterEach(() => { container = null; }); -it('can render and update a counter', () => { - // Test first render and componentDidMount +it('bisa render dan memperbarui counter', () => { + // Tes render pertama dan componentDidMount act(() => { ReactDOM.render(, container); }); const button = container.querySelector('button'); const label = container.querySelector('p'); - expect(label.textContent).toBe('You clicked 0 times'); - expect(document.title).toBe('You clicked 0 times'); + expect(label.textContent).toBe('Anda menekan sebanyak 0 kali'); + expect(document.title).toBe('Anda menekan sebanyak 0 kali'); - // Test second render and componentDidUpdate + // Test render kedua dan componentDidUpdate act(() => { button.dispatchEvent(new MouseEvent('click', {bubbles: true})); }); - expect(label.textContent).toBe('You clicked 1 times'); - expect(document.title).toBe('You clicked 1 times'); + expect(label.textContent).toBe('Anda menekan sebanyak 1 kali'); + expect(document.title).toBe('Anda menekan sebanyak 1 kali'); }); ``` @@ -337,7 +337,7 @@ ReactTestUtils.Simulate.click(node); ```javascript // this.textInput = node} /> const node = this.textInput; -node.value = 'giraffe'; +node.value = 'jerapah'; ReactTestUtils.Simulate.change(node); ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13}); ``` From 6db5b91847f12c280fd6c4de1e9da9a4c50164e0 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Sat, 16 Feb 2019 21:55:17 +0700 Subject: [PATCH 7/9] change some capitalized Anda --- content/docs/addons-test-utils.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index dc35ddc54..b4e70fd0f 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -15,13 +15,13 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm ## Ikhtisar {#ikhtisar} -`ReactTestUtils` mempermudah kita melakukan tes pada komponen React dengan _framework_ tes pilihan Anda. Di Facebook kami menggunakan [Jest](https://facebook.github.io/jest/) untuk tes JavaScript yang tidak merepotkan. Belajar cara mulai menggunakan Jest melalui situs Jest [React Tutorial](http://facebook.github.io/jest/docs/en/tutorial-react.html#content). +`ReactTestUtils` mempermudah kita melakukan tes pada komponen React dengan _framework_ tes pilihan anda. Di Facebook kami menggunakan [Jest](https://facebook.github.io/jest/) untuk tes JavaScript yang tidak merepotkan. Belajar cara mulai menggunakan Jest melalui situs Jest [React Tutorial](http://facebook.github.io/jest/docs/en/tutorial-react.html#content). > Catatan: > -> Kami menyarankan Anda untuk menggunakan [`react-testing-library`](https://git.io/react-testing-library) yang didesain untuk memfasilitasi dan mendorong penulisan tes yang menggunakan komponen Anda selayaknya seorang pengguna sebenarnya. +> Kami menyarankan Anda untuk menggunakan [`react-testing-library`](https://git.io/react-testing-library) yang didesain untuk memfasilitasi dan mendorong penulisan tes yang menggunakan komponen anda selayaknya seorang pengguna sebenarnya. > -> Pilihan lain, Airbnb telah merilis utilitas tes bernama [Enzyme](http://airbnb.io/enzyme/), yang mempermudah kita dalam menyatakan, memanipulasi, dan melewati keluaran dari komponen React Anda. +> Pilihan lain, Airbnb telah merilis utilitas tes bernama [Enzyme](http://airbnb.io/enzyme/), yang mempermudah kita dalam menyatakan, memanipulasi, dan melewati keluaran dari komponen React anda. - [`act()`](#act) - [`mockComponent()`](#mockcomponent) @@ -44,7 +44,7 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm ### `act()` {#act} -Untuk menyiapkan komponen sebelum penegasan, bungkus kode yang melakukan _rendering_ komponen tersebut dan lakukan pembaruan di dalam panggilan `act()`. Hal ini membuat tes Anda berjalan menyerupai bagaimana React bekerja di _browser_. +Untuk menyiapkan komponen sebelum penegasan, bungkus kode yang melakukan _rendering_ komponen tersebut dan lakukan pembaruan di dalam panggilan `act()`. Hal ini membuat tes anda berjalan menyerupai bagaimana React bekerja di _browser_. >Catatan > From 8bff2914b68eb0db1ac09d28eb8d251c367bc569 Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Mon, 18 Feb 2019 10:33:10 +0700 Subject: [PATCH 8/9] revision for some words --- content/docs/addons-test-utils.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index b4e70fd0f..697c1565f 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -44,7 +44,7 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm ### `act()` {#act} -Untuk menyiapkan komponen sebelum penegasan, bungkus kode yang melakukan _rendering_ komponen tersebut dan lakukan pembaruan di dalam panggilan `act()`. Hal ini membuat tes anda berjalan menyerupai bagaimana React bekerja di _browser_. +Untuk menyiapkan komponen sebelum penegasan, bungkus kode yang me-*render* komponen tersebut dan lakukan pembaruan di dalam panggilan `act()`. Hal ini membuat tes anda berjalan menyerupai bagaimana React bekerja di peramban. >Catatan > @@ -83,7 +83,7 @@ class App extends React.Component { } ``` -Ini adalah contoh bagaimana kita bisa tes komponen ini: +Ini adalah contoh bagaimana kita bisa menguji komponen ini: ```js{3,20-22,29-31} import React from 'react'; @@ -104,7 +104,7 @@ afterEach(() => { }); it('bisa render dan memperbarui counter', () => { - // Tes render pertama dan componentDidMount + // Uji render pertama dan componentDidMount act(() => { ReactDOM.render(, container); }); @@ -113,7 +113,7 @@ it('bisa render dan memperbarui counter', () => { expect(label.textContent).toBe('Anda menekan sebanyak 0 kali'); expect(document.title).toBe('Anda menekan sebanyak 0 kali'); - // Test render kedua dan componentDidUpdate + // Uji render kedua dan componentDidUpdate act(() => { button.dispatchEvent(new MouseEvent('click', {bubbles: true})); }); @@ -135,7 +135,7 @@ mockComponent( ) ``` -Oper sebuah komponen tiruan ke _method_ ini untuk menambahkan _method-method_ berguna yang memperbolehkan komponen tersebut untuk digunakan sebagai komponen React tiruan. Sebagai ganti dari _rendering_ seperti biasa, komponen tiruan ini akan menjadi `
` simpel (atau tag lain jika `mockTagName` disediakan) yang menampung anak komponen yang disediakan. +Oper sebuah komponen tiruan ke _method_ ini untuk menambahkan _method-method_ berguna yang memperbolehkan komponen tersebut untuk digunakan sebagai komponen React tiruan. Sebagai ganti dari _rendering_ seperti biasa, komponen tiruan ini akan menjadi `
` sederhana (atau tag lain jika `mockTagName` disediakan) yang menampung anak komponen yang disediakan. > Catatan: > @@ -234,7 +234,7 @@ findRenderedDOMComponentWithClass( ) ``` -Seperti [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar _exception_ jika ada lebih dari satu yang cocok. +Seperti [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass) tetapi mengharapkan satu hasil dan mengembalikan satu hasil tersebut atau melempar _exception_ jika ada lebih dari satu yang cocok. * * * @@ -260,7 +260,7 @@ findRenderedDOMComponentWithTag( ) ``` -Seperti [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar _exception_ jika ada lebih dari satu yang cocok. +Seperti [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag) tetapi mengharapkan satu hasil dan mengembalikan satu hasil tersebut atau melempar _exception_ jika ada lebih dari satu yang cocok. * * * @@ -286,7 +286,7 @@ findRenderedComponentWithType( ) ``` -Sama seperti [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) tetapi mengharapkan satu hasil, dan mengembalikan satu hasil tersebut, atau melempar _exception_ jika ada lebih dari satu yang cocok. +Sama seperti [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) tetapi mengharapkan satu hasil dan mengembalikan satu hasil tersebut atau melempar _exception_ jika ada lebih dari satu yang cocok. *** @@ -324,7 +324,7 @@ Mensimulasikan pengiriman sebuah perihal pada suatu DOM _node_ dengan pilihan `e `Simulate` memiliki sebuah _method_ untuk [every event that React understands](/docs/events.html#supported-events). -**Mengklik sebuah elemen** +**Klik sebuah elemen** ```javascript // From 8533b7a808935772f084d702ab33588737b572be Mon Sep 17 00:00:00 2001 From: Luke Reonaldo Date: Mon, 25 Feb 2019 09:32:10 +0700 Subject: [PATCH 9/9] remove extra line --- content/docs/addons-test-utils.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index 4dd60f313..fdc16ecc4 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -21,7 +21,6 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 dengan npm > > Kami menyarankan Anda untuk menggunakan [`react-testing-library`](https://git.io/react-testing-library) yang didesain untuk memfasilitasi dan mendorong penulisan tes yang menggunakan komponen anda selayaknya seorang pengguna sebenarnya. > - > Pilihan lain, Airbnb telah merilis utilitas tes bernama [Enzyme](https://airbnb.io/enzyme/), yang mempermudah kita dalam menyatakan, memanipulasi, dan melewati keluaran dari komponen React anda. - [`act()`](#act)