本文整理汇总了TypeScript中@angular/core/testing.it函数的典型用法代码示例。如果您正苦于以下问题:TypeScript it函数的具体用法?TypeScript it怎么用?TypeScript it使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了it函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('should emit Highcharts series event', () => {
it('"afterAnimate"', (done) => {
create(`
<chart [options]="options">
<series (afterAnimate)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('afterAnimate');
});
});
it('"checkboxClick"', (done) => {
create(`
<chart [options]="options">
<series (checkboxClick)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('checkboxClick');
});
});
it('"click"', (done) => {
create(`
<chart [options]="options">
<series (click)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('click');
});
});
it('"hide"', (done) => {
create(`
<chart [options]="options">
<series (hide)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('hide');
});
});
it('"legendItemClick"', (done) => {
create(`
<chart [options]="options">
<series (legendItemClick)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('legendItemClick');
});
});
it('"mouseOut"', (done) => {
create(`
<chart [options]="options">
<series (mouseOut)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('mouseOut');
});
});
it('"mouseOver"', (done) => {
create(`
<chart [options]="options">
<series (mouseOver)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
fixture.detectChanges();
ChartEventEmitter.emitSeriesEvent('mouseOver');
});
});
it('"show"', (done) => {
create(`
<chart [options]="options">
<series (show)="onEvent()"></series>
</chart>
`).then(fixture => {
fixture.componentInstance.onEvent = () => done();
fixture.componentInstance.options = ['options'];
//.........这里部分代码省略.........
开发者ID:ywmail,项目名称:angular2-highcharts,代码行数:101,代码来源:ChartComponent.spec.ts
示例2: describe
describe('Service: TestService', () => {
let mockbackend, service;
/*beforeEachProviders(() => [
Busses,
MockBackend,
BaseRequestOptions,
provide(Http, {
useFactory: (backend, options) => new Http(backend, options),
deps: [MockBackend, BaseRequestOptions]})
]);
beforeEachProviders(() => {
return [
HTTP_PROVIDERS,
provide(XHRBackend, {useClass: MockBackend}),
Busses
];
});
*/
let response = {busses: [
{
id: 1,
numberPlate: "KL-AB345",
color: "green",
picture: "http://www.tm4.com/wp-content/uploads/2014/08/Foton-bus-12-m-e1407525133477.png"
},
{
id: 2,
numberPlate: "KL-CD678",
color: "red",
picture: "http://littlebabybum.com/wp-content/uploads/2015/01/wheels-on-the-bus-red.png"
}]};
beforeEachProviders(() => [
Busses,
BaseRequestOptions,
MockBackend,
provide(Http, {
useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => {
return new Http(backend, defaultOptions);
},
deps: [MockBackend, BaseRequestOptions]
})
]);
/*beforeEach(inject([XHRBackend, Busses], (_mockbackend, _service) => {
mockbackend = _mockbackend;
service = _service;
}))*/
console.log("create connection...");
beforeEach(inject([MockBackend], (backend: MockBackend) => {
const baseResponse = new Response(new ResponseOptions({ body: response }));
backend.connections.subscribe((c: MockConnection) => c.mockRespond(baseResponse));
}));
//specs
it('should request busses from server', inject([Busses], (service: Busses) => {
/*mockbackend.connections.subscribe(connection => {
connection.mockRespond(new Response(new ResponseOptions({body:response})));
});*/
console.log("start request...");
service.requestBusses("");
console.log("finished test spec request");
console.log(service.getBusses());
expect(service.getBusses()).not.toEqual([]);
}));
});
开发者ID:GSE-Project,项目名称:SS2016-group3,代码行数:71,代码来源:bussesSpec.ts
示例3: describe
describe('Component: ChessBoard', () => {
it('should create an instance', () => {
let component = new ChessBoardComponent();
expect(component).toBeTruthy();
});
});
开发者ID:Tony-Luo,项目名称:Ng-chess,代码行数:6,代码来源:chess-board.component.spec.ts
示例4: describe
describe('App: Pcards', () => {
it('should create the app',
inject([AppComponent], (app: AppComponent) => {
expect(app).toBeTruthy();
}));
});
开发者ID:westonpace,项目名称:pcards,代码行数:6,代码来源:app.component.spec.ts
示例5: describe
describe('Smoke test', () => {
it('should run a passing test', () => {
expect(true).toEqual(true, 'should pass');
});
});
开发者ID:samk-ayyagari,项目名称:angular-2,代码行数:5,代码来源:app.component.spec.ts
示例6: describe
describe('Component: Logout', () => {
it('should create an instance', () => {
//let component = new LogoutComponent();
//expect(component).toBeTruthy();
});
});
开发者ID:yboujallab,项目名称:angular2-portal,代码行数:6,代码来源:logout.component.spec.ts
示例7: describe
describe('Component: Article', () => {
it('should create an instance', () => {
let component = new ArticleComponent();
expect(component).toBeTruthy();
});
});
开发者ID:Chris99252,项目名称:Angular2Demo1,代码行数:6,代码来源:article.component.spec.ts
示例8: describe
describe('List Group:', () => {
var listGroup: ListGroup<TestOption> = null;
beforeEach(() => {
listGroup = new ListGroup<TestOption>();
listGroup.getLabel = option => option.name;
});
it('by default, uses JSON.stringify', () => {
let option = new TestOption('id', 'value');
expect(listGroup.getId(option)).toEqual(JSON.stringify(option));
});
describe('selection:', () => {
beforeEach(() => {
listGroup.getId = option => option.id;
});
it('selects an option', (done) => {
let option = new TestOption('id', 'value');
listGroup.select(option)
listGroup.selection.subscribe(selection => {
expect(selection['id']).toEqual(option);
done();
});
});
it('selects multiple options', (done) => {
let options = [
new TestOption('id', 'value'),
new TestOption('id2', 'value')
];
options.forEach(option => listGroup.select(option));
listGroup.selection.subscribe(selection => {
options.forEach(option => expect(selection[option.id]).toEqual(option));
done();
});
});
it('deselects double selected options in multi-select', (done) => {
let options = [
new TestOption('id', 'value'),
new TestOption('id2', 'value'),
new TestOption('id2', 'value')
];
options.forEach(option => listGroup.select(option));
listGroup.selection.subscribe(selection => {
expect(selection['id']).toEqual(options[0]);
expect(selection['id2']).toBeUndefined();
done();
});
});
it('deselects double selected options in multi-select', (done) => {
let options = [
new TestOption('id', 'value'),
new TestOption('id2', 'value'),
new TestOption('id2', 'value')
];
options.forEach(option => listGroup.select(option));
listGroup.selection.subscribe(selection => {
expect(selection['id']).toEqual(options[0]);
expect(selection['id2']).toBeUndefined();
done();
});
});
it('selects single option', (done) => {
listGroup.isMultiple = false;
let options = [
new TestOption('id', 'value'),
new TestOption('id2', 'value')
];
options.forEach(option => listGroup.select(option));
listGroup.selection.subscribe(selection => {
expect(selection['id']).toBeUndefined();
expect(selection['id2']).toEqual(options[1]);
done();
});
});
it('deselects single option', (done) => {
listGroup.isMultiple = false;
let options = [
new TestOption('id', 'value'),
new TestOption('id', 'value')
//.........这里部分代码省略.........
开发者ID:Azure,项目名称:azure-iot-library,代码行数:101,代码来源:list-group.spec.ts
注:本文中的@angular/core/testing.it函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论