当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser.TEST_BROWSER_APPLICATION_PROVIDERS类代码示例

本文整理汇总了TypeScript中angular2/platform/testing/browser.TEST_BROWSER_APPLICATION_PROVIDERS的典型用法代码示例。如果您正苦于以下问题:TypeScript TEST_BROWSER_APPLICATION_PROVIDERS类的具体用法?TypeScript TEST_BROWSER_APPLICATION_PROVIDERS怎么用?TypeScript TEST_BROWSER_APPLICATION_PROVIDERS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TEST_BROWSER_APPLICATION_PROVIDERS类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: setBaseTestProviders

import 'es6-shim';
import 'zone.js';
import 'reflect-metadata';

import {setBaseTestProviders} from 'angular2/testing';
import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from 'angular2/platform/testing/browser';
import {UrlResolver} from 'angular2/compiler';
import {provide} from 'angular2/core';


setBaseTestProviders(
	TEST_BROWSER_PLATFORM_PROVIDERS,
	TEST_BROWSER_APPLICATION_PROVIDERS.concat([
		provide(UrlResolver, {useFactory: () => new FakeUrlResolver()})
	])
);


class FakeUrlResolver extends UrlResolver {
	constructor() {
		super();
	}
	resolve(baseUrl: string, url: string): string {
		// We do not attempt to load any CSS,
		// as it is irrelevant during unit tests.
		if (url.substr(-4) === '.css') {
			return '';
		}
		return super.resolve(baseUrl, url);
	}
}
开发者ID:virajs,项目名称:ng2-lab,代码行数:31,代码来源:setup.ts

示例2: onlySpecFiles

declare var System: any;
declare var Zone: any;

import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from "angular2/platform/testing/browser";
import {setBaseTestProviders, MockApplicationRef} from "angular2/testing";
import {MATERIAL_PROVIDERS} from "../ng2-material/all";
import {TestUrlResolver} from "./test_url_resolver";
import {UrlResolver} from "angular2/compiler";
import {provide, ApplicationRef} from "angular2/core";

/**
 * The providers for our tests
 */
const TEST_APP_PROVIDERS = TEST_BROWSER_APPLICATION_PROVIDERS.concat([
  MATERIAL_PROVIDERS,
  provide(ApplicationRef, { useClass: MockApplicationRef }),
  provide(UrlResolver, {useValue: new TestUrlResolver()})
]);
setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_APP_PROVIDERS);


function onlySpecFiles(path) {
  return /_spec\.js$/.test(path);
}

export function load(files: string[]): Promise<any[]> {
  console.log('importing test modules: ');
  let error = (e: any) => {
    console.error(e);
  };
  var myZone = new Zone();
开发者ID:790,项目名称:ng2-material,代码行数:31,代码来源:bootstrap.ts

示例3: onlySpecFiles

declare var System: any;
declare var Zone: any;

import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from "angular2/platform/testing/browser";
import {setBaseTestProviders} from "angular2/testing";
import {MATERIAL_PROVIDERS} from "../ng2-material/all";
import {TestUrlResolver} from "./test_url_resolver";
import {UrlResolver} from "angular2/compiler";
import {provide} from "angular2/core";

/**
 * The providers for our tests
 */
const TEST_APP_PROVIDERS = TEST_BROWSER_APPLICATION_PROVIDERS.concat([
  MATERIAL_PROVIDERS,
  provide(UrlResolver, {useValue: new TestUrlResolver()})
]);
setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_APP_PROVIDERS);


function onlySpecFiles(path) {
  return /_spec\.js$/.test(path);
}

export function load(files: string[]): Promise<any[]> {
  console.log('importing test modules: ');
  let error = (e: any) => {
    console.error(e);
  };
  var myZone = new Zone();
  myZone.fork({
开发者ID:natarajanmca11,项目名称:ng2-material,代码行数:31,代码来源:bootstrap.ts


注:本文中的angular2/platform/testing/browser.TEST_BROWSER_APPLICATION_PROVIDERS类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。