: إعادة التدوير:: إعادة التدوير:: إعادة التدوير: يرجى مراعاة البيئة قبل طباعة مشكلة Github هذه. : إعادة التدوير:: إعادة التدوير:: إعادة التدوير:
كنا أنا و
لقد بدأت كشوكة من أشرطة htmlbars ولكن تمت إعادة كتابة كل سطر من التعليمات البرمجية تقريبًا (أحيانًا عدة مرات) حتى الآن. لقد قمنا بتقطير جميع الدروس المستفادة من بناء خطوط أنابيب التقديم من الجيل السابق (المقاود ، وأشرطة html ، ومشروع بصيص الأصلي ، وما إلى ذلك) ، مما أدى إلى بنية أكثر ملاءمة لحالات استخدام Ember في نفس الوقت ولكنها أيضًا أكثر مرونة وموضعًا جيدًا للتمديدات المستقبلية وحالات استخدام أخرى بخلاف Ember.
يمكنك العثور على كودز على https://github.com/tildeio/glimmer. تمت إعادة كتابته بلغة TypeScript ، وأعتقد أنه رائع جدًا. على أي حال ، المزيد عن ذلك في EmberConf .
بينما لا يزال هناك الكثير من العمل (معظمه تحسينات) نود القيام به على المحرك ، نعتقد أننا قمنا بتنفيذ ما يكفي لتغطية جميع حالات استخدام Ember الأساسية. لذلك منذ حوالي شهرين ، بدأنا في دمج المحرك الجديد في Ember المناسب. يمكنك متابعة هذه المسألة الوصفية لتقدمنا حتى الآن.
على الرغم من عدم إمكانية استخدام المحرك الجديد في التطبيقات الحقيقية حتى الآن ، إلا أننا نتوقع اكتمال هذا العمل قريبًا نسبيًا. من المتوقع أنه بمجرد الانتهاء من التنفيذ ، ستكون ترقية سهلة نسبيًا للتطبيقات ، تمامًا مثل ترحيل Handbars الأصلي إلى HTMLBars.
(تجدر الإشارة إلى أن القدرة على تبديل علامة الميزة من المحتمل أن تصل _ قبل _ يتم تنفيذ جميع الميزات الحالية ، لذلك من المحتمل أن _لا تعمل بسلاسة مع تطبيقك من البداية.)
لذا ، قد تتساءل ، "كيف يمكنني المساعدة؟"
أنا سعيد لأنك سألت! : boom:: Sparkles:: fireworks:: tada:
في هذه المرحلة ، أعلى قيمة يمكنك القيام بها للمساعدة هي المساعدة في نقل الاختبارات الحالية (والمساعدة في مراجعة هذه العلاقات العامة). كما ترى ، لدى Ember مجموعة اختبار واسعة جدًا تختبر سلوك "طبقة العرض". تكمن المشكلة في أن الكثير من هذه الاختبارات مكتوبة بطرق مرتبطة تمامًا بالتنفيذ الحالي أو تستخدم دلالات قديمة (مثل {{view.foo}}
) التي لم تعد مدعومة.
من أجل التأكد من أننا لم نتسبب في أي تراجع ، نود أن نكون قادرين على تشغيل مجموعة الاختبار الخاصة بنا بالكامل مقابل كل من محرك العرض الحالي ("htmlbars") و Glimmer 2.
لقد كتبنا أداة اختبار جديدة تسمح لنا بالقيام بذلك. سوف أتطرق إلى التفاصيل الفنية أدناه ، لكن الفكرة الأساسية هي أننا كتبنا حالات الاختبار الخاصة بنا ضد طبقة تجريد تلخص الاختلافات بين المحركين ، مما يسمح لنفس الكود في حالات الاختبار بالعمل ضد كلا التطبيقين.
على طول الطريق ، نقوم أيضًا "بتحديث" الاختبارات الحالية في العملية لعدم الاعتماد على الدلالات القديمة (ما لم تظهر أنها تختبر صراحةً تلك الدلالات ، وفي هذه الحالة سنتركها وشأنها). كما أن أداة الاختبار الجديدة لدينا تجعل إجراء اختبارات "نمط المصفوفة" أسهل بكثير وأكثر متعة. المزيد عن ذلك أدناه ، ولكن يوجد هنا مخطط معماري عالي المستوى:
والنتيجة النهائية هي أن الاختبارات أصبحت الآن أسهل في القراءة والتفسير ، كما قمنا بزيادة التغطية بشكل كبير. هذه نتيجة رائعة للجميع ، ولكن لا يزال لدينا الكثير من الاختبارات المتبقية ، ولا يمكننا أن نشعر بالثقة في شحن المحرك دون نقلهم جميعًا. ومع ذلك ، إذا كان بإمكان القليل منكم مساعدتنا في نقل ملف اختبار لكل منهم ، فسنكون في حالة جيدة جدًا بحلول هذا الوقت من الأسبوع المقبل!
الآلية الفعلية التي استخدمناها هي تقنية منخفضة للغاية. ربما سمعت عنها ، إنها تسمى روابط رمزية .
داخل مجلد الاختبار لحزمة ember-glimmer
، ستجد ملفًا يسمى abstract-test-case.js
، وهو أيضًا مرتبط بشكل رمزي بنفس الموقع داخل الحزمة ember-htmlbars
. يحدد هذا الملف واجهات برمجة التطبيقات التي نستخدمها في كتابة حالات الاختبار. نظرًا لأن هذا الملف مشترك (مرتبط برمزًا) بين كلتا الحزمتين ، فإنه لا يحتوي على أي شيء محدد حول التطبيقين.
بدلاً من ذلك ، يتم تلخيص جميع الاختلافات عن طريق استيراد الملفات (مثل import ... from './helpers'
) التي توفرها كل حزمة. بدلاً من ذلك ، يمكن لكل حزمة أيضًا تجاوز طرق معينة في فئات "الملخص" في test-case.js
(راجع إصدارات ember-glimmer
مقابل ember-htmlbars
).
(في كثير من الحالات ، قد لا تحتاج حتى إلى تعديل هذه الملفات على الإطلاق ، ولكن معرفة كيفية عملها / مكان حدوث العمل تحت غطاء محرك السيارة قد يكون مفيدًا إذا واجهت مشكلات.)
نظرًا لأن المحرك يهدف إلى أن يكون ترقية فورية للتطبيقات الحقيقية ، طالما أننا نختبر بالفعل كيفية استخدام هذه الميزات في العالم الحقيقي ، فلا يوجد سبب لعدم تشغيل الاختبارات مع كلا المحركين.
كان هذا هو تركيزنا حتى الآن. يمكنك رؤية مثال هنا .
يوجد هذا الاختبار فعليًا داخل الدليل ember-glimmer
، لكنه مرتبط برمز إلى نفس الموقع في الدليل ember-htmlbars
(في الواقع ، الدليل بأكمله مرتبط برمز).
كما ترى ، يقوم الاختبار باستيراد test-case.js
بالحزمة ، ولكن بخلاف ذلك فهو محايد بشأن تنفيذ محرك العرض.
بشكل عام وعلى مستوى عالٍ ، تبدو العملية كما يلي:
ember-htmlbars
)ember-glimmer/tests/integration/...
مكان ماmoduleFor
و ES6 الجديدember-htmlbars
، ما لم يكن المجلد الأصلي بالفعل رابط رمزي في ember-htmlbars
(مثل اختبار concat الذي عرضته أعلاه)فيما يلي بعض النصائح / القواعد العامة التي يمكنك اتباعها لتحسين حالات الاختبار.
نود أن يمر كل اختبار بدورة "INUR":
قم بتقديم النموذج الذي تريد اختباره ، مع القيم الأولية التي تختارها ( this.render(..., { ... })
) وأكد أن النتيجة هي ما تتوقعه. ( مثال )
استدع this.runTask(() => this.rerender());
بدون أي تغييرات على القيم ، ثم أكد أن النتيجة تبقى كما هي. ( مثال )
قم بإجراء بعض التحديثات على القيم التي تستخدمها في القوالب. ( مثال )
يجب أن تحاول:
this.runTask
+ متعدد) إذا كان ذلك منطقيًا. يؤدي هذا إلى زيادة فرص اصطياد أخطاء "الضرب" حيث يؤدي تحديث _ بعض القيم إلى "إزالة" جزء آخر غير ذي صلة من القالب أو يتسبب في تأثيرات أخرى غير مرغوب فيها.pushObject
مقابل إزالة عنصر ، وما إلى ذلك) ، فمن الجيد عادةً تجربة أكثر من طريقة واحدة. ( مثال )إعادة التعيين إلى حالة البداية الأصلية عن طريق استبدال جميع المتغيرات.
من السهل نسخ حالة اختبار عدة مرات لاختبار أشكال مختلفة قليلاً من الشيء نفسه (على سبيل المثال ، {{#if foo}}
بدءًا من true مقابل false ، أو الفرق بين "POJO" مقابل Ember.Object
) ، وقد فعلنا ذلك كثيرًا في الاختبارات الحالية.
في بعض الأحيان يكون هذا أفضل ما يمكنك القيام به ، ولكن هناك الكثير من المشاكل مع هذا. أولاً ينتج عددًا كبيرًا من الاختبارات فعليًا في الملف ، مما يجعل من الصعب العثور على الأشياء. أيضًا ، عندما يحتاج شخص ما إلى إضافة اختبار جديد ، فعادة ما يختار بشكل عشوائي أحد المتغيرات القليلة ، ويحمل التفاصيل / الأخطاء التي لا تعني الكثير للسيناريو الجديد. عندما نصلح الأخطاء في إحدى النسخ ، من المحتمل أن ننسى الباقي.
عادة ، هناك طرق لتجنب الازدواجية. على سبيل المثال ، في حالة اختبار حالة البدء المختلفة ( {{#if foo}}
مقابل true
و false
) ، يمكنك فقط اختبار كلا الشرطين في نفس الاختبار:
["<strong i="5">@test</strong> if"]() {
this.render(`{{#if cond1}}T{{else}}F{{/if}}{{#if cond2}}T{{else}}F{{/if}}`, { cond1: true, cond2: false });`
... // follow the usual I-N-U-R cycle
}
في حالات أخرى ، تمكنا من تحديد السلوكيات المشتركة عن طريق استخراج بعض الفئات الفائقة المشتركة (وضع حالات الاختبار الفعلية في الفئة الممتازة) ، وتكوين الأجزاء المختلفة في الفئة الفرعية. يتيح لك ذلك كتابة حالات الاختبار مرة واحدة ، وجعلها تقوم تلقائيًا بتشغيل العديد من السيناريوهات المختلفة (اختبارات "نمط المصفوفة").
أفضل مثال هو على الأرجح اختبار الشرطية ( if
، unless
، إلخ). يحدد ملف الاختبار الفعلي ببساطة نمط استدعاء القالب والفئة الفرعية TogglingSyntaxConditionalsTest
(الموجود في shared-conditional-tests.js
) ويحصل تلقائيًا على العديد من الاختبارات المشتركة.
تأخذ اختبارات "inline if / ما لم" تأخذ هذا الأمر إلى أبعد من ذلك ، حيث تقوم بتشغيل نفس مجموعة حالات الاختبار مقابل 11 (!) سيناريوهات استدعاء مختلفة.
كان من الصعب إلى حد ما الوصول إلى الهيكل الفعلي للمشاركة ، واستغرق بعض الوقت حتى تنضج / تصبح صحيحة ، ولكن المردود كان هائلاً (السيناريوهات الأساسية مشتركة الآن بين {{#with}}
و {{#each}}
كذلك).
تستخدم الكثير من الاختبارات الحالية دلالات قديمة مثل المشاهدات ، {{view.foo}}
، {{#view}}
، context
، وحدات التحكم ، إلخ. في معظم الأوقات ، هذا عرضي تمامًا ، وفقط نتيجة الاختبار الذي تمت كتابته في وقت كانت فيه تلك الأوليات هي الطريقة الرئيسية للقيام بالأشياء. في هذه الحالات ، يمكنك عادةً نقلها إلى الأداة الجديدة (التي تستخدم المكونات بدلاً من ذلك) دون مشاكل.
عندما تكون في شك ، يمكنك أيضًا إجراء اختبار لم يتم الإبلاغ عنه في التكرار الأول للعلاقات العامة الخاصة بك وطرح أسئلتك في تعليق سطر.
attrs
أو لا إلى attrs
قررنا عدم استخدام {{attrs.foo}}
في الاختبارات التي تستخدم مكونات مجعدة (وهي كلها تقريبًا) والاعتماد فقط على Attrs التي تنعكس على الخاصية التي تحمل الاسم نفسه (على سبيل المثال {{foo}}
). ما لم يكن الاختبار على وجه التحديد _about_ اختبار attrs.*
(من المحتمل أن تكون جميعها في نفس الملف) ، يجب أن تفضل بشكل عام {{foo}}
بدلاً من {{attrs.foo}}
للتوافق. يمكنك دائمًا تسمية أشياء مثل innerFoo
مقابل outerFoo
إذا كنت تشعر بالحاجة إلى توضيح.
راجع أيضًا https://locks.svbtle.com/to-attrs-or-not-to-attrs بواسطةlocks.
في بعض الأحيان ، قد لا تعمل الاختبارات التي قمت بنقلها على Glimmer 2 أو HTMLBars. (إذا لم يعمل على أي محرك ، فربما تكون قد فعلت شيئًا خاطئًا).
في حالة عدم عملها على Glimmer 2 ، فمن المحتمل أن يكون ذلك بسبب أننا لم ننفذ هذه الميزة بالكامل حتى الآن. (على سبيل المثال ، قمنا بتنفيذ دعم المكونات الأساسية ولكننا لم ننفذ attributeBindings
في هذه المرحلة.)
في هذه الحالة ، لا يزال من الجيد نقل الاختبار إلى النمط الجديد ، بحيث يمكننا ببساطة تمكينه عند تنفيذ الميزة. لتعطيل اختبار مؤقتًا لـ Glimmer 2 ، يمكنك ببساطة استبدال البادئة @test
في اسم الطريقة بـ @htmlbars
(مما يعني "تشغيل هذا في HTMLBars فقط"). يمكنك أيضًا تعطيل وحدة كاملة عن طريق إضافة بادئة اسمها moduleFor
بـ @htmlbars
.
في بعض الحالات النادرة ، سيعمل الاختبار بشكل صحيح على Glimmer 2 لكنه لا يمر عبر HTMLBars. يجب عليك التحقق مرة أخرى من صحة الدلالات التي تختبرها ، ولكن من المحتمل أيضًا وجود خطأ في التنفيذ الحالي لـ HTMLBars. (يحدث هذا عادة عندما نختبر بعض ميزات أشرطة HTML باستخدام "نمط المصفوفة" الجديد ، حيث لا يتم تحديث القيم بشكل صحيح في بعض حالات الحواف.)
في هذه الحالة ، يمكنك بالمثل وضع علامة على حالة اختبار فردية أو وحدة كاملة على أنها @glimmer
. نظرًا لأنه من المتوقع أن يكون هذا نادرًا جدًا (وقد يتطلب إصلاحًا للأخطاء) ، فسيكون من المفيد تضمين وصف موجز للمشكلات التي تواجهها في سطر تعليق.
فيما يلي بعض الأمثلة الرائعة حيث ساعد أعضاء مجتمعنا في نقل الاختبارات الحالية:
{{if}}
{{#with}}
{{unless}}
(hash)
المساعدكما ترون ، كانت التكرارات السابقة أكثر صعوبة (كنا لا نزال نكتشف قصة حالات الاختبار المشتركة) ، لكن المحاولات الأخيرة كانت مباشرة نسبيًا. شكرًا لك GavinJoyce و chadhietala على تمهيد الطريق!
فيما يلي قائمة بنقاط البداية الجيدة. إذا كنت جادًا في العمل على أحد هذه الأشياء ، فربما تريد ترك تعليق أدناه حتى يعرف الآخرون عدم العمل على ذلك. (إذا نفد الوقت أو واجهت صعوبة كبيرة ، فالرجاء العودة إلى "تحرير القفل" و / أو دفع عملك قيد التقدم ، حتى يتمكن الآخرون من استلامه!)
لا أعرف ما إذا كان هذا موجودًا بالفعل. يرجى محاولة العثور عليه والميناء إذا كان كذلك. ولكن بخلاف ذلك ، يرجى إنشاء ملف جديد له (لقد بدأنا بالفعل شيئًا ما في https://github.com/emberjs/ember.js/blob/master/packages/ember-glimmer/tests/integration/content-test.js) . الفكرة هي أننا نريد اختبار "ما يحدث إذا أدخلت شيئًا غريبًا في DOM" ، مثل {{foo}}
، حيث foo
هو undefined
، null
، و object ، إلخ. هذا هو الهدف الرئيسي لاختبار "Matrix Style" ، لذلك قد ترغب في دراسة كيفية عمل أداة الاختبار واستخلاص الأفكار من الاختبارات الشرطية.
يجب أن يمتص هذا أيضًا https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/hooks/text_node_test.js أيضًا.
attr_nodes
] (https://github.com/emberjs/ember.js/tree/master/packages/ember-htmlbars/tests/attr_nodes) (: قفل: بواسطة chancancode و @ wycats)نود أن نلقي نظرة فاحصة على هذه الاختبارات وفهم المتطلبات. قفله الآن.
compat
] (https://github.com/emberjs/ember.js/tree/master/packages/ember-htmlbars/tests/compat): المقص:أعلنا أننا سننهي دعم الوظائف الإضافية القديمة بحلول 2.6 ، لذلك لن نحتاج إلى دعم هذه الميزات في Glimmer 2. يرجى فتح PRs لإزالة الاختبارات والميزات الموجودة على Master. (قد يتطلب هذا معرفة عميقة نسبيًا بقاعدة الشفرة).
glimmer-component
] (https://github.com/emberjs/ember.js/tree/master/packages/ember-htmlbars/tests/glimmer-component): المقص: هذا المجلد غير مستخدم. يرجى إرسال PR لإزالته.
tests/integration/helpers
)-html-safe
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/-html-safe-test.js): قفل :I'm not sure if this is needed for Glimmer 2. Locking for now.
closure component
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/closure_component_test.js) (: lock: by @ سيرابي)I am pretty sure this will have to be `@htmlbars` for now.
collection
test] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/collection_test.js): المقص: This is legacy. Please open a PR to remove the test and any code you could find that implements the feature.
#component
helper] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/component_test.js) Basic support for the feature has landed in #13057 and we already wrote some basic tests. Please port the rest of the tests into the new file (keep an eye for things that are already tested in the new file). I expect most of them to pass except position params which is not yet implemented in Glimmer 2 (you can make them `@htmlbars` for now).
Basic support for the feature has landed in #12910/#13087 and we already wrote some basic tests. Please port the rest of the tests into the new file (keep an eye for things that are already tested in the new file). I expect most of them to pass with the exception of the lifecycle stuff (destroy, etc) for class-based helpers (you can make them `@htmlbars` for now).
debug
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/debug_test.js): المقص: This is a duplicate of `log` as far as I can tell. See notes on `log` tests below.
#each-in
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/each_in_test.js) This should be ported to `test/intergration/syntax/...`. (In general, what was previously known as "block helpers" are now implemented as "syntax" in Glimmer 2.)
This helper is not implemented in Glimmer 2 and will be pretty difficult for a new contributor to implement it. However, it is still important to port the tests asap (and make the module `@htmlbars`).
For bonus points, you might want to think about how to share the basic tests with the rest of the conditional matrix (i.e. testing when we need to go into the "default" branch and when we need to go into the "inverse"/`{{else}}` branch). See #13048 for some inspiration.
#each
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/each_test.js) 🔒 بواسطة JoelkangThis should be ported to `test/intergration/syntax/...`. (In general, what was previously known as "block helpers" are now implemented as "syntax" in Glimmer 2.)
Basic support for the feature has landed in #13048 and we already wrote some basic tests. Please port the rest of the tests into the new file (keep an eye for things that are already tested in the new file). I expect most of them to pass with the exception of the lifecycle stuff (destroy, etc) for class-based helpers (you can make them `@htmlbars` for now).
For bonus points, you might want to think about how to share the basic tests with the rest of the conditional matrix (i.e. testing when we need to go into the "default" branch and when we need to go into the "inverse"/`{{else}}` branch). I _think_ we already did that part in #13048, but if you see other ways to improve it or do more sharing please feel free to suggest them.
get
This helper is not implemented in Glimmer 2 and will be pretty difficult for a new contributor to implement it. However, it is still important to port the tests asap (and make the module `@htmlbars`).
(Actually, it's not _that_ hard – the implementation will likely not take more than 10-20 lines, but you would need to be quite familiar with how Glimmer 2 works to do it. Once #13103 is completed it might give you some ideas.)
I believe this is already ported by @GavinJoyce. The rest are probably just legacy stuff that we can remove. <strong i="23">@GavinJoyce</strong> can you confirm?
{{input}}
الاختبارات] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/input_test.js) (: lock: by @ جافين جويس)This helper is a not implemented in Glimmer 2 and will be pretty difficult for a new contributor to implement it. However, it is still important to port the tests asap (and make the module `@htmlbars`).
(More precisely, the helper uses component features that are not yet implemented, such as attribute bindings. Once they are implemented the tests will probably Just Pass™.)
loc
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/loc_test.js) The helper is not implemented in Glimmer 2, but should be trivial if you want to do it. (See #12910 or #13093) Otherwise you can always mark the module as `@htmlbars`.
log
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/log_test.js) The helper is not implemented in Glimmer 2, but should be trivial if you want to do it. (See #12910 or #13093) Otherwise you can always mark the module as `@htmlbars`. As mentioned above, I think `debug_test.js` is just a duplicate of this, please verify and delete that file. **As an exception**, we only want to test initial render here, not the usual "I-N-U-R" cycle.
partial
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/partial_test.js) This functionality is not implemented in Glimmer 2 and will be pretty difficult for a new contributor to implement it. However, it is still important to port the tests asap (and make the module `@htmlbars`). Please consider adding some abstractions like `this.registerPartial`.
text_area
This helper is a not implemented in Glimmer 2 and will be pretty difficult for a new contributor to implement it. However, it is still important to port the tests asap (and make the module `@htmlbars`).
(More precisely, the helper uses component features that are not yet implemented, such as attribute bindings. Once they are implemented the tests will probably Just Pass™.)
unbound
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/unbound_test.js) This helper is not implemented in Glimmer 2 and will be pretty difficult for a new contributor to implement it. However, it is still important to port the tests asap (and make the module `@htmlbars`).
(Actually, it's not _that_ hard – the implementation will likely not take more than 10-20 lines, but you would need to be quite familiar with how Glimmer 2 works to do it. Once #13103 is completed it might give you some ideas.)
view
الاختبارات] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/view_test.js) (: lock: by chadhietala)We announced we will end support for the legacy addons by 2.6, so we won't need to support these features in Glimmer 2. Please carefully review these tests and see if there are anything that doesn't look like deprecated/legacy functionality. Otherwise, please open PRs to remove the tests and the features on master. (This would probably require relatively deep knowledge of the codebase.)
with
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/with_test.js)I believe this is already ported by @chadhietala. The rest are probably just legacy stuff that we can remove. <strong i="5">@chadhietala</strong> can you confirm?
yield
الاختبارات] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/yield_test.js) (: lock: by kiwiupover)The feature should work in Glimmer 2 (as <strong i="12">@chadhietala</strong> pointed out in https://github.com/emberjs/ember.js/pull/13093#discussion_r55926094). Please port the rest of the tests into a new file. I expect most of them to pass. There are a lot of legacy stuff in there, so please try to understand the spirit of the test and see if they are still needed (vs they are testing a legitimate thing but just happen to use legacy semantics to test them, in which case, you should port them using non-legacy semantics).
The actual `attributeBindings` feature on components is not yet implemented, but this file doesn't seem to be testing that at all. In fact, I cannot tell what this file is testing at all. Please do investigate! (I suspect this is something we already tested, perhaps <strong i="24">@GavinJoyce</strong> or <strong i="25">@chadhietala</strong> will know.)
This is probably the one place where it makes sense to test `{{attrs.foo}}` vs `{{foo}}`. I expect them to already work in Glimmer 2. However, components lifecycle hooks (e.g. `didReceiveAttrs`) is not yet implemented, so you would have to either port the test without using them, or tests that needs them as `@htmlbars` for now.
Some of these tests belongs in other files (e.g. helper without parameters should be tested inside helper tests, undefined property probably belongs in the "Basic content rendering tests". The `Binding` and computed property tests are fine here, and they should Just Work™ on Glimmer to with some modernizing. (We might want to be want to be a little bit more through with CPs if this turns out to be the only place that tests them – like updating a dependent key updates the output, etc.) The view stuff seems largely incidental, you should be able to rewrite them without the legacy semantics, but there does seem to be one or two tests that are just testing legacy semantics (based on a quick scan). Please do investigate!
I _think_ we should be able to find a better home the stuff tested in here (like in the helpers and components files), but even just straight porting them would be helpful.
elementId
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/component_element_id_test.js) This should be tested in https://github.com/emberjs/ember.js/blob/master/packages/ember-glimmer/tests/integration/components/curly-components-test.js and I think it should just work in Glimmer 2. It probably doesn't make sense to test updating for this test – I don't think we support updating the `elementId`, but please do investigate!
(If we start adding more tests for components, it probably makes sense to start splitting them up into different modules/files.)
This is the monster file that tests all things components. It should probably be tested in https://github.com/emberjs/ember.js/blob/master/packages/ember-glimmer/tests/integration/components/curly-components-test.js, but as I said above, we probably want to start breaking things up. Some of the features are not implemented Glimmer 2 yet, so feel free to use `@htmlbars` liberally.
Most of these functionality are not yet implemented in Glimmer 2, so you might have to `@htmlbars` the entire module.
I _think_ we should be able to find a better home the stuff tested in here (like in the content tests file), but even just straight porting them would be helpful.
I think this must already be tested in the helpers test? Please do investigate and open a PR to remove if true.
This is testing the `<input>` HTML element, not the `{{input}}` helper. I won't be surprised if a lot of them doesn't work in Glimmer 2 yet, but it would be very helpful to know. Please port the test cases and flag with `@htmlbars` as needed.
I'm not sure if this is implemented in Glimmer 2 yet. Please port the test cases and flag with `@htmlbars` as needed.
The Glimmer 2 implementation might change the story a bit, locking for now.
select
test] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/select_in_template_test.js): المقص: This is legacy. Please open a PR to remove the test and any code you could find that implements the feature.
I'm pretty sure this is already tested somewhere in the `if/each` tests. (The concept "tagless views" doesn't make any sense because even in htmlbars they are not implemented as views anymore.) If I am wrong, please port them into the `if/each` test files as appropriate and :scissors: this.
I'm pretty sure this is already tested in the components test. (`tagName` is not implemented yet, but it doesn't seem important for the test.) If I am wrong, please port them into the curly component test files as appropriate and :scissors: this.
I don't think the `willDestroyElement` hook is implemented in Glimmer 2, but the `willDestroy` hook is (and we already have tests for them in https://github.com/emberjs/ember.js/blob/master/packages/ember-glimmer/tests/integration/components/curly-components-test.js#L202). ~~Please investigate if there are any semantic differences (ordering, etc) between the two hooks. If they have the same semantics, we might just want to merge the two tests and test it "matrix style" (please check if the two tests are actually testing the same thing, if not, it's perfectly fine to have > 1 test).~~ Otherwise please port it with `@htmlbars`.
The `{{view}}` part is obviously legacy, if there are something that we didn't otherwise cover in the `{{#with}}` tests, please port them there, otherwise :scissors: /cc <strong i="13">@chadhietala</strong>
ربما يحتاج تطبيق ViewNodManager
إلى البقاء لفترة أطول قليلاً لأن بعض الأشياء الداخلية لا تزال مطبقة كطرق عرض في أشرطة htmlbars ، ولكن هذا لا يبدو أنه يختبر أي شيء مهم ، لذا يمكننا على الأرجح: المقص: ذلك؟ rwjblue هل يمكنك التأكيد؟
This is likely legacy. Please do investigate!
This seems to be testing `Ember.TEMPLATES`. I don't know if this is legacy, locking for now. <strong i="11">@rwjblue</strong> can you confirm and update this item? If it's legacy, we can just :scissors: this and the implementation. If it's not, I assume it's already handled at the container/resolver level and they should Just Work™ in Glimmer 2 after porting.
Please do investigate what this is testing, and see if it could be merged into the helpers integration tests.
This seems to be testing 'view.env`. I don't know if this is legacy, locking for now. @rwjblue/<strong i="22">@wycats</strong> can you confirm and update this item?
من المحتمل أن تكون هناك اختبارات أخرى يجب إجراؤها أيضًا. إذا لاحظت أي شيء فاتني ، فيرجى ذكره في التعليقات.
بمجرد أن تكون مستعدًا لإرسال العلاقات العامة الخاصة بك (يرجى عدم التردد في تقديم PRs PR!) ، يرجى الإشارة إلى هذه المشكلة في وصف العلاقات العامة الخاصة بك ، حتى نتمكن من مراجعتها.
نريد إجراء أكبر عدد من الاختبارات في أسرع وقت ممكن. من الناحية المثالية ، نود إجراء معظم الاختبارات (إن لم يكن كلها) خلال الأسبوع أو الأسبوعين المقبلين.
شكرا لكم مقدما على مساعدتكم! : heart:: yellow_heart:: green_heart:: blue_heart: purple_heart:
if/unless tests
المتبقي https://github.com/emberjs/ember.js/pull/13159سوف ألقي نظرة على اختبارات "willDestroyElement".
الشيء الرئيسي هو أنه من المفترض أن يكون عكس didInsertElement ، لذا فإن الشيء الرئيسي هو أنه يعمل قبل تفكيك DOM ، لذلك من غير المحتمل أن يتم تغطيته بواسطة willDestroy غير المتزامن بعد تفكيك DOM. من المفترض أيضًا أن يتم تشغيله فقط في حالة تشغيل خطاف didInsertElement.
GavinJoyce يوجد خطأ حالي في أشرطة html مع إطلاق خطاف دورة الحياة هذا متأخرًا جدًا في مساعد المكون. https://github.com/emberjs/ember.js/issues/13028
إنه أيضًا عربات التي تجرها الدواب مع كل / آخر الحالي https://github.com/emberjs/ember.js/issues/12716
لقد تراجعت أيضًا عن توفر parentView في 1.13 ولكن هذا هو واجهة برمجة تطبيقات خاصة وكان هكذا الآن لفترة من الوقت ، ولست متأكدًا مما إذا كان هذا سببًا لتعطل الأشخاص.
هل هناك اختبارات أخرى تغطي دورة الحياة بشكل واضح؟ ربما ينبغي إضافتها إلى أي اختبار يضيف / يزيل المكونات. @ ccatschancancode
loc
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/loc_test.js) ( # 13129 )تم التأكيد على إمكانية حذف الاختبار غير المُستقل من #with
.
#with
# 13130log
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/log_test.js)debug
] (https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/debug_test.js)يمكنني أخذ unbound
: قفل:
سأنقل اختبارات each-in
.
chancancode - أعتقد أنه يمكننا التحقق من / إزالة العنصر debug tests
أيضًا.
custom-helper-tests
.https://github.com/emberjs/ember.js/issues/13139 يزيل مجلد الاختبارات غير المستخدم glimmer-component
أنا أجري "اختبارات عرض المحتوى الأساسي" (وأصلح التنفيذ في Glimmer)
أقوم بإجراء اختبار " select
: المقص:"
التحديث لمطابقة النمط المقدم في 5c12157
collection
test: scissors:" https://github.com/emberjs/ember.js/pull/13161ألقي نظرة على اختبارات العناصر input
إذا كانت لا تزال غير مقفلة.
سألقي نظرة على
لست على دراية بـ Glimmer2 حتى الآن. على أي حال ، تم دمج # 13103 الآن ، لذا سأحاول معرفة كيفية تنفيذه.
أحتاج إلى العمل على خطأ في مكونات الإغلاق ، لذلك سأخضع لاختبار closure component
نحن ننفذ خطافات دورة الحياة: lock : -ing the tests: ok_hand:
اختبار "العنصر الفارغ" رقم 13187: المقص:
اختبار block params
# 13189
: wave: سآخذ:
{{input}} tests
: PR: https://github.com/emberjs/ember.js/pull/13194سآخذ اختبارات العائد
سأقوم أيضًا بإجراء اختبارات attrs_lookup
: PR # 13203
لقد فتحت # 13199 للاختبارات المساعدة partial
.
إجراء اختبارات binding integration
أيضًا
{{yield}}
افتح # 13214 لاختبارات closure component
.
{{tesxtarea}}
سآخذ اختبارات المساعد view
وكل الأشياء التي لمستها.
أردت فقط القفز وأشكر الجميع على مساعدتنا! اعتذاري عن التأخير - نحن نحفر أنفسنا ببطء من التراكم ؛ نحن أقرب مما يظهر على شريط تقدم Github ، لأن الكثير من: lock: عناصر
سآخذ الاختبار {{#each}}
: # 13349
سآخذ اختبار "البحث المحلي"
يبدو أن الملف system/lookup-helper_test.js
يختبر طريقة findHelper
الفعلية ، والتي يبدو لي أنها مغطاة بـ integration/helpers/custom-helper-tests.js
. لا يبدو لي أننا نختبر الوحدة الفعلية ember-glimmer
lib ، لذا ربما ✂️؟ chadhietalaasakusuma بما أن كلاكما لمس الاختبارات المتعلقة بالبحث المساعد ، هل يمكنك تأكيد ذلك؟
Joelkang لا أستطيع تذكر أي شيء متعلق بسؤالك ، ما هي الملفات الدقيقة التي لمستها والمرتبطة؟ إذا كان بإمكاني إلقاء نظرة على git الالتزام حيث لمسته ، فقد أثير ذاكرتي.
asakusuma ، لقد قصدت للتو أنه نظرًا لأنك تعمل على اختبار البحث المحلي ، لمعرفة ما إذا كان هناك أي قواسم مشتركة على الإطلاق
لا يبدو أن integration/helpers/custom-helper-tests.js
يختبر البحث المحلي. أيضًا ، لا يعمل البحث المحلي في بصيص في الوقت الحالي ، والذي أعمل على إصلاحه.
يتم قطع اختبارات التقديم env. بالنظر إلى اختبارات "bootstrap" الآن ، يجب نقل العديد منها مع الوظيفة (باستخدام <script type="text/x-handlebars" data-template-name="foo">
).
هل عملية ترحيل بسيطة mutable bindings
هنا: https://github.com/emberjs/ember.js/pull/13456
تم دمج اختبارات مكونات الإغلاق بالفعل منذ أسبوعين.
شكرا لكم جميعا على العمل الشاق هنا! إغلاق هذا لصالح قائمة / إصدار محدث: # 13644.
التعليق الأكثر فائدة
أردت فقط القفز وأشكر الجميع على مساعدتنا! اعتذاري عن التأخير - نحن نحفر أنفسنا ببطء من التراكم ؛ نحن أقرب مما يظهر على شريط تقدم Github ، لأن الكثير من: lock: عناصر