Calendar
و CurrentDate
في محرر التعليمات البرمجية. عند تقديم CurrentDate
من مكون Calendar
، قم بتمرير خاصية date
المعينة للتاريخ الحالي من كائن Date
JavaScript. ثم قم بالوصول إلى هذا prop
في مكون CurrentDate
، مع إظهار قيمته داخل علامات p
. تجدر الإشارة إلى أنه بالنسبة إلى قيم prop
أن يتم تقييمها على هيئة JavaScript ، يجب تضمينها في أقواس متعرجة ، على سبيل المثال date={Date()}
. Calendar
component should return a single div
element.");'
- text: يجب أن يكون الطفل الثاني لمكون Calendar
مكون CurrentDate
.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); return mockedComponent.children().childAt(1).name() === "CurrentDate"; })(), "The second child of the Calendar
component should be the CurrentDate
component.");'
- text: يجب أن يكون لمكون CurrentDate
دعامة date
.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); return mockedComponent.children().childAt(1).props().date })(), "The CurrentDate
component should have a prop called date
.");'
- text: ''
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); const prop = mockedComponent.children().childAt(1).props().date; return( typeof prop === "string" && prop.length > 0 ); })(), "The date
prop of the CurrentDate
should contain a string of text.");'
- text: يجب أن يقوم مكون CurrentDate
القيمة من date
prop في علامة p
.
testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); return mockedComponent.find("p").html().includes(Date().substr(3)); })(), "The CurrentDate
component should render the value from the date
prop in the p
tag.");'
```
The current date is:
{ /* change code above this line */ }