You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/addons-shallow-renderer.md
+12-12
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ import ShallowRenderer from 'react-test-renderer/shallow'; // ES6
13
13
var ShallowRenderer =require('react-test-renderer/shallow'); // ES5 with npm
14
14
```
15
15
16
-
## Overview {#overview}
16
+
## ओवरव्यू {#overview}
17
17
18
-
When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM.
18
+
React के लिए यूनिट टेस्ट लिखते समय शैलो रेंडरिंग काफ़ी उपयोगी हो सकती है। शैलो रेंडरिंग आपको एक कौम्पोनॅन्ट को "एक स्तर गहरा" रेंडर करने देता है और रेंडर मेथड जो रिटर्न कर रहा है उसको अस्सर्ट कर सकते हैं कि इस कौम्पोनॅन्ट का रेंडर मेथड क्या return करेगा, child कौम्पोनॅन्टस के व्यव्हार की चिंता किये बिना, जो की instantiate या रेंडर नहीं होते। इसमें DOM की आवश्यकता नहीं होती है।
19
19
20
-
For example, if you have the following component:
20
+
उदहारण के लिए, अगर आपके पास निम्नलिखित कौम्पोनॅन्ट है:
Shallow testing currently has some limitations, namely not supporting refs.
50
+
वर्तमान में शैलो टेस्टिंग की कुछ सीमाएँ हैं, नामतः ये refs के साथ काम नहीं करता।
51
51
52
-
> Note:
52
+
> टिप्पणी:
53
53
>
54
-
> We also recommend checking out Enzyme's [Shallow Rendering API](https://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality.
54
+
> हम Enzyme के [शैलो रेंडरिंग API](https://airbnb.io/enzyme/docs/api/shallow.html) का भी परीक्षण करने की भी सलाह देते हैं। यह उसी फंक्शनलिटी पर एक और अच्छे स्तर की API देता है।
You can think of the shallowRenderer as a "place" to render the component you're testing, and from which you can extract the component's output.
60
+
आप जिस कौम्पोनॅन्ट का परीक्षण कर रहे हैं, shallowRenderer को आप उसे रेंडर करने के एक "स्थान" की तरह सोच सकते हैं, और इससे आप कौम्पोनॅन्ट के आउटपुट को निकाल सकते हैं।
61
61
62
-
`shallowRenderer.render()`is similar to [`ReactDOM.render()`](/docs/react-dom.html#render)but it doesn't require DOM and only renders a single level deep. This means you can test components isolated from how their children are implemented.
62
+
`shallowRenderer.render()`[`ReactDOM.render()`](/docs/react-dom.html#render)के समान ही है लेकिन इसे DOM की आवश्यकता नहीं है और यह केवल एक स्तर गहराई तक ही रेंडर करता है। इसका मतलब आप कौम्पोनॅन्टस का परिक्षण उनके children के लागू होने के तरीके से अलग रखकर कर सकते हैं।
0 commit comments