當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript TEST_BROWSER_APPLICATION_PROVIDERS.concat方法代碼示例

本文整理匯總了TypeScript中angular2/platform/testing/browser.TEST_BROWSER_APPLICATION_PROVIDERS.concat方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TEST_BROWSER_APPLICATION_PROVIDERS.concat方法的具體用法?TypeScript TEST_BROWSER_APPLICATION_PROVIDERS.concat怎麽用?TypeScript TEST_BROWSER_APPLICATION_PROVIDERS.concat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angular2/platform/testing/browser.TEST_BROWSER_APPLICATION_PROVIDERS的用法示例。


在下文中一共展示了TEST_BROWSER_APPLICATION_PROVIDERS.concat方法的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.concat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。