Skip to content

Commit 03ca6e5

Browse files
authored
Merge pull request #47 from splimter/Translating-addons-shallow-renderer.md
Done Translating-addons-shallow-renderer.md
2 parents 8802e91 + 9efa38c commit 03ca6e5

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

content/docs/addons-shallow-renderer.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
22
id: shallow-renderer
3-
title: Shallow Renderer
3+
title: التصيير السطحي (Shallow Rendering) في React
44
permalink: docs/shallow-renderer.html
55
layout: docs
66
category: Reference
77
---
88

9-
**Importing**
9+
**الاستيراد**
1010

1111
```javascript
1212
import ShallowRenderer from 'react-test-renderer/shallow'; // ES6
1313
var ShallowRenderer = require('react-test-renderer/shallow'); // ES5 with npm
1414
```
1515

16-
## Overview {#overview}
16+
## لمحة عامة {#overview}
1717

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.
1919

20-
For example, if you have the following component:
20+
على سبيل المثال إن كان لديك المكوّن التالي:
2121

2222
```javascript
2323
function MyComponent() {
@@ -30,7 +30,7 @@ function MyComponent() {
3030
}
3131
```
3232

33-
Then you can assert:
33+
بإمكانك كتابة ما يلي:
3434

3535
```javascript
3636
import ShallowRenderer from 'react-test-renderer/shallow';
@@ -47,22 +47,23 @@ expect(result.props.children).toEqual([
4747
]);
4848
```
4949

50-
Shallow testing currently has some limitations, namely not supporting refs.
50+
يمتلك الاختبار السطحي حاليًّا بعض المحدوديات، منها عدم دعم المراجع.
5151

52-
> Note:
52+
> ملاحظة:
5353
>
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). فهي تُزوِّدنا بواجهة برمجة تطبيق ذات مستوى أعلى وأفضل وبنفس الوظيفة.
5555
56-
## Reference {#reference}
56+
## مرجع {#reference}
5757

58-
### `shallowRenderer.render()` {#shallowrendererrender}
58+
### `()shallowRenderer.render` {#shallowrendererrender}
5959

60-
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+
بإمكانك التفكير بالتصيير السطحي كمكان لتصيير المكوّن الذي تختبره، والذي منه تستطيع استخراج ناتج المكوّن.
6161

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 ويُصيِّر فقط مستوى أدنى وحيد. يعني هذا أنّك تستطيع اختبار المكوّنات بشكل معزول عن مكوّناتها الأبناء.
6363

64-
### `shallowRenderer.getRenderOutput()` {#shallowrenderergetrenderoutput}
64+
### `()shallowRenderer.getRenderOutput` {#shallowrenderergetrenderoutput}
6565

66-
After `shallowRenderer.render()` has been called, you can use `shallowRenderer.getRenderOutput()` to get the shallowly rendered output.
66+
بعد استدعاء التابع `shallowRenderer.render()`‎ بإمكانك استخدام التابع `shallowRenderer.getRenderOutput()‎` للحصول على الناتج المُصيَّر.
67+
68+
بإمكانك بعدها البدء بتجميع الحقائق حول الناتج.
6769

68-
You can then begin to assert facts about the output.

0 commit comments

Comments
 (0)