【发布时间】:2021-02-12 04:04:42
【问题描述】:
我尝试测试一个组件,但在模板中使用 cutom 管道
component.html:
<ul class="test">
<li class="test1">{{'LABEL_TEST_PIPE' | translateLabels }}</li>
</ul>
component.spec.ts
describe('Component', () => {
let fixture: ComponentFixture<Component>;
beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [ Component ],
imports: [ TranslateLabelsPipe ]
});
});
test('should be translate', () => {
fixture = TestBed.createComponent(Component);
const component = fixture.componentInstance;
fixture.detectChanges();
const element = fixture.debugElement;
expect(element.nativeElement.querySelector('li').textContent).toContain('test pipe translate');
});
});
我的终端里有这个:
Test Suites: 0 failed, 0 of 1 total
Tests: 0 total
Snapshots: 0 total
Time: 284 s
我必须用 Ctrl+C 停止它,否则它永远不会停止... 当我移除管道时,我的测试工作并自行停止。 我试图模拟它,但它也不起作用。
有人知道吗?
谢谢
【问题讨论】:
标签: angular components pipe