diff --git a/content/docs/reference-test-renderer.md b/content/docs/reference-test-renderer.md index 6b25a7b35..5d9d07b39 100644 --- a/content/docs/reference-test-renderer.md +++ b/content/docs/reference-test-renderer.md @@ -6,20 +6,20 @@ layout: docs category: Reference --- -**Importing** +**ایمپورت** ```javascript import TestRenderer from 'react-test-renderer'; // ES6 const TestRenderer = require('react-test-renderer'); // ES5 with npm ``` -## Overview {#overview} +## بررسی اجمالی {#overview} -This package provides a React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment. +این پکیج یک رندر کننده ریاکت (renderer) را ارایه میکند که میتوان از آن برای رندر کامپوننتهای ریاکت به یک آبجکت جاوااسکریپت خالص، بدون وابستگی به DOM یا محیط native موبایل استفاده کرد. -Essentially, this package makes it easy to grab a snapshot of the platform view hierarchy (similar to a DOM tree) rendered by a React DOM or React Native component without using a browser or [jsdom](https://github.com/tmpvar/jsdom). +اساسا، این پکیج گرفتن یک اسنپشات از سلسله مراتب پلفترم(مشابه درخت DOM) رندر شده توسط یک DOM ریاکت یا کامپوننت ریاکت نیتیو را بدون استفاده از مرورگر یا [jsdom](https://github.com/tmpvar/jsdom) آسان میکند. -Example: +مثال: ```javascript import TestRenderer from 'react-test-renderer'; @@ -38,9 +38,9 @@ console.log(testRenderer.toJSON()); // children: [ 'Facebook' ] } ``` -You can use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: [Learn more about it](https://jestjs.io/docs/en/snapshot-testing). +شما میتوانید از قابلیت تست اسنپشات Jest برای ذخیره خودکار یک کپی از درخت JSON در یک فایل استفاده کنید و در تستهایتان بررسی کنید که تغییری نکرده باشد: [بیشتر در این مورد یاد بگیرید](https://jestjs.io/docs/en/snapshot-testing). -You can also traverse the output to find specific nodes and make assertions about them. +شما همچنین میتوانید خروجی را جهت یافتن نودهای خاص پیموده و در مورد آنها تست بسازید. ```javascript import TestRenderer from 'react-test-renderer'; @@ -72,7 +72,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); * [`TestRenderer.create()`](#testrenderercreate) * [`TestRenderer.act()`](#testrendereract) -### TestRenderer instance {#testrenderer-instance} +### نمونه TestRenderer {#testrenderer-instance} * [`testRenderer.toJSON()`](#testrenderertojson) * [`testRenderer.toTree()`](#testrenderertotree) @@ -95,7 +95,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); * [`testInstance.parent`](#testinstanceparent) * [`testInstance.children`](#testinstancechildren) -## Reference {#reference} +## مرجع {#reference} ### `TestRenderer.create()` {#testrenderercreate} @@ -103,7 +103,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); TestRenderer.create(element, options); ``` -Create a `TestRenderer` instance with the passed React element. It doesn't use the real DOM, but it still fully renders the component tree into memory so you can make assertions about it. Returns a [TestRenderer instance](#testrenderer-instance). +یک نمونه `TestRenderer` همراه با پاس دادن یک المنت ریاکت بسازید. این از DOM واقعی استفاده نمیکند، اما همچنان درخت کامپوننت را در حافظه به طور کامل رندر میکند و شما میتوانید در مورد آن تست بنویسید. یک [نمونه TestRenderer](#testrenderer-instance) باز میگرداند. ### `TestRenderer.act()` {#testrendereract} @@ -111,7 +111,7 @@ Create a `TestRenderer` instance with the passed React element. It doesn't use t TestRenderer.act(callback); ``` -Similar to the [`act()` helper from `react-dom/test-utils`](/docs/test-utils.html#act), `TestRenderer.act` prepares a component for assertions. Use this version of `act()` to wrap calls to `TestRenderer.create` and `testRenderer.update`. +مانند [[متد] کمکی `act()` از `react-dom/test-utils`](/docs/test-utils.html#act)، `TestRenderer.act` هم یک کامپوننت برای تستها (assertions) آماده میکند. از این ورژن `act()` برای دربر گرفتن فراخوانیها به `TestRenderer.create` و `testRenderer.update` استفاده کنید. ```javascript import {create, act} from 'react-test-renderer'; @@ -141,7 +141,7 @@ expect(root.toJSON()).toMatchSnapshot(); testRenderer.toJSON() ``` -Return an object representing the rendered tree. This tree only contains the platform-specific nodes like `