我似乎无法测试在Angular 2中使用Date管道的组件(通过PhantomJS使用Karma).当我尝试时,我得到ORIGINAL EXCEPTION:ReferenceError:找不到变量:Intl
这是我的整个spec文件:
import { provide, PLATFORM_PIPES } from '@angular/core';
import { DatePipe } from '@angular/common';
import { addProviders, async, inject } from '@angular/core/testing';
import { Post, PostComponent, PostHtmlComponent } from './';
import { usingComponentFixture } from '../../test-helpers';
describe('Component: Post', () => {
beforeEach(() => {
provide(PLATFORM_PIPES, {useValue: DatePipe, multi: true });
addProviders([PostComponent, PostHtmlComponent, ]);
});
it('should render an h1 tag with text matching the post title',
usingComponentFixture(PostComponent, fixture => {
let component = <PostComponent>fixture.componentInstance;
let element = …Run Code Online (Sandbox Code Playgroud)