0
別のファイルからインポートされたホスト要素のアニメーションを持つコンポーネントでJest-Preset-Angularのテストを実行すると問題が発生する別のコンポーネントで再利用できます)。角度4 + Jest-Preset-Angular:ファイルからインポートされたトリガを使用してホスト上でアニメーションをテストする
example.animation.ts
import { trigger } from '@angular/animations';
export const ExampleAnimationHost = { '[@example]': '' };
export const ExampleAnimationTrigger = trigger('example', []);
example.component.ts
import { Component } from '@angular/core';
import { ExampleAnimationHost, ExampleAnimationTrigger } from './example.animation';
@Component({
selector: 'app-example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.scss'],
animations: [ExampleAnimationTrigger],
host: ExampleAnimationHost,
})
export class ExampleComponent { }
事実であること、私はのanimations
プロパティにトリガををコピー、貼り付ける場合@Component
デコレータ私のテストパス...そうでなければ、それはアニメーション宣言を見つけるように見えないので失敗します。
アイデア?
ワウありがとう、それは私の問題も解決します!私は少し懐疑的だったが、それは実際に働く:D – Tuizi