From 8daa9b202d4643e3cd032604b0ae6bb46ea5aaf9 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Tue, 24 Nov 2015 09:57:24 -0800 Subject: [PATCH] cleanup(testing): create top level files for mocks Closes #5381 --- gulpfile.js | 2 +- modules/angular2/angular2.dart | 2 +- modules/angular2/animate/testing.ts | 1 + modules/angular2/http/testing.ts | 1 + modules/angular2/mock.ts | 5 ----- modules/angular2/router/testing.ts | 2 ++ modules/angular2/src/compiler/xhr_mock.ts | 4 ++-- modules/angular2/src/http/backends/xhr_backend.ts | 2 +- modules/angular2/src/router/route_registry.ts | 2 +- modules/angular2/test/common/forms/integration_spec.ts | 1 + modules/angular2/test/public_api_spec.ts | 3 +++ modules/angular2/testing.ts | 6 ++++++ tools/broccoli/trees/dart_tree.ts | 1 + 13 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 modules/angular2/animate/testing.ts create mode 100644 modules/angular2/http/testing.ts delete mode 100644 modules/angular2/mock.ts create mode 100644 modules/angular2/router/testing.ts diff --git a/gulpfile.js b/gulpfile.js index 0e5ef94d1b..e193984131 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -991,7 +991,7 @@ gulp.task("!bundle.web_worker.js.dev", ["build.js.dev"], function() { gulp.task('!bundle.testing', ['build.js.dev'], function() { var devBundleConfig = merge(true, bundleConfig); devBundleConfig.paths = merge(true, devBundleConfig.paths, {"*": "dist/js/dev/es5/*.js"}); - return bundler.bundle(devBundleConfig, 'angular2/testing + angular2/mock - angular2/angular2', + return bundler.bundle(devBundleConfig, 'angular2/testing - angular2/angular2', './dist/js/bundle/testing.js', {sourceMaps: true}); }); diff --git a/modules/angular2/angular2.dart b/modules/angular2/angular2.dart index a920ed3004..4b6db99b4f 100644 --- a/modules/angular2/angular2.dart +++ b/modules/angular2/angular2.dart @@ -8,7 +8,7 @@ library angular2; export 'package:angular2/core.dart' hide forwardRef, resolveForwardRef, ForwardRefFn; export 'package:angular2/common.dart'; -export 'package:angular2/profile.dart'; +export 'package:angular2/instrumentation.dart'; export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER; export 'package:angular2/src/platform/dom/dom_tokens.dart'; diff --git a/modules/angular2/animate/testing.ts b/modules/angular2/animate/testing.ts new file mode 100644 index 0000000000..dfcefe3afa --- /dev/null +++ b/modules/angular2/animate/testing.ts @@ -0,0 +1 @@ +export * from 'angular2/src/mock/animation_builder_mock'; diff --git a/modules/angular2/http/testing.ts b/modules/angular2/http/testing.ts new file mode 100644 index 0000000000..4b0e8a88c3 --- /dev/null +++ b/modules/angular2/http/testing.ts @@ -0,0 +1 @@ +export * from 'angular2/src/http/backends/mock_backend'; \ No newline at end of file diff --git a/modules/angular2/mock.ts b/modules/angular2/mock.ts deleted file mode 100644 index ac75a45b90..0000000000 --- a/modules/angular2/mock.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './src/mock/mock_location_strategy'; -export {LocationStrategy} from './src/router/location_strategy'; - -export {MockViewResolver} from 'angular2/src/mock/view_resolver_mock'; -export {MockXHR} from 'angular2/src/compiler/xhr_mock'; diff --git a/modules/angular2/router/testing.ts b/modules/angular2/router/testing.ts new file mode 100644 index 0000000000..d565555caa --- /dev/null +++ b/modules/angular2/router/testing.ts @@ -0,0 +1,2 @@ +export * from 'angular2/src/mock/mock_location_strategy'; +export * from 'angular2/src/mock/location_mock'; diff --git a/modules/angular2/src/compiler/xhr_mock.ts b/modules/angular2/src/compiler/xhr_mock.ts index 569eea873d..7c92d81110 100644 --- a/modules/angular2/src/compiler/xhr_mock.ts +++ b/modules/angular2/src/compiler/xhr_mock.ts @@ -31,10 +31,10 @@ export class MockXHR extends XHR { this._processRequest(this._requests.shift()); } while (this._requests.length > 0); - this.verifyNoOustandingExpectations(); + this.verifyNoOutstandingExpectations(); } - verifyNoOustandingExpectations() { + verifyNoOutstandingExpectations() { if (this._expectations.length === 0) return; var urls = []; diff --git a/modules/angular2/src/http/backends/xhr_backend.ts b/modules/angular2/src/http/backends/xhr_backend.ts index 8daf3d580a..153ef2e3c8 100644 --- a/modules/angular2/src/http/backends/xhr_backend.ts +++ b/modules/angular2/src/http/backends/xhr_backend.ts @@ -7,7 +7,7 @@ import {ResponseOptions, BaseResponseOptions} from '../base_response_options'; import {Injectable} from 'angular2/core'; import {BrowserXhr} from './browser_xhr'; import {isPresent} from 'angular2/src/facade/lang'; -import {Observable} from 'angular2/angular2'; +import {Observable} from 'angular2/core'; import {isSuccess, getResponseURL} from '../http_utils'; /** * Creates connections using `XMLHttpRequest`. Given a fully-qualified diff --git a/modules/angular2/src/router/route_registry.ts b/modules/angular2/src/router/route_registry.ts index 7dba2eea81..e7321b8017 100644 --- a/modules/angular2/src/router/route_registry.ts +++ b/modules/angular2/src/router/route_registry.ts @@ -24,7 +24,7 @@ import { RouteDefinition } from './route_config_impl'; import {reflector} from 'angular2/src/core/reflection/reflection'; -import {Injectable} from 'angular2/angular2'; +import {Injectable} from 'angular2/core'; import {normalizeRouteConfig, assertComponentExists} from './route_config_nomalizer'; import {parser, Url, pathSegmentsToUrl} from './url_parser'; diff --git a/modules/angular2/test/common/forms/integration_spec.ts b/modules/angular2/test/common/forms/integration_spec.ts index e5fef814f0..6ce963cdf0 100644 --- a/modules/angular2/test/common/forms/integration_spec.ts +++ b/modules/angular2/test/common/forms/integration_spec.ts @@ -33,6 +33,7 @@ import { Validators, Validator } from 'angular2/common'; +import {Provider, forwardRef, Input} from 'angular2/core'; import {By} from 'angular2/platform/browser'; import {ListWrapper} from 'angular2/src/facade/collection'; import {ObservableWrapper} from 'angular2/src/facade/async'; diff --git a/modules/angular2/test/public_api_spec.ts b/modules/angular2/test/public_api_spec.ts index 543ab0e1a8..2a37be9179 100644 --- a/modules/angular2/test/public_api_spec.ts +++ b/modules/angular2/test/public_api_spec.ts @@ -521,6 +521,9 @@ var NG_ALL = [ 'COMMON_PIPES', 'PLATFORM_PIPES:js', 'DOCUMENT', + 'DomAdapter:dart', + 'DomAdapter.attrToPropMap', + 'DomAdapter.attrToPropMap=', 'DatePipe', 'DatePipe.supports()', 'DatePipe.transform()', diff --git a/modules/angular2/testing.ts b/modules/angular2/testing.ts index f4d54712cd..896cb26d4b 100644 --- a/modules/angular2/testing.ts +++ b/modules/angular2/testing.ts @@ -14,3 +14,9 @@ export { } from './src/testing/test_component_builder'; export * from './src/testing/test_injector'; export * from './src/testing/fake_async'; + +export {MockViewResolver} from 'angular2/src/mock/view_resolver_mock'; +export {MockXHR} from 'angular2/src/compiler/xhr_mock'; +export {MockNgZone} from 'angular2/src/mock/ng_zone_mock'; +export {MockApplicationRef} from 'angular2/src/mock/mock_application_ref'; +export {MockDirectiveResolver} from 'angular2/src/mock/directive_resolver_mock'; diff --git a/tools/broccoli/trees/dart_tree.ts b/tools/broccoli/trees/dart_tree.ts index 565ae0a57a..ca25f37423 100644 --- a/tools/broccoli/trees/dart_tree.ts +++ b/tools/broccoli/trees/dart_tree.ts @@ -17,6 +17,7 @@ var global_excludes = [ 'angular2/http*', 'angular2/upgrade*', 'angular2/examples/**/ts/**/*', + 'angular2/http/**/*', 'angular2/src/http/**/*', 'angular2/test/http/**/*', 'angular2/src/upgrade/**/*',