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: src/v2/guide/unit-testing.md
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
-
title: Unit Testing
2
+
title: اختبار الوحدة
3
3
type: guide
4
4
order: 402
5
5
---
6
6
7
-
> [Vue CLI](https://cli.vuejs.org/) has built-in options for unit testing with [Jest](https://github.com/facebook/jest)or[Mocha](https://mochajs.org/)that works out of the box. We also have the official [Vue Test Utils](https://vue-test-utils.vuejs.org/)which provides more detailed guidance for custom setups.
7
+
> يحتوي [Vue CLI](https://cli.vuejs.org) على خيارات مدمجة لاختبار الوحدة بـ[Jest](https://github.com/facebook/jest)أو[Mocha](https://mochajs.org/)التي تعمل من خارج المنطقة. لدينا أيضًا [أداة الاختبار Vue](https://vue-test-utils.vuejs.org/)الرسمية الذي يوفر إرشادات أكثر تفصيلًا عن الإعدادات المخصصة.
8
8
9
-
## Simple Assertions
9
+
## تحققات بسيطة
10
10
11
-
You don't have to do anything special in your components to make them testable. Export the raw options:
11
+
ليس عليك القيام بأي شيء خاص في مكوناتك لجعلها قابلة للاختبار. تصدير اسطر الخيارات :
12
12
13
13
```html
14
14
<template>
@@ -29,7 +29,7 @@ You don't have to do anything special in your components to make them testable.
29
29
</script>
30
30
```
31
31
32
-
Then import the component options along with Vue, and you can make many common assertions (here we are using Jasmine/Jest style `expect`assertions just as an example):
32
+
بعد ذلك قم باستيراد خيارات المكونات مع Vue،ويمكنك تقديم العديد من التحققات الشائعة (هنا نستخدم لتحقق Jasmine/Jest style `expect`فقط كمثال):
33
33
34
34
```js
35
35
// Import Vue and the component being tested
@@ -67,9 +67,9 @@ describe('MyComponent', () => {
67
67
})
68
68
```
69
69
70
-
## Writing Testable Components
70
+
## كتابة مكونات قابلة للاختبار
71
71
72
-
A component's render output is primarily determined by the props it receives. If a component's render output solely depends on its props it becomes straightforward to test, similar to asserting the return value of a pure function with different arguments. Take a simplified example:
72
+
يتم تحديد ناتج تصيير المكون في المقام الأول عن طريق "props" او الخصائص التي يتلقاها. إذا كان إخراج التجسيد الخاص بالمكون يعتمد فقط على الخصائص الخاصة به، فسيصبح من السهل اختباره، على غرار تأكيد قيمة الإرجاع للدالة العادية ذات الوسائط المختلفة. خذ مثالا مبسطا:
73
73
74
74
```html
75
75
<template>
@@ -83,7 +83,7 @@ A component's render output is primarily determined by the props it receives. If
83
83
</script>
84
84
```
85
85
86
-
You can assert its render output with different props using the `propsData` option:
86
+
يمكنك تأكيد ناتج التصيير باستخدام الخصائص المختلفة باستخدام خيار `propsData`:
Since Vue [performs DOM updates asynchronously](reactivity.html#Async-Update-Queue), assertions on DOM updates resulting from state change will have to be made in a `Vue.nextTick` callback:
114
+
نظرًا لأن Vue [تنفذ تحديثات DOM بشكل غير متزامن](reactivity.html#Async-Update-Queue)، فيجب إجراء التأكيدات على التحديثات DOM الناتجة عن تغيير الحالة في رد اتصال `Vue.nextTick`:
115
115
116
116
```js
117
117
// Inspect the generated HTML after a state update
@@ -127,4 +127,4 @@ it('updates the rendered message when vm.message updates', done => {
127
127
})
128
128
```
129
129
130
-
For more in-depth information on unit testing in Vue, check out[Vue Test Utils](https://vue-test-utils.vuejs.org/) and our cookbook entry about [unit testing vue components](https://vuejs.org/v2/cookbook/unit-testing-vue-components.html).
130
+
لمزيد من المعلومات المتعمقة حول اختبار الوحدة في Vue، تحقق من[Vue Test Utils](https://vue-test-utils.vuejs.org/)، ومدخل (مقدمة) كتاب الطبخ الخاص بنا حول [اختبار الوحدة لمكونات Vue](https://vuejs.org/v2/cookbook/unit-testing-vue-components.html).
0 commit comments