fix(test_lib): don't mock out XHR via MockXHR by default in tests

This is useful for the compiler tests, but otherwise it's not useful.

Additionally if an application has external templates (as is common) then
we should actually fetch these templates in tests.

Fixes #4539

Closes #4682
This commit is contained in:
Igor Minar 2015-10-12 10:23:51 -07:00
parent eacc8e3803
commit 6abed8d996
2 changed files with 7 additions and 4 deletions

View File

@ -30,7 +30,6 @@ import {
import {MockDirectiveResolver} from 'angular2/src/mock/directive_resolver_mock'; import {MockDirectiveResolver} from 'angular2/src/mock/directive_resolver_mock';
import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock'; import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
import {MockXHR} from 'angular2/src/core/compiler/xhr_mock';
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy'; import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
import {LocationStrategy} from 'angular2/src/router/location_strategy'; import {LocationStrategy} from 'angular2/src/router/location_strategy';
import {MockNgZone} from 'angular2/src/mock/ng_zone_mock'; import {MockNgZone} from 'angular2/src/mock/ng_zone_mock';
@ -116,7 +115,7 @@ function _getAppBindings() {
PipeResolver, PipeResolver,
provide(ExceptionHandler, {asValue: new ExceptionHandler(DOM)}), provide(ExceptionHandler, {asValue: new ExceptionHandler(DOM)}),
provide(LocationStrategy, {asClass: MockLocationStrategy}), provide(LocationStrategy, {asClass: MockLocationStrategy}),
provide(XHR, {asClass: MockXHR}), XHR,
TestComponentBuilder, TestComponentBuilder,
provide(NgZone, {asClass: MockNgZone}), provide(NgZone, {asClass: MockNgZone}),
provide(AnimationBuilder, {asClass: MockAnimationBuilder}), provide(AnimationBuilder, {asClass: MockAnimationBuilder}),

View File

@ -1,6 +1,10 @@
import {provide, Provider} from 'angular2/src/core/di'; import {provide, Provider} from 'angular2/src/core/di';
import {MockSchemaRegistry} from './schema_registry_mock'; import {MockSchemaRegistry} from './schema_registry_mock';
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry'; import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
import {MockXHR} from 'angular2/src/core/compiler/xhr_mock';
import {XHR} from 'angular2/src/core/compiler/xhr';
export var TEST_PROVIDERS = export var TEST_PROVIDERS = [
[provide(ElementSchemaRegistry, {asValue: new MockSchemaRegistry({}, {})})]; provide(ElementSchemaRegistry, {asValue: new MockSchemaRegistry({}, {})}),
provide(XHR, {asClass: MockXHR})
];