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
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 يكون التصيير السطحي مفيدًا لك. يُتيح لك التصيير السطحي تصيير مكوّن على عمق مستوى واحد وتوضيح الحقائق حول ما يُعيده تابع التصيير، بدون القلق حول سلوك المكوّنات الأبناء والتي لم تُصيَّر أو ينشأ عنها نسخة. لا يحتاج ذلك إلى DOM.
Shallow testing currently has some limitations, namely not supporting refs.
50
+
يمتلك الاختبار السطحي حاليًّا بعض المحدوديات، منها عدم دعم المراجع.
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
+
> نوصي بالتحقق من واجهة[ واجهة برمجة تطبيق التصيير السطحي](https://airbnb.io/enzyme/docs/api/shallow.html). فهي تُزوِّدنا بواجهة برمجة تطبيق ذات مستوى أعلى وأفضل وبنفس الوظيفة.
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
+
بإمكانك التفكير بالتصيير السطحي كمكان لتصيير المكوّن الذي تختبره، والذي منه تستطيع استخراج ناتج المكوّن.
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 ويُصيِّر فقط مستوى أدنى وحيد. يعني هذا أنّك تستطيع اختبار المكوّنات بشكل معزول عن مكوّناتها الأبناء.
0 commit comments