From c48021ab97ef81c57c50590a0c7e28b2f01d723a Mon Sep 17 00:00:00 2001 From: Jason Choi Date: Wed, 17 Aug 2016 16:37:31 -0700 Subject: [PATCH] refactor(compiler): move test/test_bindings to testing/test_bindings (#10081) `test_bindings` is used in core test cases too, but `test` should be private to the package, so it should live in `testing`. --- modules/@angular/compiler/test/directive_normalizer_spec.ts | 4 ++-- modules/@angular/compiler/test/metadata_resolver_spec.ts | 2 +- .../compiler/test/template_parser/template_parser_spec.ts | 2 +- modules/@angular/compiler/{test => testing}/test_bindings.ts | 3 +++ .../core/test/linker/change_detection_integration_spec.ts | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) rename modules/@angular/compiler/{test => testing}/test_bindings.ts (81%) diff --git a/modules/@angular/compiler/test/directive_normalizer_spec.ts b/modules/@angular/compiler/test/directive_normalizer_spec.ts index cfff378f82..839b0be862 100644 --- a/modules/@angular/compiler/test/directive_normalizer_spec.ts +++ b/modules/@angular/compiler/test/directive_normalizer_spec.ts @@ -11,12 +11,12 @@ import {CompilerConfig} from '@angular/compiler/src/config'; import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer'; import {ResourceLoader} from '@angular/compiler/src/resource_loader'; import {MockResourceLoader} from '@angular/compiler/testing/resource_loader_mock'; +import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/testing/test_bindings'; import {ViewEncapsulation} from '@angular/core/src/metadata/view'; import {TestBed} from '@angular/core/testing'; import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal'; import {SpyResourceLoader} from './spies'; -import {TEST_COMPILER_PROVIDERS} from './test_bindings'; export function main() { describe('DirectiveNormalizer', () => { @@ -443,4 +443,4 @@ function programResourceLoaderSpy(spy: SpyResourceLoader, results: {[key: string return Promise.reject(`Unknown mock url ${url}`); } }); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/test/metadata_resolver_spec.ts b/modules/@angular/compiler/test/metadata_resolver_spec.ts index b4c8b33631..99e31d1b6b 100644 --- a/modules/@angular/compiler/test/metadata_resolver_spec.ts +++ b/modules/@angular/compiler/test/metadata_resolver_spec.ts @@ -7,6 +7,7 @@ */ import {CompilerConfig} from '@angular/compiler/src/config'; +import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/testing/test_bindings'; import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, Component, Directive, DoCheck, Injectable, NgModule, OnChanges, OnDestroy, OnInit, Pipe, SimpleChanges, ViewEncapsulation} from '@angular/core'; import {LIFECYCLE_HOOKS_VALUES} from '@angular/core/src/metadata/lifecycle_hooks'; import {TestBed} from '@angular/core/testing'; @@ -17,7 +18,6 @@ import {stringify} from '../src/facade/lang'; import {CompileMetadataResolver} from '../src/metadata_resolver'; import {MalformedStylesComponent} from './metadata_resolver_fixture'; -import {TEST_COMPILER_PROVIDERS} from './test_bindings'; export function main() { describe('CompileMetadataResolver', () => { diff --git a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts index 2f2abffc5f..7e2eb12bed 100644 --- a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts +++ b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts @@ -12,6 +12,7 @@ import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema import {AttrAst, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, PropertyBindingType, ProviderAstType, ReferenceAst, TemplateAst, TemplateAstVisitor, TextAst, VariableAst, templateVisitAll} from '@angular/compiler/src/template_parser/template_ast'; import {TEMPLATE_TRANSFORMS, TemplateParser, splitClasses} from '@angular/compiler/src/template_parser/template_parser'; import {MockSchemaRegistry} from '@angular/compiler/testing'; +import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/testing/test_bindings'; import {SchemaMetadata, SecurityContext} from '@angular/core'; import {Console} from '@angular/core/src/console'; import {TestBed} from '@angular/core/testing'; @@ -20,7 +21,6 @@ import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, import {Identifiers, identifierToken} from '../../src/identifiers'; import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../../src/ml_parser/interpolation_config'; import {unparse} from '../expression_parser/unparser'; -import {TEST_COMPILER_PROVIDERS} from '../test_bindings'; var someModuleUrl = 'package:someModule'; diff --git a/modules/@angular/compiler/test/test_bindings.ts b/modules/@angular/compiler/testing/test_bindings.ts similarity index 81% rename from modules/@angular/compiler/test/test_bindings.ts rename to modules/@angular/compiler/testing/test_bindings.ts index 16b691fb0e..ab5ac643c3 100644 --- a/modules/@angular/compiler/test/test_bindings.ts +++ b/modules/@angular/compiler/testing/test_bindings.ts @@ -11,6 +11,9 @@ import {createUrlResolverWithoutPackagePrefix} from '@angular/compiler/src/url_r import {MockSchemaRegistry} from '@angular/compiler/testing'; import {MockResourceLoader} from '@angular/compiler/testing/resource_loader_mock'; +// This provider is put here just so that we can access it from multiple +// internal test packages. +// TODO: get rid of it or move to a separate @angular/internal_testing package export var TEST_COMPILER_PROVIDERS: any[] = [ {provide: ElementSchemaRegistry, useValue: new MockSchemaRegistry({}, {})}, {provide: ResourceLoader, useClass: MockResourceLoader}, diff --git a/modules/@angular/core/test/linker/change_detection_integration_spec.ts b/modules/@angular/core/test/linker/change_detection_integration_spec.ts index f305ba28fe..cf1d962527 100644 --- a/modules/@angular/core/test/linker/change_detection_integration_spec.ts +++ b/modules/@angular/core/test/linker/change_detection_integration_spec.ts @@ -8,8 +8,8 @@ import {AsyncPipe, NgFor} from '@angular/common'; import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry'; -import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/test/test_bindings'; import {MockSchemaRegistry} from '@angular/compiler/testing'; +import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/testing/test_bindings'; import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentMetadata, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, Type, ViewContainerRef, WrappedValue, forwardRef} from '@angular/core'; import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer'; import {ViewMetadata} from '@angular/core/src/metadata/view';