本文整理汇总了TypeScript中@angular/core/testing.beforeEachProviders函数的典型用法代码示例。如果您正苦于以下问题:TypeScript beforeEachProviders函数的具体用法?TypeScript beforeEachProviders怎么用?TypeScript beforeEachProviders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了beforeEachProviders函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { MywebsiteAppComponent } from '../app/mywebsite.component';
beforeEachProviders(() => [MywebsiteAppComponent]);
describe('App: Mywebsite', () => {
it('should create the app',
inject([MywebsiteAppComponent], (app: MywebsiteAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'My Website\'',
inject([MywebsiteAppComponent], (app: MywebsiteAppComponent) => {
expect(app.title).toEqual('My Website');
}));
});
describe('my own test', function(){
it('number schould be positive',
inject([MywebsiteAppComponent], (app: MywebsiteAppComponent) => {
expect(app).toBeGreaterThan(-1);
}));
})
开发者ID:Saturn91,项目名称:MyWebsite,代码行数:31,代码来源:mywebsite.component.spec.ts
示例2: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { CliProjAppComponent } from '../app/cli-proj.component';
beforeEachProviders(() => [CliProjAppComponent]);
describe('App: CliProj', () => {
it('should create the app',
inject([CliProjAppComponent], (app: CliProjAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'cli-proj works!\'',
inject([CliProjAppComponent], (app: CliProjAppComponent) => {
expect(app.title).toEqual('cli-proj works!');
}));
});
开发者ID:manoj-nama,项目名称:ng2-playarea,代码行数:22,代码来源:cli-proj.component.spec.ts
示例3: beforeEachProviders
import {beforeEachProviders, describe, expect, it, inject} from '@angular/core/testing';
import {PeriscopeAppComponent} from '../app/periscope.component';
beforeEachProviders(() => [PeriscopeAppComponent]);
describe('App: Periscope', () => {
it('should create the app', inject([PeriscopeAppComponent], (app: PeriscopeAppComponent) => {
expect(app).toBeTruthy();
}));
});
开发者ID:TheLarkInn,项目名称:periscope,代码行数:10,代码来源:periscope.component.spec.ts
示例4: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { GithubInfoAppComponent } from '../app/github-info.component';
beforeEachProviders(() => [GithubInfoAppComponent]);
describe('App: GithubInfo', () => {
it('should create the app',
inject([GithubInfoAppComponent], (app: GithubInfoAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'github-info works!\'',
inject([GithubInfoAppComponent], (app: GithubInfoAppComponent) => {
expect(app.title).toEqual('github-info works!');
}));
});
开发者ID:laterbreh,项目名称:github-info,代码行数:22,代码来源:github-info.component.spec.ts
示例5: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { CashFlowAppComponent } from '../app/cash-flow.component';
beforeEachProviders(() => [CashFlowAppComponent]);
describe('App: CashFlow', () => {
it('should create the app',
inject([CashFlowAppComponent], (app: CashFlowAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'cash-flow works!\'',
inject([CashFlowAppComponent], (app: CashFlowAppComponent) => {
expect(app.title).toEqual('cash-flow works!');
}));
});
开发者ID:EscuelaIt,项目名称:Angular2,代码行数:22,代码来源:cash-flow.component.spec.ts
示例6: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { AngularObservableAppComponent } from '../app/angular-observable.component';
beforeEachProviders(() => [AngularObservableAppComponent]);
describe('App: AngularObservable', () => {
it('should create the app',
inject([AngularObservableAppComponent], (app: AngularObservableAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'angular-observable works!\'',
inject([AngularObservableAppComponent], (app: AngularObservableAppComponent) => {
expect(app.title).toEqual('angular-observable works!');
}));
});
开发者ID:MathieuNls,项目名称:mastering-angular2,代码行数:22,代码来源:angular-observable.component.spec.ts
示例7: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { ChangeCalculatorAppComponent } from '../app/change-calculator.component';
beforeEachProviders(() => [ChangeCalculatorAppComponent]);
describe('App: ChangeCalculator', () => {
it('should create the app',
inject([ChangeCalculatorAppComponent], (app: ChangeCalculatorAppComponent) => {
expect(app).toBeTruthy();
}));
// it('should have as title \'change-calculator works!\'',
// inject([ChangeCalculatorAppComponent], (app: ChangeCalculatorAppComponent) => {
// expect(app.title).toEqual('change-calculator works!');
// }));
});
开发者ID:xap5xap,项目名称:changeCalculator,代码行数:22,代码来源:change-calculator.component.spec.ts
示例8: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { AngularPolymerDotnetAppComponent } from '../app/angular-polymer-dotnet.component';
beforeEachProviders(() => [AngularPolymerDotnetAppComponent]);
describe('App: AngularPolymerDotnet', () => {
it('should create the app',
inject([AngularPolymerDotnetAppComponent], (app: AngularPolymerDotnetAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'angular-polymer-dotnet works!\'',
inject([AngularPolymerDotnetAppComponent], (app: AngularPolymerDotnetAppComponent) => {
expect(app.title).toEqual('angular-polymer-dotnet works!');
}));
});
开发者ID:peterblazejewicz,项目名称:polymer-angular-dotnet,代码行数:22,代码来源:angular-polymer-dotnet.component.spec.ts
示例9: beforeEachProviders
import {
beforeEachProviders,
describe,
expect,
it,
inject
} from '@angular/core/testing';
import { Ng2WorkshopAppComponent } from '../app/ng2-workshop.component';
beforeEachProviders(() => [Ng2WorkshopAppComponent]);
describe('App: Ng2Workshop', () => {
it('should create the app',
inject([Ng2WorkshopAppComponent], (app: Ng2WorkshopAppComponent) => {
expect(app).toBeTruthy();
}));
it('should have as title \'ng2-workshop works!\'',
inject([Ng2WorkshopAppComponent], (app: Ng2WorkshopAppComponent) => {
expect(app.title).toEqual('ng2-workshop works!');
}));
});
开发者ID:mrrobbins,项目名称:angular-summit-2016,代码行数:22,代码来源:ng2-workshop.component.spec.ts
示例10: describe
describe('Core Definition Service', () => {
beforeEachProviders(() => {
return [
CoreDefinitionService,
provide(ConfigService, {
useValue: {
get: function () { return 'http://localhost:8000'; }
}
}),
];
});
describe('loadDefinitions', () => {
it('should ask for definitions', inject([CoreDefinitionService], (cds) => {
spyOn(cds, 'getDefinitions').and.returnValue(Observable.of({}));
cds.loadDefinitions();
expect(cds.getDefinitions).toHaveBeenCalled();
}));
it('should store definitions to local storage', inject([CoreDefinitionService], (cds) => {
spyOn(cds, 'getDefinitions').and.returnValue(Observable.of({}));
spyOn(localStorage, 'setItem');
cds.loadDefinitions();
expect(localStorage.setItem).toHaveBeenCalledWith('definitions', '{}');
}));
it('should dispatch definitions', inject([CoreDefinitionService], (cds) => {
spyOn(cds, 'getDefinitions').and.returnValue(Observable.of({
'required': 'hydra:required'
}));
cds.loadDefinitions();
cds.definitions.subscribe(definitions => {
expect(definitions.required).toEqual('hydra:required');
});
}));
it('should accept string as definition', inject([CoreDefinitionService], (cds) => {
spyOn(cds, 'getDefinitions').and.returnValue(Observable.of({
'required': 'hydra:required'
}));
spyOn(cds, 'add');
cds.loadDefinitions();
expect(cds.add).toHaveBeenCalledWith('required', 'hydra:required', {});
}));
it('should accept object with @id as definition', inject([CoreDefinitionService], (cds) => {
spyOn(cds, 'getDefinitions').and.returnValue(Observable.of({
'property': {
'@id': 'hydra:property'
}
}));
spyOn(cds, 'add');
cds.loadDefinitions();
expect(cds.add).toHaveBeenCalledWith('property', 'hydra:property', {});
}));
it('should reject object without @id as definition', inject([CoreDefinitionService], (cds) => {
spyOn(cds, 'getDefinitions').and.returnValue(Observable.of({
'cc:license': {
'@type': '@id'
}
}));
spyOn(cds, 'add');
cds.loadDefinitions();
expect(cds.add).not.toHaveBeenCalled();
}));
});
describe('getDefinitions', () => {
beforeEachProviders(() => {
return [
MockBackend,
BaseRequestOptions,
provide(Http, {
useFactory: (backend, defaultOptions) => {
return new Http(backend, defaultOptions);
}, deps: [MockBackend, BaseRequestOptions]
})
];
});
it('should dispatch local storage definitions', inject([CoreDefinitionService], (cds) => {
spyOn(localStorage, 'getItem').and.returnValue('{"property":"hydra:property"}');
//.........这里部分代码省略.........
开发者ID:coopTilleuls,项目名称:hm-admin,代码行数:101,代码来源:CoreDefinition.service.spec.ts
注:本文中的@angular/core/testing.beforeEachProviders函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论