Ember.js: [Plsは半分を送る]究極のグリマヌ2テスト移怍ガむド

䜜成日 2016幎03月19日  Â·  44コメント  Â·  ゜ヌス: emberjs/ember.js

recycle  recycle  recycleこのGithubの問題を印刷する前に、環境を考慮しおください。 recycle  recycle  recycle

裏話

@wycatsず私およびその

それはhtmlbarのフォヌクずしお始たりたしたが、元のグリマヌプロゞェクトなどの構築から埗られたすべおの知識を抜出し、Emberのナヌスケヌスにより適したアヌキテクチャを実珟したしたが、将来の拡匵にも柔軟に察応できるようになりたした。およびその他のEmber以倖のナヌスケヌス。

codezはhttps://github.com/tildeio/glimmerにありたす。 TypeScriptで再曞かれおいお、かなりかっこいいず思いたす。 ずにかく、それに぀いおはEmberConfで

統合

゚ンゞンでやりたい䜜業䞻に最適化はただたくさんありたすが、Emberの基本的なナヌスケヌスをすべおカバヌするのに十分な実装ができおいるず思いたす。 そのため、玄2か月前に、新しい゚ンゞンをEmber本䜓に統合し始めたした。 これたでの進捗状況に぀いおは、このメタ問題をフォロヌできたす。

新しい゚ンゞンを実際のアプリで䜿甚するこずはただ䞍可胜ですが、䜜業は比范的早く完了するず予想されたす。 実装が完了するず、元のハンドルバヌからHTMLBarぞの移行ず同じように、アプリの比范的簡単なドロップむンアップグレヌドになるこずが期埅されたす。

機胜フラグを切り替える機胜は、既存のすべおの機胜が実装される前に実行される可胜性があるため、最初からアプリずシヌムレスに機胜しない可胜性があるこずに泚意しおください。

plsはhalpを送信したす

だから、あなたは「どうすれば手䌝うこずができるのか」ず疑問に思うかもしれたせん。

よろしくお願いしたす boom  sparkles  fireworks  tada

この時点で、支揎するためにできる最倧の䟡倀は、既存のテストの移怍を支揎するこずですそしお、これらのPRのレビュヌを支揎するこずです。 ご芧のずおり、Emberには、「ビュヌレむダヌ」の動䜜をテストする非垞に広範なテストスむヌトがありたす。 問題は、これらのテストの倚くが、既存の実装ず完党に結合された方法で蚘述されおいるか、サポヌトされなくなったレガシヌセマンティクス {{view.foo}} を䜿甚しおいるこずです。

リグレッションが発生しおいないこずを確認するために、珟圚のレンダリング゚ンゞン「htmlbars」ずGlimmer2の䞡方に察しおテストスむヌト党䜓を実行できるようにしたいず思いたす。

それを可胜にする新しいテストハヌネスを䜜成したした。 以䞋で技術的な詳现に぀いお説明したすが、基本的な考え方は、2぀の゚ンゞンの違いをカプセル化する抜象化レむダヌに察しおテストケヌスを蚘述し、テストケヌス内の同じコヌドを䞡方の実装に察しお実行できるようにするこずです。

その過皋で、プロセス内の既存のテストを「最新化」しお、レガシヌセマンティクスに䟝存しないようにしたすこれらのセマンティクスを明瀺的にテストしおいるように芋える堎合を陀き、その堎合はそのたたにしおおきたす。 たた、新しいテストハヌネスを䜿甚するず、「マトリックススタむル」のテストをはるかに簡単か぀快適に行うこずができたす。 これに぀いおは以䞋で詳しく説明したすが、ここに高レベルのアヌキテクチャ図がありたす。

matrix

最終的な結果ずしお、テストの読みやすさず掚論がはるかに簡単になり、察象範囲も倧幅に拡倧したした。 これは誰にずっおも玠晎らしい結果ですが、ただただ倚くのテストが残っおおり、すべおが移怍されない限り、゚ンゞンを出荷する自信はありたせん。 ただし、テストファむルをそれぞれ移怍するのを手䌝っおくれる人がいれば、来週のこの時間たでに非垞に良い状態になりたす。

ハヌネスのしくみ

私たちが䜿甚した実際のメカニズムはかなりロヌテクです。 聞いたこずがあるかもしれたせんが、シンボリックリンクず呌ばれおい

テストフォルダ内にember-glimmerパッケヌゞには、ファむルず呌ばれるでしょうabstract-test-case.jsもシンボリックリンクされおいる、同じ堎所内のember-htmlbarsパッケヌゞ。 このファむルは、テストケヌスの䜜成に䜿甚するAPIを定矩したす。 このファむルは䞡方のパッケヌゞ間で共有シンボリックリンクされおいるため、2぀の実装に固有の情報は含たれおいたせん。

代わりに、すべおの違いは、各パッケヌゞによっお提䟛されるファむル import ... from './helpers' をむンポヌトするこずによっお抜象化されたす。 あるいは、各パッケヌゞは、 test-case.jsの「抜象」クラスの特定のメ゜ッドをオヌバヌラむドするこずもできたす ember-glimmerずember-htmlbarsバヌゞョンを参照。

倚くの堎合、これらのファむルをたったく倉曎する必芁はないかもしれたせんが、それがどのように機胜するか、たたは内郚で䜜業が行われる堎所を知っおいるず、問題が発生した堎合でも圹立぀堎合がありたす。

テストの仕組み

゚ンゞンは実際のアプリのドロップむンアップグレヌドを目的ずしおいるため、テストでこれらの機胜が実際にどのように䜿甚されるかを実際にテストしおいる限り、テストが実行されない理由はありたせん。䞡方の゚ンゞン。

それがこれたでの私たちの焊点でした。 ここに䟋がありたす。

このテストは物理的にember-glimmerディレクトリ内にありたすが、 ember-htmlbarsディレクトリ内の同じ堎所に

ご芧のずおり、テストはこのパッケヌゞ固有のtest-case.jsむンポヌトしたすが、それ以倖の堎合はレンダリング゚ンゞンの実装に䟝存したせん。

プロセス

䞀般的に、そしお高レベルでは、プロセスは次のようになりたす。

  1. ポヌトするテストファむルを遞択したす通垞、 ember-htmlbarsどこかにある既存のテストファむルです
  2. ember-glimmer/tests/integration/...どこかに新しいファむルを䜜成したす
  3. 各テストケヌス/モゞュヌルを新しいファむルに移怍したす。

    • 新しいmoduleForおよびES6クラス圢匏の䜿甚

    • 各テストが「INUR」サむクルを通過するこずを確認したす「初期レンダリング->操䜜なしの再レンダリング->ミュヌテヌションによる曎新->眮換によるリセット」サむクル、これに぀いおは以䞋で詳しく説明したす

    • 重耇したテストたたは䞊蚘の曎新サむクルで暗黙的にカバヌされおいるテストを削陀無芖したす

  4. 芪フォルダヌがすでにember-htmlbarsシンボリックリンクである堎合を陀き、テストをember-htmlbarsパッケヌゞにシンボリックリンクしたす䞊蚘の連結テストのように
  5. 叀いファむルを削陀したす移怍できないテストがただ含たれおいる堎合を陀く
  6. プルリク゚ストを開く
  7. 確認しやすくするために、削陀したテストケヌスごずに、理由を蚘茉したコメントを远加したす䟋/それは今を介しおカバヌされおいたす/それはの耇補でした/ ...。 よくわからないテストに぀いおは、コメントや質問を自由に远加するこずもできたす。

良いテストの曞き方

テストケヌスを改善するために埓うこずができるいく぀かの䞀般的なヒント/ルヌルを次に瀺したす。

「INUR」サむクル

各テストで「INUR」サむクルを実行する必芁がありたす。

  1. 初期レンダリング

遞択した初期倀 this.render(..., { ... }) を䜿甚しお、テストするテンプレヌトをレンダリングし、結果が期埅どおりであるこずを衚明したす。 䟋

  1. ノヌオペレヌションの再レンダリング

倀を倉曎せずにthis.runTask(() => this.rerender());を呌び出し、結果が同じたたであるこずを衚明したす。 䟋

  1. ミュヌテヌションによる曎新

テンプレヌトで䜿甚する倀を曎新したす。 䟋

次のこずを詊しおください。

  • 意味がある堎合は、曎新を耇数のチャンク぀たり、耇数のthis.runTask +アサヌションに分割したす。 これにより、倀の_some_を曎新するず、テンプレヌトの別の無関係な郚分が「吹き飛ばされ」たり、その他の望たしくない圱響が発生したりする「砎壊」バグをキャッチする可胜性が高くなりたす。
  • 意味がある堎合は、「内郚倉異」を䜿甚しおください。 倀が単なる文字列たたはその他のプリミティブ倀である堎合、これは問題ではありたせんが、オブゞェクトたたは配列を凊理する堎合、これは、オブゞェクト/配列を維持しながら、オブゞェクト/配列の「内郚」の倀を曎新するこずを意味したす。同じ。 配列の䟋、オブゞェクトの䟋
  • 理にかなっおいる堎合は、さたざたな圢匏の「内​​郚突然倉異」を詊しおください。 これを行う方法が耇数ある堎合たずえば、 pushObjectアむテムの削陀など、通垞は耇数の方法を詊すこずをお勧めしたす。 䟋

    1. 亀換によるリセット

すべおの倉数を眮き換えお、元の開始条件にリセットしたす。

  • リセットこれは、テキストノヌドの元の倀をキャッシュし、途䞭でキャッシュを曎新するのを忘れたバグをキャッチするのに圹立ちたす。 その堎合、元の倀以倖に倉曎するず問題なく動䜜したす。 ただし、元の倀に戻すず、DOMコヌドが短絡し、䜕も実行されたせん。
  • 眮換繰り返したすが、倀が文字列のような単玔なプリミティブ倀である堎合、これは違いを生みたせん。 ただし、倀がオブゞェクト/配列などの堎合、これは、そのオブゞェクト/配列を別の新しいオブゞェクトに眮き換えるこずを意味したす内郚倀を倉曎するのではありたせん。 配列の䟋、オブゞェクトの䟋

テストの重耇を避ける

テストケヌスを数回コピヌしお、同じもののわずかに異なるバリ゚ヌションをテストするのは簡単ですたずえば、trueずfalseで始たる{{#if foo}} 、たたは「POJO」ずEmber.Objectの違い 、そしお既存のテストでそれをたくさん行いたした。

それが最善の方法である堎合もありたすが、これには倚くの問題がありたす。 たず、ファむル内に物理的に倧量のテストが生成されるため、物を芋぀けるのが困難になりたす。 たた、誰かが新しいテストを远加する必芁があるずき、圌らは通垞、いく぀かのバリアントの1぀をランダムに遞択し、新しいシナリオにはあたり意味のない詳现/間違いを匕き継ぎたす。 コピヌの1぀でバグを修正するず、残りの郚分はおそらく忘れおしたいたす。

通垞、重耇を回避する方法がありたす。 たずえば、異なる開始条件 {{#if foo}} trueおよびfalseに察しお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ありたすを定矩するだけで、倚くの共有テストを自動的に取埗したす。

「むンラむンif / unless」テストはこれをさらに進め、11の異なる呌び出しシナリオに察しお同じテストケヌスのセットを実行したす。

共有の実際の構造に到達するのはやや難しく、成熟/正しくなるたでに時間がかかりたしたが、その芋返りは莫倧でした基本的なシナリオは珟圚{{#with}}ず{{#each}}間で共有されおいたす同様に。

レガシヌセマンティクス

既存のテストの倚くは、ビュヌ、 {{view.foo}} 、 {{#view}} 、 context 、コントロヌラヌなどのレガシヌセマンティクスを䜿甚しおいたす。ほずんどの堎合、これは単なる偶発的なものであり、それらのプリミティブが物事を行うための䞻な方法であった時代に曞かれたテストの結果。 そのような堎合、通垞は問題なく新しいハヌネス代わりにコンポヌネントを䜿甚に移怍できたす。

疑わしい堎合は、PRの最初の反埩で移怍されおいないテストを行い、行コメントで質問するこずもできたす。

attrsたたはattrs

カヌリヌコンポヌネントほずんどすべおを䜿甚するテストでは、デフォルトで{{attrs.foo}}を䜿甚せず、同じ名前のプロパティに反映されおいる属性぀たり、 {{foo}}のみに䟝存するこずにしたした。 attrs.*のテストである堎合を陀きおそらくすべお同じファむルにあるはずです、䞀貫性を保぀ために、通垞は{{attrs.foo}}ではなく{{foo}}する必芁がありたす。 曖昧さを解消する必芁があるず感じた堎合は、い぀でもinnerFooずouterFooような名前を付けるこずができたす。

@locksによるhttps://locks.svbtle.com/to-attrs-or-not-to-attrsも参照しおください。

è­Šå‘Š

移怍したテストがGlimmer2でもHTMLBarでも機胜しない堎合がありたす。 どちらの゚ンゞンでも機胜しない堎合は、おそらく䜕か問題がありたす。

Glimmer 2で機胜しない堎合は、その機胜がただ完党に実装されおいないこずが原因である可胜性がありたす。 たずえば、基本的なコンポヌネントのサポヌトを実装したしたが、珟時点ではattributeBindingsを実装しおいたせん。

この堎合でも、テストを新しいスタむルに移怍しお、機胜の実装時に簡単に有効にできるようにするこずをお勧めしたす。 Glimmer 2のテストを䞀時的に無効にするには、メ゜ッド名の@testプレフィックスを@htmlbarsに眮き換えるだけです぀たり、「これをHTMLBarsのみで実行する」。 moduleFor名前の前に@htmlbars付けるこずで、モゞュヌル党䜓を無効にするこずもできたす。

たれに、テストはGlimmer 2で正しく機胜したすが、HTMLBarでは合栌したせん。 テストしおいるセマンティクスが正しいこずを再確認する必芁がありたすが、HTMLBarの珟圚の実装に単にバグがある可胜性も十分にありたす。 これは通垞、䞀郚のHTMLBars機胜を新しい「マトリックススタむル」でテストするずきに発生したす。䞀郚の゚ッゞケヌスでは、倀が正しく曎新されたせん。

その堎合、同様に、個々のテストケヌスたたはモゞュヌル党䜓に@glimmerフラグを立おるこずができたす。 これは非垞にたれであるず予想されるためバグ修正が必芁になる堎合がありたす、発生した問題の簡単な説明を行コメントに含めるこずができれば䟿利です。

䟋

コミュニティメンバヌが既存のテストの移怍を支揎した優れた䟋をいく぀か瀺したす。

  • 12920むンラむン{{if}}ヘルパヌ
  • 12927 {{#with}}
  • 13019むンラむン{{unless}}
  • 13093 (hash)ヘルパヌ

ご芧のずおり、初期の反埩はより困難でした共有されたテストケヌスのストヌリヌをただ理解しおいたしたが、埌者の詊みは比范的簡単でした。 道を開いおくれおありがずう@GavinJoyceず@chadhietala 

だから...どこから始めればいいの

これが良い出発点のリストです。 これらのいずれかに取り組むこずを真剣に考えおいる堎合は、他の人がそれに取り組んでいないこずを知っおもらうために、以䞋にコメントを残したいず思うでしょう。 時間がなくなったり、非垞に困難に遭遇した堎合は、「ロックを解陀」に戻ったり、WIP䜜業をプッシュしお、他の人がそれを拟うこずができるようにしおください

  • [x] @chancancodeによる基本的なコンテンツレンダリングテスト13141

これがすでに存圚するかどうかはわかりたせん。 芋぀けお移怍しおみおください。 ただし、それ以倖の堎合は、新しいファむルを䜜成しおくださいhttps://github.com/emberjs/ember.js/blob/master/packages/ember-glimmer/tests/integration/content-test.jsで既に開始しおいたす 。 アむデアは、「DOMに奇劙なものを入れたらどうなるか」をテストしたいずいうものです。たずえば、 {{foo}} 、ここでfooはundefined 、 null 、オブゞェクトなど。これは「マトリックススタむル」テストの䞻芁なタヌゲットであるため、テストハヌネスがどのように機胜するかを調べお、条件付きテストからアむデアを匕き出すこずをお勧めしたす。

これはhttps://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/hooks/text_node_test.jsも吞収するはずです。

  • [x] [ attr_nodesテスト]https://github.com/emberjs/ember.js/tree/master/packages/ember-htmlbars/tests/attr_nodeslock @chancancodeおよび@ wycats

これらのテストを詳しく芋お、芁件を理解したいず思いたす。 今のずころそれをロックしたす。

  • [] [ compatテスト]https://github.com/emberjs/ember.js/tree/master/packages/ember-htmlbars/tests/compatscissors

埓来のアドオンのサポヌトを2.6たでに終了するこずを発衚したため、Glimmer 2でこれらの機胜をサポヌトする必芁はありたせん。マスタヌのテストず機胜を削陀するには、PRを開いおください。 これには、おそらくコヌドベヌスに関する比范的深い知識が必芁です。

  • [x] [ glimmer-componentテスト]https://github.com/emberjs/ember.js/tree/master/packages/ember-htmlbars/tests/glimmer-componentscissors 13139 by @ lorcan

このフォルダは未䜿甚です。 削陀するにはPRを送信しおください。

  • ヘルパヌ tests/integration/helpers移動する必芁があるず思いたす

    • [] [ -html-safe ]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/-html-safe-test.jslock 

I'm not sure if this is needed for Glimmer 2. Locking for now.

  • [x] [ 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.

  • [x] [ collectionテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/collection_test.jsはさみ 13161 @HeroicEricによる
This is legacy. Please open a PR to remove the test and any code you could find that implements the feature.

  • [x] [ #componentヘルパヌ]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/component_test.js 13140 by @GavinJoyce
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).

  • [x] [カスタムヘルパヌテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/custom_helper_test.js 13138 by @zackthehuman
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).

  • [x] [ debugテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/debug_test.jsはさみ 13129 @ code0100funによっお
This is a duplicate of `log` as far as I can tell. See notes on `log` tests below.

  • [x] [ #each-inテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/each_in_test.js 13136 by @mmun
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.

  • [x] [ #eachテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/each_test.js🔒by @ Joelkang
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.) 

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.

  • [x] [ getテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/get_test.js 13173 、 13264 @ ro0grによっお
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.)

  • [x] [if / unless tests]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/if_unless_test.js
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 @ GavinJoyce
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™.)

  • [x] [ locテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/loc_test.js 13129 by @ code0100fun
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`.

  • [x] [ logテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/log_test.js 13131 by @green -矢印
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.

  • [x] [ partialテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/partial_test.js 13199 、 13306 @jhethず@chadhietalaによる
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`.

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™.)

  • [x] [ unboundテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/unbound_test.js 13137 by @chadhietala
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.)

  • [x] [ 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.)

  • [x] [ 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?

  • [x] [ 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).

  • 「統合」テスト

    • [x] ["属性バむンディング"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/attribute_bindings_test.js🔒 @ chadhietala 13481

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

  • [x] ["attrs_lookup"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/attrs_lookup_test.js 13203 by @Joelkang
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.

  • [x] [「バむンディング統合」テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/binding_integration_test.js 13210 by @Joelkang
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!

  • [x] ["block params"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/block_params_test.js 13189 by @Joelkang
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.

  • [x] [ elementIdテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/component_element_id_test.js 13208 by @jheth
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.)

  • [x] [コンポヌネント呌び出しテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/component_invocation_test.js 12890 by @Serabe
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.

  • [x] [コンポヌネントラむフサむクルテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/component_lifecycle_test.jslock @chancancodeおよび@ wycats
Most of these functionality are not yet implemented in Glimmer 2, so you might have to `@htmlbars` the entire module.

  • [x] ["escape"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/escape_integration_test.js  13143 by 13259
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.

  • [x] ["ヘルパヌルックアップ"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/helper-lookup-test.jsscissors 13147 by @chadhietala
I think this must already be tested in the helpers test? Please do investigate and open a PR to remove if true.

  • [バツ] [ テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/input_test.jslockby @paddyobrien
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.

  • [x] ["ロヌカルルックアップ"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/helper-lookup-test.jsscissors
I'm not sure if this is implemented in Glimmer 2 yet. Please port the test cases and flag with `@htmlbars` as needed.

  • [x] ["可倉バむンディング"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/mutable_binding_test.jslock
The Glimmer 2 implementation might change the story a bit, locking for now.

  • [x] [ selectテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/select_in_template_test.jsはさみ 13144 @HeroicEricによる
This is legacy. Please open a PR to remove the test and any code you could find that implements the feature.

  • [x] ["タグレスビュヌ"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/tagless_views_rerender_test.jsscissors
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.

  • [x] ["void element"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/void-element-component-test.jsはさみ @MatrixZによる
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.

  • [x] ["willDestroyElement"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/will-destroy-element-hook-test.js lock@krisseldenによる
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`.

  • [x] ["with + view"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/with_view_test.jsscissors 13149 by @chadhietala
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>

  • [] ["ノヌドマネヌゞャヌの衚瀺"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/node-managers/view-node-manager-test.js scissors  question

ViewNodManagerの実装は、内郚のものがただhtmlbarのビュヌずしお実装されおいるため、おそらくもう少し長く続ける必芁がありたすが、これは重芁なこずをテストしおいるようには芋えないので、おそらくscissorsそれ @rwjblue確認できたすか

  • 「システム」テスト

    • [x] ["テンプレヌトビュヌを远加"]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/system/append-templated-view-test.jsはさみ @chadhietalaによる

This is likely legacy. Please do investigate!

  • [x] ["bootstrap"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/system/bootstrap_test.jsquestion  lock @krisselden
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.

  • [] ["ルックアップヘルパヌ"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/system/lookup-helper_test.jslock@mixonic
Please do investigate what this is testing, and see if it could be merged into the helpers integration tests.

  • [x] ["render env"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/system/render_env_test.jsscissors  lockhttps //github.com/emberjs/ember.js/pull/13399 @mixonic
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?

移怍する必芁のある他のテストもおそらくありたす。 私が芋逃したこずに気づいたら、コメントでそれらを述べおください。

レビュヌ

PRを提出する準備ができたらWIP PRを提出しおください、PRの説明でこの問題を参照しおください。確認したす。

時間枠

できるだけ早く倚くのテストを移怍したいず考えおいたす。 理想的には、すべおではないにしおも、ほずんどのテストを1〜2週間以内に移怍する必芁がありたす。

よろしくお願いしたす heart  yellow_heart  green_heart  blue_heart  purple_heart

Glimmer2 Help Wanted

最も参考になるコメント

ただ飛び蟌んで、私たちを助けおくれたみんなに感謝したいです 😄遅延に぀いおお詫びしたす–私たちはバックログからゆっくりず自分自身を掘り䞋げおいたす。  lockedアむテムの倚くには、レビュヌを埅っおいるPRがすでにあるため、Githubのプログレスバヌに衚瀺されるよりも近くにありたす🎉

党おのコメント44件

  • [x]hand #component helper PR https 
  • [x]残りのif/unless testsも削陀/移怍したすPR https 

「willDestroyElement」テストを芋おいきたす。

重芁なのは、didInsertElementの逆であるず想定されおいるため、DOMティアダりンの前に実行されるため、DOMティアダりン埌に非同期であるwillDestroyでカバヌされる可胜性は䜎いずいうこずです。 たた、didInsertElementフックが実行された堎合にのみ実行されるこずになっおいたす。

@GavinJoyce htmlbarsには珟圚のバグがあり、このラむフサむクルフックの起動がコンポヌネントヘルパヌで遅すぎたす。 https://github.com/emberjs/ember.js/issues/13028

たた、珟圚のeach / elsehttps //github.com/emberjs/ember.js/issues/12716にもバグがあり

たた、1.13で利甚可胜であるparentViewを埌退させたしたが、これはプラむベヌトAPIであり、しばらくの間そのようになっおいたすが、それが人々の行き詰たりの理由であるかどうかはわかりたせん。

きらめきのラむフサむクルをカバヌする他のテストはありたすか おそらく、コンポヌネントを远加/削陀するテストにそれらを远加する必芁がありたす。 / cc @wycats @chancancode

  • [x] [ locテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/loc_test.js 13129 

移怍されおいない#withテストを削陀できるこずを確認したした。

  • [x]レガシヌ#withテストを削陀する13130

PR13131

  • [x] [ logテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/log_test.js
  • [x] [ debugテスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/helpers/debug_test.js

unboundを取るこずができたすlock

each-inテストを移怍したす。

@chancancode - debug testsアむテムもチェック/削陀できるず思いたす。

  • [x] custom-helper-tests 。

https://github.com/emberjs/ember.js/issues/13139は、未䜿甚のglimmer-componentテストフォルダヌを削陀したす

「基本的なコンテンツレンダリングテスト」を受けおいたすそしおGlimmerでの実装を修正しおいたす

「 selectテストはさみ」を取っおいたす

  • [x] ["escape"テスト]https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/tests/integration/escape_integration_test.jsWIP13143

5c12157で導入されたスタむルに䞀臎するように曎新

input芁玠のテストがただロックされおいないかどうかを調べおいたす。

  • [x]タグレスビュヌテスト13146はさみ
  • [x]ヘルパヌルックアップテスト13147が移行されたしたscissors
  • [x]「テンプレヌトビュヌを远加」13148はさみ
  • [x]「with + view」テスト13149はさみ

芋おみたす

  • [x]ヘルパヌテストを取埗する13173lock

私はただGlimmer2に粟通しおいたせん。 ずにかく13103がマヌゞされたので、それを実装する方法を芋぀けようずしたす。

クロヌゞャヌコンポヌネントのバグに取り組む必芁があるので、 closure componentのテストを受けたす

ラむフサむクルフックを実装しおいたす lock-テストを実行しおいたすok_hand

「ボむド゚レメント」テスト13187はさみ

block paramsテスト13189

wave私が取る

  • [x] {{input}} tests PR https 

歩留たりテストを行いたす

  • []歩留たりテスト

たた、先に進んでattrs_lookupテストを行いたすPR13203

partialヘルパヌテスト甚に13199を開きたした。

binding integrationテストも受けたす

13213は{{yield}}テストのために開いおいたす

closure componentテストのために13214を開きたす。

{{tesxtarea}}テストの堎合は13215

viewヘルパヌテストずそれに觊れたすべおのものを取り䞊げたす。

ただ飛び蟌んで、私たちを助けおくれたみんなに感謝したいです 😄遅延に぀いおお詫びしたす–私たちはバックログからゆっくりず自分自身を掘り䞋げおいたす。  lockedアむテムの倚くには、レビュヌを埅っおいるPRがすでにあるため、Githubのプログレスバヌに衚瀺されるよりも近くにありたす🎉

{{#each}}テストを受けたす13349

「ロヌカルルックアップ」テストを行いたす

system/lookup-helper_test.jsファむルが実際のfindHelperメ゜ッドをテストしおいるように芋えたすが、これはintegration/helpers/custom-helper-tests.jsでカバヌされおいるように芋えたす。 実際のember-glimmer libをナニットテストしおいるようには思えないので、おそらく✂ @chadhietala @asakusumaふたりずもヘルパヌルックアップ関連のテストに觊れたので確認できたすか

@Joelkangあなたの質問に関連するものは䜕も思い出せたせんが、私が觊れた正確なファむルのうち、関連するものは䜕ですか 觊れた堎所のgitcommitを芋るこずができれば、蚘憶を揺さぶる可胜性がありたす。

@asakusumaああ、私はあなたがロヌカルルックアップテストに取り組んでいるので、そこに共通点があるかどうかを確認するこずを意味したした

integration/helpers/custom-helper-tests.jsはロヌカルルックアップをテストしおいないようです。 たた、ロヌカルルックアップは珟圚グリマヌで機胜しおいたせん。これは修正に取り組んでいたす。

レンダリング環境テストは省略されたす。 ここで「ブヌトストラップ」テストを芋るず、その倚くは機胜ずずもに移怍する必芁がありたす <script type="text/x-handlebars" data-template-name="foo"> 。

ここでmutable bindings単玔な移行を行いたした https 

クロヌゞャヌコンポヌネントのテストは、数週間前にすでにマヌゞされおいたす。

ここで頑匵っおくれおありがずう 曎新されたリスト/問題を支持しおこれを閉じたす13644。

このペヌゞは圹に立ちたしたか
0 / 5 - 0 評䟡