Bones/node_modules/angular2/platform/testing/server.js

67 lines
11 KiB
JavaScript
Raw Normal View History

2017-05-17 13:45:25 -04:00
'use strict';var core_1 = require('angular2/core');
var parse5_adapter_1 = require('angular2/src/platform/server/parse5_adapter');
var animation_builder_1 = require('angular2/src/animate/animation_builder');
var animation_builder_mock_1 = require('angular2/src/mock/animation_builder_mock');
var directive_resolver_mock_1 = require('angular2/src/mock/directive_resolver_mock');
var view_resolver_mock_1 = require('angular2/src/mock/view_resolver_mock');
var mock_location_strategy_1 = require('angular2/src/mock/mock_location_strategy');
var location_strategy_1 = require('angular2/src/router/location/location_strategy');
var ng_zone_mock_1 = require('angular2/src/mock/ng_zone_mock');
var test_component_builder_1 = require('angular2/src/testing/test_component_builder');
var xhr_1 = require('angular2/src/compiler/xhr');
var utils_1 = require('angular2/src/testing/utils');
var compiler_1 = require('angular2/src/compiler/compiler');
var dom_tokens_1 = require('angular2/src/platform/dom/dom_tokens');
var dom_adapter_1 = require('angular2/src/platform/dom/dom_adapter');
var api_1 = require('angular2/src/core/render/api');
var dom_renderer_1 = require('angular2/src/platform/dom/dom_renderer');
var shared_styles_host_1 = require('angular2/src/platform/dom/shared_styles_host');
var common_dom_1 = require('angular2/platform/common_dom');
var dom_events_1 = require('angular2/src/platform/dom/events/dom_events');
var lang_1 = require('angular2/src/facade/lang');
var utils_2 = require('angular2/src/testing/utils');
function initServerTests() {
parse5_adapter_1.Parse5DomAdapter.makeCurrent();
utils_1.BrowserDetection.setup();
}
/**
* Default patform providers for testing.
*/
exports.TEST_SERVER_PLATFORM_PROVIDERS = lang_1.CONST_EXPR([
core_1.PLATFORM_COMMON_PROVIDERS,
new core_1.Provider(core_1.PLATFORM_INITIALIZER, { useValue: initServerTests, multi: true })
]);
function appDoc() {
try {
return dom_adapter_1.DOM.defaultDoc();
}
catch (e) {
return null;
}
}
/**
* Default application providers for testing.
*/
exports.TEST_SERVER_APPLICATION_PROVIDERS = lang_1.CONST_EXPR([
// TODO(julie): when angular2/platform/server is available, use that instead of making our own
// list here.
core_1.APPLICATION_COMMON_PROVIDERS,
compiler_1.COMPILER_PROVIDERS,
new core_1.Provider(dom_tokens_1.DOCUMENT, { useFactory: appDoc }),
new core_1.Provider(dom_renderer_1.DomRootRenderer, { useClass: dom_renderer_1.DomRootRenderer_ }),
new core_1.Provider(api_1.RootRenderer, { useExisting: dom_renderer_1.DomRootRenderer }),
common_dom_1.EventManager,
new core_1.Provider(common_dom_1.EVENT_MANAGER_PLUGINS, { useClass: dom_events_1.DomEventsPlugin, multi: true }),
new core_1.Provider(xhr_1.XHR, { useClass: xhr_1.XHR }),
new core_1.Provider(core_1.APP_ID, { useValue: 'a' }),
shared_styles_host_1.DomSharedStylesHost,
common_dom_1.ELEMENT_PROBE_PROVIDERS,
new core_1.Provider(core_1.DirectiveResolver, { useClass: directive_resolver_mock_1.MockDirectiveResolver }),
new core_1.Provider(core_1.ViewResolver, { useClass: view_resolver_mock_1.MockViewResolver }),
utils_2.Log,
test_component_builder_1.TestComponentBuilder,
new core_1.Provider(core_1.NgZone, { useClass: ng_zone_mock_1.MockNgZone }),
new core_1.Provider(location_strategy_1.LocationStrategy, { useClass: mock_location_strategy_1.MockLocationStrategy }),
new core_1.Provider(animation_builder_1.AnimationBuilder, { useClass: animation_builder_mock_1.MockAnimationBuilder }),
]);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYW5ndWxhcjIvcGxhdGZvcm0vdGVzdGluZy9zZXJ2ZXIudHMiXSwibmFtZXMiOlsiaW5pdFNlcnZlclRlc3RzIiwiYXBwRG9jIl0sIm1hcHBpbmdzIjoiQUFBQSxxQkFVTyxlQUFlLENBQUMsQ0FBQTtBQUN2QiwrQkFBK0IsNkNBQTZDLENBQUMsQ0FBQTtBQUU3RSxrQ0FBK0Isd0NBQXdDLENBQUMsQ0FBQTtBQUN4RSx1Q0FBbUMsMENBQTBD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