From b752dc8f9aafc4f8ec4c84718072da13e647707b Mon Sep 17 00:00:00 2001 From: Gasim Gasimzada Date: Sat, 10 Aug 2019 19:09:38 +0400 Subject: [PATCH 1/4] Translate Test Renderer --- content/docs/reference-test-renderer.md | 68 ++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/content/docs/reference-test-renderer.md b/content/docs/reference-test-renderer.md index d53a257d4..d7fd23452 100644 --- a/content/docs/reference-test-renderer.md +++ b/content/docs/reference-test-renderer.md @@ -6,20 +6,20 @@ layout: docs category: Reference --- -**Importing** +**İdxal Etmə** ```javascript import TestRenderer from 'react-test-renderer'; // ES6 -const TestRenderer = require('react-test-renderer'); // ES5 with npm +const TestRenderer = require('react-test-renderer'); // npm ilə ES5 ``` -## Overview {#overview} +## İcmal {#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. +Bu paket, React komponentlərini Javascript obyektlərinə render etmək üçün, DOM və ya nativ mobil mühitindən asılı olmayan React rendereri təmin edir. -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). +Bu paket, React DOM və ya React Native komponentinin, brauzer və ya [jsdom](https://github.com/tmpvar/jsdom) olmadan render etdiyi platform görünüş iyerarxiyasının snəpşotunu asan formada çəkməyə imkan yaradır. -Example: +Məsələn: ```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). +JSON ağacının kopiyasını yadda saxlayıb testlərdə bu ağacın dəyişdiyini yoxlamaq üçün Jest-in snəpşot test xüsusiyyətindən istifadə edə bilərsiniz. [Əlavə məlumat üçün bura baxın](https://jestjs.io/docs/en/snapshot-testing). -You can also traverse the output to find specific nodes and make assertions about them. +Həmçinin siz nəticənin üzərindən keçib lazım olan nodları tapa bilər və bu nodlar üzərində iddialarını yoxlaya bilərsiniz. ```javascript import TestRenderer from 'react-test-renderer'; @@ -49,7 +49,7 @@ function MyComponent() { return (
-

Hello

+

Salam

) } @@ -71,7 +71,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); * [`TestRenderer.create()`](#testrenderercreate) -### TestRenderer instance {#testrenderer-instance} +### TestRenderer instansiyası {#testrenderer-instance} * [`testRenderer.toJSON()`](#testrenderertojson) * [`testRenderer.toTree()`](#testrenderertotree) @@ -94,7 +94,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); * [`testInstance.parent`](#testinstanceparent) * [`testInstance.children`](#testinstancechildren) -## Reference {#reference} +## Arayış {#reference} ### `TestRenderer.create()` {#testrenderercreate} @@ -102,7 +102,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. The returned instance has the following methods and properties. +Göndərilən React elementi ilə `TestRenderer` instansiyası yaradın. Bunun real DOM-dan istifadə etməsinə baxmayaraq, iddialarımızı yoxlaya bilmək üçün komponent ağacı yenə də bütünlüklə yaddaşa render edilir. Qaytarılan instansiyanın aşağıdaki funksiyalar və parametrləri var. ### `testRenderer.toJSON()` {#testrenderertojson} @@ -110,7 +110,7 @@ Create a `TestRenderer` instance with the passed React element. It doesn't use t testRenderer.toJSON() ``` -Return an object representing the rendered tree. This tree only contains the platform-specific nodes like `
` or `` and their props, but doesn't contain any user-written components. This is handy for [snapshot testing](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest). +Render edilmiş ağacını təmsil edən obyekti qaytarır. Render edilmiş ağac yalnız `
` və ya `` kimi platform-spesifik nodlardan ibarətdir. Bu ağacda istifadəçi tərəfindən yaranmış komponentlər olmur. Bu [snəpşot testi üçün](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) faydalıdır. ### `testRenderer.toTree()` {#testrenderertotree} @@ -118,7 +118,7 @@ Return an object representing the rendered tree. This tree only contains the pla testRenderer.toTree() ``` -Return an object representing the rendered tree. Unlike `toJSON()`, the representation is more detailed than the one provided by `toJSON()`, and includes the user-written components. You probably don't need this method unless you're writing your own assertion library on top of the test renderer. +Render edilmiş ağacını təmsil edən obyekti qaytarır. `toJSON()`-dan fərqli olaraq bu funksiya istifadəçi tərəfindən yaranmış komponentləri də obyektə daxil edir. Siz test renderer üzərində öz test kitabxananızı yazmırsınızsa bu funksiya sizə lazım deyil. ### `testRenderer.update()` {#testrendererupdate} @@ -126,7 +126,7 @@ Return an object representing the rendered tree. Unlike `toJSON()`, the represen testRenderer.update(element) ``` -Re-render the in-memory tree with a new root element. This simulates a React update at the root. If the new element has the same type and key as the previous element, the tree will be updated; otherwise, it will re-mount a new tree. +Yaddaşda olan ağacı yeni ana elementi ilə yenidən render edin. Bu React-in anada yenilməsini simulyasiya edir. Əgər yeni elementin tipi və açarı keçmiş elementinki ilə eynidirsə, ağac yenilənəcək. Əks halda, yeni ağac mount olunacaq. ### `testRenderer.unmount()` {#testrendererunmount} @@ -134,7 +134,7 @@ Re-render the in-memory tree with a new root element. This simulates a React upd testRenderer.unmount() ``` -Unmount the in-memory tree, triggering the appropriate lifecycle events. +Yaddaşda olan ağacı unmount edib, uyğun lifecycle hadisələrini çağırın. ### `testRenderer.getInstance()` {#testrenderergetinstance} @@ -142,7 +142,7 @@ Unmount the in-memory tree, triggering the appropriate lifecycle events. testRenderer.getInstance() ``` -Return the instance corresponding to the root element, if available. This will not work if the root element is a function component because they don't have instances. +Əgər mövcuddursa, ana elementin instansiyasını qaytarın. Əgər ana element funksiya komponentidirsə, bu funksiya işləməyəcək. Çünki funksiya komponentlərinin instansiyaları olmur. ### `testRenderer.root` {#testrendererroot} @@ -150,7 +150,7 @@ Return the instance corresponding to the root element, if available. This will n testRenderer.root ``` -Returns the root "test instance" object that is useful for making assertions about specific nodes in the tree. You can use it to find other "test instances" deeper below. +Ağacda olan spesifik nodlar haqqında iddiaları yaratmaq üçün faydalı olan ana "test instansiya" obyektini qaytarın. Siz bu instansiya ilə dərində olan digər "test instansiyalarını" tapa bilərsiniz. ### `testInstance.find()` {#testinstancefind} @@ -158,7 +158,7 @@ Returns the root "test instance" object that is useful for making assertions abo testInstance.find(test) ``` -Find a single descendant test instance for which `test(testInstance)` returns `true`. If `test(testInstance)` does not return `true` for exactly one test instance, it will throw an error. +`test(testInstance)` `true` qaytaran tək test instansiyasını tapın. Əgər `test(testInstance)` dəqiq tək instansiya üçün `true` qaytarmırsa, bu funksiya istisna atacaq. ### `testInstance.findByType()` {#testinstancefindbytype} @@ -166,7 +166,7 @@ Find a single descendant test instance for which `test(testInstance)` returns `t testInstance.findByType(type) ``` -Find a single descendant test instance with the provided `type`. If there is not exactly one test instance with the provided `type`, it will throw an error. +Təmin edilən `type` ilə tək test instansiyasını tapın. Əgər təmin edilən `type` ilə dəqiq tək instansiya yoxdursa, bu funksiya istisna atacaq. ### `testInstance.findByProps()` {#testinstancefindbyprops} @@ -174,7 +174,7 @@ Find a single descendant test instance with the provided `type`. If there is not testInstance.findByProps(props) ``` -Find a single descendant test instance with the provided `props`. If there is not exactly one test instance with the provided `props`, it will throw an error. +Təmin edilən `props` ilə tək test instansiyasını tapın. Əgər təmin edilən `props` ilə dəqiq tək instansiya yoxdursa, bu funksiya istisna atacaq. ### `testInstance.findAll()` {#testinstancefindall} @@ -182,7 +182,7 @@ Find a single descendant test instance with the provided `props`. If there is no testInstance.findAll(test) ``` -Find all descendant test instances for which `test(testInstance)` returns `true`. +`test(testInstance)` `true` qaytaran bütün test instansiyalarını tapın. ### `testInstance.findAllByType()` {#testinstancefindallbytype} @@ -190,7 +190,7 @@ Find all descendant test instances for which `test(testInstance)` returns `true` testInstance.findAllByType(type) ``` -Find all descendant test instances with the provided `type`. +Təmin edilən `type` ilə bütün test instansiyalarını tapın. ### `testInstance.findAllByProps()` {#testinstancefindallbyprops} @@ -198,7 +198,7 @@ Find all descendant test instances with the provided `type`. testInstance.findAllByProps(props) ``` -Find all descendant test instances with the provided `props`. +Təmin edilən `props` ilə bütün test instansiyalarını tapın. ### `testInstance.instance` {#testinstanceinstance} @@ -206,7 +206,7 @@ Find all descendant test instances with the provided `props`. testInstance.instance ``` -The component instance corresponding to this test instance. It is only available for class components, as function components don't have instances. It matches the `this` value inside the given component. +Göstərilən test instansiyasına uyğun olan komponent. Funksiya komponentlərinin instansiyaları olmadığından bu yalnız klas komponentləri üçün mövcuddur. Verilən komponentin `this` dəyəri ilə uyğundur. ### `testInstance.type` {#testinstancetype} @@ -214,7 +214,7 @@ The component instance corresponding to this test instance. It is only available testInstance.type ``` -The component type corresponding to this test instance. For example, a `