From 9af2d8b8106f9dd128edfe9c582644a6f6303300 Mon Sep 17 00:00:00 2001 From: Julie Ralph Date: Mon, 11 Jul 2016 16:04:32 -0700 Subject: [PATCH] fix(testing): remove deprecated testing APIs (#9923) See https://github.com/angular/angular/blob/master/CHANGELOG.md for prior deprecation and how to update. --- .../common/test/directives/ng_class_spec.ts | 5 +- .../common/test/directives/ng_for_spec.ts | 2 +- .../common/test/directives/ng_if_spec.ts | 2 +- .../common/test/directives/ng_plural_spec.ts | 2 +- .../common/test/directives/ng_style_spec.ts | 2 +- .../common/test/directives/ng_switch_spec.ts | 2 +- .../directives/ng_template_outlet_spec.ts | 2 +- .../test/directives/non_bindable_spec.ts | 2 +- .../test/forms-deprecated/integration_spec.ts | 3 +- .../common/test/pipes/json_pipe_spec.ts | 2 +- .../common/test/pipes/slice_pipe_spec.ts | 2 +- .../compiler/test/directive_resolver_spec.ts | 1 - .../test/expression_parser/lexer_spec.ts | 1 - .../test/expression_parser/parser_spec.ts | 2 +- .../@angular/compiler/test/selector_spec.ts | 1 - .../compiler/test/style_url_resolver_spec.ts | 1 - .../test/test_component_builder_spec.ts | 2 +- .../compiler/test/view_resolver_spec.ts | 1 - .../testing/test_component_builder.ts | 23 ---- .../animation/animation_integration_spec.ts | 2 +- .../core/test/debug/debug_node_spec.ts | 2 +- modules/@angular/core/test/dev_mode_spec.ts | 1 - .../core/test/di/reflective_injector_spec.ts | 2 +- .../core/test/di/reflective_key_spec.ts | 1 - .../directive_lifecycle_integration_spec.ts | 2 +- .../core/test/forward_ref_integration_spec.ts | 2 +- .../change_detection_integration_spec.ts | 3 +- .../linker/dynamic_component_loader_spec.ts | 3 +- .../core/test/linker/integration_spec.ts | 3 +- .../linker/ng_container_integration_spec.ts | 3 +- .../linker/precompile_integration_spec.ts | 2 +- .../linker/projection_integration_spec.ts | 3 +- .../test/linker/query_integration_spec.ts | 2 +- .../linker/regression_integration_spec.ts | 3 +- .../test/linker/security_integration_spec.ts | 3 +- .../linker/view_injector_integration_spec.ts | 3 +- modules/@angular/core/test/matchers_spec.ts | 29 ----- .../@angular/core/test/metadata/di_spec.ts | 2 +- .../core/test/testing_internal_spec.ts | 1 - modules/@angular/core/testing/testing.ts | 98 +--------------- .../@angular/core/testing/testing_internal.ts | 3 +- .../ts/can_activate/can_activate_spec.ts | 1 - .../ts/can_deactivate/can_deactivate_spec.ts | 1 - .../ts/on_deactivate/on_deactivate_spec.ts | 1 - .../router_deprecated/ts/reuse/reuse_spec.ts | 1 - .../examples/testing/ts/fake_async.ts | 2 +- .../@angular/examples/testing/ts/matchers.ts | 44 ------- .../@angular/facade/test/collection_spec.ts | 2 - modules/@angular/facade/test/lang_spec.ts | 1 - .../@angular/forms/test/integration_spec.ts | 3 +- .../test/testing_public_browser_spec.ts | 59 ++-------- .../test/xhr/xhr_cache_spec.ts | 3 +- .../testing/dom_test_component_renderer.ts | 2 +- .../test/browser/title_spec.ts | 1 - .../test/browser_util_spec.ts | 2 - .../test/testing_public_spec.ts | 3 +- .../shared/web_worker_test_util.ts | 1 - .../worker/renderer_integration_spec.ts | 3 +- .../platform-server/test/integration_spec.ts | 2 +- .../test/directives/router_link_spec.ts | 2 +- .../test/integration/bootstrap_spec.ts | 2 +- .../integration/impl/async_route_spec_impl.ts | 3 +- .../integration/impl/aux_route_spec_impl.ts | 3 +- .../integration/impl/sync_route_spec_impl.ts | 3 +- .../test/integration/lifecycle_hook_spec.ts | 3 +- .../test/integration/navigation_spec.ts | 3 +- .../test/integration/redirect_route_spec.ts | 3 +- .../test/integration/router_link_spec.ts | 3 +- .../test/integration/util.ts | 3 +- modules/@angular/router/test/router.spec.ts | 111 ++++++++++-------- tools/public_api_guard/core/testing.d.ts | 36 ------ 71 files changed, 122 insertions(+), 416 deletions(-) delete mode 100644 modules/@angular/core/test/matchers_spec.ts delete mode 100644 modules/@angular/examples/testing/ts/matchers.ts diff --git a/modules/@angular/common/test/directives/ng_class_spec.ts b/modules/@angular/common/test/directives/ng_class_spec.ts index f15a0f5800..d919ed0608 100644 --- a/modules/@angular/common/test/directives/ng_class_spec.ts +++ b/modules/@angular/common/test/directives/ng_class_spec.ts @@ -7,9 +7,8 @@ */ import {NgClass, NgFor} from '@angular/common'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, provide} from '@angular/core'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; @@ -30,7 +29,7 @@ export function main() { var template = '
'; tcb.overrideTemplate(TestComponent, template) .createAsync(TestComponent) - .then((fixture) => { + .then((fixture: ComponentFixture) => { fixture.debugElement.componentInstance.items = [['0']]; fixture.detectChanges(); fixture.debugElement.componentInstance.items = [['1']]; diff --git a/modules/@angular/common/test/directives/ng_for_spec.ts b/modules/@angular/common/test/directives/ng_for_spec.ts index a55c651245..1664b8c33b 100644 --- a/modules/@angular/common/test/directives/ng_for_spec.ts +++ b/modules/@angular/common/test/directives/ng_for_spec.ts @@ -8,7 +8,7 @@ import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {ListWrapper} from '../../src/facade/collection'; import {IS_DART} from '../../src/facade/lang'; import {Component, TemplateRef, ContentChild} from '@angular/core'; diff --git a/modules/@angular/common/test/directives/ng_if_spec.ts b/modules/@angular/common/test/directives/ng_if_spec.ts index 3b9ff6f62f..c9f79d8e10 100644 --- a/modules/@angular/common/test/directives/ng_if_spec.ts +++ b/modules/@angular/common/test/directives/ng_if_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, describe, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {expect} from '@angular/platform-browser/testing/matchers'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; diff --git a/modules/@angular/common/test/directives/ng_plural_spec.ts b/modules/@angular/common/test/directives/ng_plural_spec.ts index 1106d5b5e6..38b9f7f33c 100644 --- a/modules/@angular/common/test/directives/ng_plural_spec.ts +++ b/modules/@angular/common/test/directives/ng_plural_spec.ts @@ -8,7 +8,7 @@ import {beforeEachProviders, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {Component, Injectable} from '@angular/core'; import {NgPlural, NgPluralCase, NgLocalization} from '@angular/common'; diff --git a/modules/@angular/common/test/directives/ng_style_spec.ts b/modules/@angular/common/test/directives/ng_style_spec.ts index a3cbe8b8f1..9127d92d68 100644 --- a/modules/@angular/common/test/directives/ng_style_spec.ts +++ b/modules/@angular/common/test/directives/ng_style_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, beforeEachProviders, ddescribe, xdescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {StringMapWrapper} from '../../src/facade/collection'; diff --git a/modules/@angular/common/test/directives/ng_switch_spec.ts b/modules/@angular/common/test/directives/ng_switch_spec.ts index 67d652e4e0..d3d331b8a7 100644 --- a/modules/@angular/common/test/directives/ng_switch_spec.ts +++ b/modules/@angular/common/test/directives/ng_switch_spec.ts @@ -9,7 +9,7 @@ import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {Component} from '@angular/core'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {NgSwitch, NgSwitchCase, NgSwitchDefault} from '@angular/common'; diff --git a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts index c02f50171a..fad6beb8cd 100644 --- a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts +++ b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {Component, Directive, TemplateRef, ContentChildren, QueryList} from '@angular/core'; import {NgTemplateOutlet} from '@angular/common'; diff --git a/modules/@angular/common/test/directives/non_bindable_spec.ts b/modules/@angular/common/test/directives/non_bindable_spec.ts index d47ff4d184..adf7f3668d 100644 --- a/modules/@angular/common/test/directives/non_bindable_spec.ts +++ b/modules/@angular/common/test/directives/non_bindable_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {Component, Directive} from '@angular/core'; import {ElementRef} from '@angular/core/src/linker/element_ref'; diff --git a/modules/@angular/common/test/forms-deprecated/integration_spec.ts b/modules/@angular/common/test/forms-deprecated/integration_spec.ts index 1e33f2a445..c63898fcd2 100644 --- a/modules/@angular/common/test/forms-deprecated/integration_spec.ts +++ b/modules/@angular/common/test/forms-deprecated/integration_spec.ts @@ -8,10 +8,9 @@ import {NgFor, NgIf} from '@angular/common'; import {Control, ControlGroup, ControlValueAccessor, DeprecatedFormsModule, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgControl, NgForm, RadioButtonState, Validator, Validators} from '@angular/common/src/forms-deprecated'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, Directive, EventEmitter, Output} from '@angular/core'; import {Input, Provider, forwardRef} from '@angular/core'; -import {ComponentFixture, configureModule, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder, configureModule, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; import {afterEach, beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {By} from '@angular/platform-browser/src/dom/debug/by'; diff --git a/modules/@angular/common/test/pipes/json_pipe_spec.ts b/modules/@angular/common/test/pipes/json_pipe_spec.ts index 986856979d..d863047cae 100644 --- a/modules/@angular/common/test/pipes/json_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/json_pipe_spec.ts @@ -8,7 +8,7 @@ import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {Json, StringWrapper} from '../../src/facade/lang'; import {Component} from '@angular/core'; diff --git a/modules/@angular/common/test/pipes/slice_pipe_spec.ts b/modules/@angular/common/test/pipes/slice_pipe_spec.ts index 60a1502c4d..b01806a246 100644 --- a/modules/@angular/common/test/pipes/slice_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/slice_pipe_spec.ts @@ -7,7 +7,7 @@ */ import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {browserDetection} from '@angular/platform-browser/testing/browser_util'; diff --git a/modules/@angular/compiler/test/directive_resolver_spec.ts b/modules/@angular/compiler/test/directive_resolver_spec.ts index d2d0621d08..434679bd3a 100644 --- a/modules/@angular/compiler/test/directive_resolver_spec.ts +++ b/modules/@angular/compiler/test/directive_resolver_spec.ts @@ -8,7 +8,6 @@ import {DirectiveResolver} from '@angular/compiler/src/directive_resolver'; import {ContentChild, ContentChildMetadata, ContentChildren, ContentChildrenMetadata, Directive, DirectiveMetadata, HostBinding, HostListener, Input, Output, ViewChild, ViewChildMetadata, ViewChildren, ViewChildrenMetadata} from '@angular/core/src/metadata'; -import {beforeEach, ddescribe, describe, expect, iit, it} from '@angular/core/testing'; @Directive({selector: 'someDirective'}) class SomeDirective { diff --git a/modules/@angular/compiler/test/expression_parser/lexer_spec.ts b/modules/@angular/compiler/test/expression_parser/lexer_spec.ts index b0bdd188c6..2107ddf0c1 100644 --- a/modules/@angular/compiler/test/expression_parser/lexer_spec.ts +++ b/modules/@angular/compiler/test/expression_parser/lexer_spec.ts @@ -7,7 +7,6 @@ */ import {Lexer, Token} from '@angular/compiler/src/expression_parser/lexer'; -import {ddescribe, describe, expect, it} from '@angular/core/testing'; import {StringWrapper} from '../../src/facade/lang'; diff --git a/modules/@angular/compiler/test/expression_parser/parser_spec.ts b/modules/@angular/compiler/test/expression_parser/parser_spec.ts index 23193670a7..efc8481019 100644 --- a/modules/@angular/compiler/test/expression_parser/parser_spec.ts +++ b/modules/@angular/compiler/test/expression_parser/parser_spec.ts @@ -9,7 +9,7 @@ import {AST, ASTWithSource, BindingPipe, Interpolation, LiteralPrimitive, ParserError, TemplateBinding} from '@angular/compiler/src/expression_parser/ast'; import {Lexer} from '@angular/compiler/src/expression_parser/lexer'; import {Parser, TemplateBindingParseResult} from '@angular/compiler/src/expression_parser/parser'; -import {beforeEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing'; +import {expect} from '@angular/core/testing/testing_internal'; import {isBlank, isPresent} from '../../src/facade/lang'; diff --git a/modules/@angular/compiler/test/selector_spec.ts b/modules/@angular/compiler/test/selector_spec.ts index 6cbaad9d2b..e8136cb5a8 100644 --- a/modules/@angular/compiler/test/selector_spec.ts +++ b/modules/@angular/compiler/test/selector_spec.ts @@ -8,7 +8,6 @@ import {SelectorMatcher} from '@angular/compiler/src/selector'; import {CssSelector} from '@angular/compiler/src/selector'; -import {beforeEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {el} from '@angular/platform-browser/testing/browser_util'; diff --git a/modules/@angular/compiler/test/style_url_resolver_spec.ts b/modules/@angular/compiler/test/style_url_resolver_spec.ts index 868ed15c42..580e8da3c9 100644 --- a/modules/@angular/compiler/test/style_url_resolver_spec.ts +++ b/modules/@angular/compiler/test/style_url_resolver_spec.ts @@ -8,7 +8,6 @@ import {extractStyleUrls, isStyleUrlResolvable} from '@angular/compiler/src/style_url_resolver'; import {UrlResolver} from '@angular/compiler/src/url_resolver'; -import {beforeEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing'; export function main() { describe('extractStyleUrls', () => { diff --git a/modules/@angular/compiler/test/test_component_builder_spec.ts b/modules/@angular/compiler/test/test_component_builder_spec.ts index 33f58f0880..ae9b7ac674 100644 --- a/modules/@angular/compiler/test/test_component_builder_spec.ts +++ b/modules/@angular/compiler/test/test_component_builder_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder, ComponentFixtureAutoDetect, ComponentFixtureNoNgZone} from '@angular/compiler/testing'; +import {TestComponentBuilder, ComponentFixtureAutoDetect, ComponentFixtureNoNgZone} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {Injectable, Component, Input, ViewMetadata} from '@angular/core'; import {NgIf} from '@angular/common'; diff --git a/modules/@angular/compiler/test/view_resolver_spec.ts b/modules/@angular/compiler/test/view_resolver_spec.ts index 64791ba4e5..1c82ddbd7e 100644 --- a/modules/@angular/compiler/test/view_resolver_spec.ts +++ b/modules/@angular/compiler/test/view_resolver_spec.ts @@ -8,7 +8,6 @@ import {ViewResolver} from '@angular/compiler/src/view_resolver'; import {Component, ViewMetadata} from '@angular/core/src/metadata'; -import {beforeEach, ddescribe, describe, expect, iit, it} from '@angular/core/testing'; class SomeDir {} class SomePipe {} diff --git a/modules/@angular/compiler/testing/test_component_builder.ts b/modules/@angular/compiler/testing/test_component_builder.ts index 14549f8f58..8ec60a1817 100644 --- a/modules/@angular/compiler/testing/test_component_builder.ts +++ b/modules/@angular/compiler/testing/test_component_builder.ts @@ -13,29 +13,6 @@ import {DirectiveResolver, ViewResolver} from '../index'; import {MapWrapper} from '../src/facade/collection'; import {ConcreteType, IS_DART, Type, isPresent} from '../src/facade/lang'; -/** - * @deprecated Import TestComponentRenderer from @angular/core/testing - */ -export {TestComponentRenderer} from '@angular/core/testing'; -/** - * @deprecated Import TestComponentBuilder from @angular/core/testing - */ -export {TestComponentBuilder} from '@angular/core/testing'; -/** - * @deprecated Import ComponentFixture from @angular/core/testing - */ -export {ComponentFixture} from '@angular/core/testing'; -/** - * @deprecated Import ComponentFixtureNoNgZone from @angular/core/testing - */ -export {ComponentFixtureNoNgZone} from '@angular/core/testing'; -/** - * @deprecated Import ComponentFixtureAutoDetect from @angular/core/testing - */ -export {ComponentFixtureAutoDetect} from '@angular/core/testing'; - - - /** * A TestComponentBuilder that allows overriding based on the compiler. */ diff --git a/modules/@angular/core/test/animation/animation_integration_spec.ts b/modules/@angular/core/test/animation/animation_integration_spec.ts index 5739f6b11c..232dd8d1d9 100644 --- a/modules/@angular/core/test/animation/animation_integration_spec.ts +++ b/modules/@angular/core/test/animation/animation_integration_spec.ts @@ -8,7 +8,7 @@ import {NgIf} from '@angular/common'; import {CompilerConfig} from '@angular/compiler'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AnimationDriver} from '@angular/platform-browser/src/dom/animation_driver'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {MockAnimationDriver} from '@angular/platform-browser/testing/mock_animation_driver'; diff --git a/modules/@angular/core/test/debug/debug_node_spec.ts b/modules/@angular/core/test/debug/debug_node_spec.ts index 69af88808e..89ec4b157f 100644 --- a/modules/@angular/core/test/debug/debug_node_spec.ts +++ b/modules/@angular/core/test/debug/debug_node_spec.ts @@ -8,7 +8,7 @@ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; diff --git a/modules/@angular/core/test/dev_mode_spec.ts b/modules/@angular/core/test/dev_mode_spec.ts index 217a1bddd9..d94170b63e 100644 --- a/modules/@angular/core/test/dev_mode_spec.ts +++ b/modules/@angular/core/test/dev_mode_spec.ts @@ -7,7 +7,6 @@ */ import {isDevMode} from '@angular/core'; -import {beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '../testing'; export function main() { describe('dev mode', () => { diff --git a/modules/@angular/core/test/di/reflective_injector_spec.ts b/modules/@angular/core/test/di/reflective_injector_spec.ts index 70e417e510..065926e17a 100644 --- a/modules/@angular/core/test/di/reflective_injector_spec.ts +++ b/modules/@angular/core/test/di/reflective_injector_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {beforeEach, ddescribe, describe, expect, iit, it} from '@angular/core/testing'; +import {expect} from '@angular/core/testing/testing_internal'; import {BaseException} from '../../src/facade/exceptions'; import {isBlank, isPresent, stringify} from '../../src/facade/lang'; diff --git a/modules/@angular/core/test/di/reflective_key_spec.ts b/modules/@angular/core/test/di/reflective_key_spec.ts index dffe826338..da3bcda5d5 100644 --- a/modules/@angular/core/test/di/reflective_key_spec.ts +++ b/modules/@angular/core/test/di/reflective_key_spec.ts @@ -7,7 +7,6 @@ */ import {KeyRegistry, ReflectiveKey} from '@angular/core/src/di/reflective_key'; -import {beforeEach, describe, expect, iit, it} from '@angular/core/testing'; export function main() { describe('key', function() { diff --git a/modules/@angular/core/test/directive_lifecycle_integration_spec.ts b/modules/@angular/core/test/directive_lifecycle_integration_spec.ts index 6232e04a44..3ae08d2b04 100644 --- a/modules/@angular/core/test/directive_lifecycle_integration_spec.ts +++ b/modules/@angular/core/test/directive_lifecycle_integration_spec.ts @@ -6,9 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ -import {TestComponentBuilder} from '@angular/compiler/testing'; import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnInit} from '@angular/core'; import {Component, Directive, ViewMetadata} from '@angular/core/src/metadata'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {Log, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; diff --git a/modules/@angular/core/test/forward_ref_integration_spec.ts b/modules/@angular/core/test/forward_ref_integration_spec.ts index 3e469f7fb6..8e47264d60 100644 --- a/modules/@angular/core/test/forward_ref_integration_spec.ts +++ b/modules/@angular/core/test/forward_ref_integration_spec.ts @@ -7,9 +7,9 @@ */ import {NgFor} from '@angular/common'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, Directive, Inject, Query, QueryList, bind, forwardRef, provide, resolveForwardRef} from '@angular/core'; import {asNativeElements} from '@angular/core'; +import {TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; 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 d55a4525a6..c3c35881a9 100644 --- a/modules/@angular/core/test/linker/change_detection_integration_spec.ts +++ b/modules/@angular/core/test/linker/change_detection_integration_spec.ts @@ -9,9 +9,10 @@ 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, TestComponentBuilder} from '@angular/compiler/testing'; +import {MockSchemaRegistry} from '@angular/compiler/testing'; import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, ViewContainerRef, ViewMetadata, WrappedValue, forwardRef} from '@angular/core'; import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer'; +import {TestComponentBuilder} from '@angular/core/testing'; import {ComponentFixture, configureCompiler, configureModule, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal'; import {By} from '@angular/platform-browser/src/dom/debug/by'; diff --git a/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts b/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts index e202c495f6..200518bb72 100644 --- a/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts +++ b/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts @@ -8,8 +8,7 @@ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {ComponentFixture} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {Predicate} from '../../src/facade/collection'; import {Injector, OnDestroy, DebugElement, Type, ViewContainerRef, ViewChild} from '@angular/core'; import {Component, ViewMetadata} from '@angular/core/src/metadata'; diff --git a/modules/@angular/core/test/linker/integration_spec.ts b/modules/@angular/core/test/linker/integration_spec.ts index cdc3b31eb0..4a680fc35c 100644 --- a/modules/@angular/core/test/linker/integration_spec.ts +++ b/modules/@angular/core/test/linker/integration_spec.ts @@ -7,8 +7,7 @@ */ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; -import {fakeAsync, tick, ComponentFixture, configureCompiler, configureModule} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {fakeAsync, tick, ComponentFixture, configureCompiler, configureModule, TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {isPresent, stringify, isBlank,} from '../../src/facade/lang'; diff --git a/modules/@angular/core/test/linker/ng_container_integration_spec.ts b/modules/@angular/core/test/linker/ng_container_integration_spec.ts index d5a99fda35..c5d1caebc0 100644 --- a/modules/@angular/core/test/linker/ng_container_integration_spec.ts +++ b/modules/@angular/core/test/linker/ng_container_integration_spec.ts @@ -7,9 +7,8 @@ */ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {configureCompiler} from '@angular/core/testing'; +import {configureCompiler, TestComponentBuilder} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {OpaqueToken, ViewMetadata, Component, Directive, AfterContentInit, AfterViewInit, QueryList, ContentChildren, ViewChildren, Input} from '@angular/core'; import {NgIf} from '@angular/common'; diff --git a/modules/@angular/core/test/linker/precompile_integration_spec.ts b/modules/@angular/core/test/linker/precompile_integration_spec.ts index 1cf19d0ff4..3338e30856 100644 --- a/modules/@angular/core/test/linker/precompile_integration_spec.ts +++ b/modules/@angular/core/test/linker/precompile_integration_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {Component, ViewChild, ViewContainerRef, ComponentFactoryResolver, NoComponentFactoryError, ComponentRef, forwardRef, ANALYZE_FOR_PRECOMPILE} from '@angular/core'; diff --git a/modules/@angular/core/test/linker/projection_integration_spec.ts b/modules/@angular/core/test/linker/projection_integration_spec.ts index b70ed931d5..18bda7daa0 100644 --- a/modules/@angular/core/test/linker/projection_integration_spec.ts +++ b/modules/@angular/core/test/linker/projection_integration_spec.ts @@ -8,8 +8,7 @@ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {ComponentFixture} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; diff --git a/modules/@angular/core/test/linker/query_integration_spec.ts b/modules/@angular/core/test/linker/query_integration_spec.ts index 92895173fe..bfc2f89e10 100644 --- a/modules/@angular/core/test/linker/query_integration_spec.ts +++ b/modules/@angular/core/test/linker/query_integration_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {isPresent, stringify} from '../../src/facade/lang'; diff --git a/modules/@angular/core/test/linker/regression_integration_spec.ts b/modules/@angular/core/test/linker/regression_integration_spec.ts index 17deed5dbe..0776fb7c4f 100644 --- a/modules/@angular/core/test/linker/regression_integration_spec.ts +++ b/modules/@angular/core/test/linker/regression_integration_spec.ts @@ -7,8 +7,7 @@ */ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; -import {configureCompiler, configureModule} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {configureCompiler, configureModule, TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {IS_DART} from '../../src/facade/lang'; diff --git a/modules/@angular/core/test/linker/security_integration_spec.ts b/modules/@angular/core/test/linker/security_integration_spec.ts index 9c29cf5c42..d4e8eab3ea 100644 --- a/modules/@angular/core/test/linker/security_integration_spec.ts +++ b/modules/@angular/core/test/linker/security_integration_spec.ts @@ -7,9 +7,8 @@ */ import {ddescribe, describe, expect, inject, beforeEachProviders, beforeEach, afterEach, it,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {configureCompiler} from '@angular/core/testing'; +import {configureCompiler, TestComponentBuilder} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {provide, Injectable, OpaqueToken} from '@angular/core'; import {CompilerConfig} from '@angular/compiler'; diff --git a/modules/@angular/core/test/linker/view_injector_integration_spec.ts b/modules/@angular/core/test/linker/view_injector_integration_spec.ts index 21be3a960b..b309149aa0 100644 --- a/modules/@angular/core/test/linker/view_injector_integration_spec.ts +++ b/modules/@angular/core/test/linker/view_injector_integration_spec.ts @@ -7,8 +7,7 @@ */ import {describe, ddescribe, it, iit, xit, xdescribe, expect, beforeEach, beforeEachProviders, inject,} from '@angular/core/testing/testing_internal'; -import {fakeAsync, flushMicrotasks, tick, ComponentFixture} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {fakeAsync, flushMicrotasks, tick, ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {isBlank, ConcreteType} from '../../src/facade/lang'; import {Type, ViewContainerRef, TemplateRef, ElementRef, ChangeDetectorRef, ChangeDetectionStrategy, Directive, Component, DebugElement, forwardRef, Input, PipeTransform, Attribute, ViewMetadata, provide, Optional, Inject, Self, InjectMetadata, Pipe, Host, SkipSelfMetadata} from '@angular/core'; import {NgIf, NgFor} from '@angular/common'; diff --git a/modules/@angular/core/test/matchers_spec.ts b/modules/@angular/core/test/matchers_spec.ts deleted file mode 100644 index 43589e0b12..0000000000 --- a/modules/@angular/core/test/matchers_spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {describe, it, iit, ddescribe, expect, tick, beforeEach,} from '../testing'; - -import {getDOM} from '../../platform-browser/src/dom/dom_adapter'; - -export function main() { - describe('testing', () => { - describe('toHaveCssClass', () => { - it('should assert that the CSS class is present', () => { - var el = getDOM().createElement('div'); - getDOM().addClass(el, 'matias'); - expect(el).toHaveCssClass('matias'); - }); - - it('should assert that the CSS class is not present', () => { - var el = getDOM().createElement('div'); - getDOM().addClass(el, 'matias'); - expect(el).not.toHaveCssClass('fatias'); - }); - }); - }); -} diff --git a/modules/@angular/core/test/metadata/di_spec.ts b/modules/@angular/core/test/metadata/di_spec.ts index bdf5170bcf..621df667cb 100644 --- a/modules/@angular/core/test/metadata/di_spec.ts +++ b/modules/@angular/core/test/metadata/di_spec.ts @@ -7,7 +7,7 @@ */ import {AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {Component, ViewMetadata, Input, Directive, ViewChild, ViewChildren, QueryList, ElementRef} from '@angular/core'; diff --git a/modules/@angular/core/test/testing_internal_spec.ts b/modules/@angular/core/test/testing_internal_spec.ts index d41045d467..fc3b848797 100644 --- a/modules/@angular/core/test/testing_internal_spec.ts +++ b/modules/@angular/core/test/testing_internal_spec.ts @@ -9,7 +9,6 @@ import {SpyObject} from '@angular/core/testing/testing_internal'; import {MapWrapper} from '../../platform-browser/src/facade/collection'; -import {beforeEach, ddescribe, describe, expect, iit, it, tick} from '../testing'; class TestObj { prop: any; diff --git a/modules/@angular/core/testing/testing.ts b/modules/@angular/core/testing/testing.ts index fd53381a2f..eb60ea4b99 100644 --- a/modules/@angular/core/testing/testing.ts +++ b/modules/@angular/core/testing/testing.ts @@ -18,100 +18,11 @@ declare var global: any; var _global = (typeof window === 'undefined' ? global : window); -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var expect: Function = _global.expect; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var afterEach: Function = _global.afterEach; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var describe: Function = _global.describe; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var fdescribe = _global.fdescribe; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var ddescribe = _global.ddescribe; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var xdescribe: Function = _global.xdescribe; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var beforeEach = _global.beforeEach; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var it = _global.it; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var fit = _global.fit; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var iit = _global.fit; - -/** - * @deprecated you no longer need to import jasmine functions from @angular/core/testing. Simply use - * the globals. - * - * See http://jasmine.github.io/ for more details. - */ -export var xit = _global.xit; - - var testInjector: TestInjector = getTestInjector(); // Reset the test providers before each test. if (_global.beforeEach) { - beforeEach(() => { testInjector.reset(); }); + _global.beforeEach(() => { testInjector.reset(); }); } /** @@ -173,10 +84,3 @@ export function configureCompiler(config: {providers?: any[], useJit?: boolean}) 'current `it` function.'); } } - -/** - * @deprecated Use beforeEach(() => addProviders()) - */ -export function beforeEachProviders(fn: () => Array): void { - beforeEach(() => { addProviders(fn()); }); -} diff --git a/modules/@angular/core/testing/testing_internal.ts b/modules/@angular/core/testing/testing_internal.ts index b666f42bff..75b4c9cbe6 100644 --- a/modules/@angular/core/testing/testing_internal.ts +++ b/modules/@angular/core/testing/testing_internal.ts @@ -16,8 +16,6 @@ import {getTestInjector, inject} from './test_injector'; export {AsyncTestCompleter} from './async_test_completer'; export {MockAnimationPlayer} from './mock_animation_player'; export {inject} from './test_injector'; -export {expect} from './testing'; - export * from './logger'; export * from './ng_zone_mock'; export * from './mock_application_ref'; @@ -27,6 +25,7 @@ export var proxy: ClassDecorator = (t: any /** TODO #9100 */) => t; var _global = (typeof window === 'undefined' ? global : window); export var afterEach: Function = _global.afterEach; +export var expect: Function = _global.expect; var jsmBeforeEach = _global.beforeEach; var jsmDescribe = _global.describe; diff --git a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts b/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts index ad3c7be760..264047cde1 100644 --- a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts +++ b/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {expect} from '@angular/core/testing'; import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e'; function waitForElement(selector: string) { diff --git a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts b/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts index 2256f36506..111dfd1db3 100644 --- a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts +++ b/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {expect} from '@angular/core/testing'; import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e'; function waitForElement(selector: string) { diff --git a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts b/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts index a15d51424a..25120a77c6 100644 --- a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts +++ b/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {expect} from '@angular/core/testing'; import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e'; function waitForElement(selector: string) { diff --git a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts b/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts index 902111cd16..ebae736e9d 100644 --- a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts +++ b/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {expect} from '@angular/core/testing'; import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e'; function waitForElement(selector: string) { diff --git a/modules/@angular/examples/testing/ts/fake_async.ts b/modules/@angular/examples/testing/ts/fake_async.ts index 14837fbbd6..2c2b362634 100644 --- a/modules/@angular/examples/testing/ts/fake_async.ts +++ b/modules/@angular/examples/testing/ts/fake_async.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {describe, discardPeriodicTasks, expect, fakeAsync, it, tick} from '@angular/core/testing'; +import {discardPeriodicTasks, fakeAsync, tick} from '@angular/core/testing'; // #docregion basic diff --git a/modules/@angular/examples/testing/ts/matchers.ts b/modules/@angular/examples/testing/ts/matchers.ts deleted file mode 100644 index cc46468b8b..0000000000 --- a/modules/@angular/examples/testing/ts/matchers.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {expect} from '@angular/core/testing'; - -var value: any; -var element: any; -var exception: any; - -abstract class OtherClass {} -class SomeClass {} - -// #docregion toBePromise -expect(value).toBePromise(); -// #enddocregion - -// #docregion toBeAnInstanceOf -expect(value).toBeAnInstanceOf(SomeClass); -// #enddocregion - -// #docregion toHaveText -expect(element).toHaveText('Hello world!'); -// #enddocregion - -// #docregion toHaveCssClass -expect(element).toHaveCssClass('current'); -// #enddocregion - -// #docregion toHaveCssStyle -expect(element).toHaveCssStyle({width: '100px', height: 'auto'}); -// #enddocregion - -// #docregion toContainError -expect(exception).toContainError('Failed to load'); -// #enddocregion - -// #docregion toImplement -expect(SomeClass).toImplement(OtherClass); -// #enddocregion diff --git a/modules/@angular/facade/test/collection_spec.ts b/modules/@angular/facade/test/collection_spec.ts index ecd596297a..3d24ad66c1 100644 --- a/modules/@angular/facade/test/collection_spec.ts +++ b/modules/@angular/facade/test/collection_spec.ts @@ -6,8 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {beforeEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing'; - import {ListWrapper, MapWrapper, StringMapWrapper} from '../src/collection'; export function main() { diff --git a/modules/@angular/facade/test/lang_spec.ts b/modules/@angular/facade/test/lang_spec.ts index 798622873f..54d6d7ac49 100644 --- a/modules/@angular/facade/test/lang_spec.ts +++ b/modules/@angular/facade/test/lang_spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {beforeEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing'; import {NumberWrapper, RegExpMatcherWrapper, RegExpWrapper, StringWrapper, escapeRegExp, hasConstructor, isPresent, resolveEnumToken} from '../src/lang'; enum UsefulEnum { diff --git a/modules/@angular/forms/test/integration_spec.ts b/modules/@angular/forms/test/integration_spec.ts index 848c67e344..739cdaa6ae 100644 --- a/modules/@angular/forms/test/integration_spec.ts +++ b/modules/@angular/forms/test/integration_spec.ts @@ -7,10 +7,9 @@ */ import {NgFor, NgIf} from '@angular/common'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, Directive, EventEmitter, Output} from '@angular/core'; import {Input, Provider, forwardRef} from '@angular/core'; -import {ComponentFixture, configureModule, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder, configureModule, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; import {afterEach, beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {ControlValueAccessor, FORM_DIRECTIVES, FORM_PROVIDERS, FormArray, FormControl, FormGroup, FormsModule, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgControl, NgForm, NgModel, REACTIVE_FORM_DIRECTIVES, ReactiveFormsModule, Validator, Validators} from '@angular/forms'; diff --git a/modules/@angular/platform-browser-dynamic/test/testing_public_browser_spec.ts b/modules/@angular/platform-browser-dynamic/test/testing_public_browser_spec.ts index 5b1a38dc2f..1172dba833 100644 --- a/modules/@angular/platform-browser-dynamic/test/testing_public_browser_spec.ts +++ b/modules/@angular/platform-browser-dynamic/test/testing_public_browser_spec.ts @@ -6,17 +6,15 @@ * found in the LICENSE file at https://angular.io/license */ -import {it, iit, xit, describe, ddescribe, xdescribe, expect, beforeEach, beforeEachProviders, inject,} from '@angular/core/testing'; -import {async, fakeAsync, flushMicrotasks, tick,} from '@angular/core/testing'; - +import {XHR} from '@angular/compiler'; +import {Component, bind} from '@angular/core'; +import {TestComponentBuilder, addProviders, async, fakeAsync, flushMicrotasks, inject, tick} from '@angular/core/testing'; import {ROUTER_DIRECTIVES, Route} from '@angular/router-deprecated'; - -import {Component, bind} from '@angular/core'; import {PromiseWrapper} from '../src/facade/promise'; -import {XHR} from '@angular/compiler'; import {XHRImpl} from '../src/xhr/xhr_impl'; -import {TestComponentBuilder} from '@angular/compiler/testing'; + + // Components for the tests. class FancyService { @@ -51,45 +49,6 @@ class TestRouterComponent { // For general tests, see test/testing/testing_public_spec.ts. export function main() { describe('test APIs for the browser', () => { - describe('angular2 jasmine matchers', () => { - describe('toHaveCssClass', () => { - it('should assert that the CSS class is present', () => { - var el = document.createElement('div'); - el.classList.add('matias'); - expect(el).toHaveCssClass('matias'); - }); - - it('should assert that the CSS class is not present', () => { - var el = document.createElement('div'); - el.classList.add('matias'); - expect(el).not.toHaveCssClass('fatias'); - }); - }); - - describe('toHaveCssStyle', () => { - it('should assert that the CSS style is present', () => { - var el = document.createElement('div'); - expect(el).not.toHaveCssStyle('width'); - - el.style.setProperty('width', '100px'); - expect(el).toHaveCssStyle('width'); - }); - - it('should assert that the styles are matched against the element', () => { - var el = document.createElement('div'); - expect(el).not.toHaveCssStyle({width: '100px', height: '555px'}); - - el.style.setProperty('width', '100px'); - expect(el).toHaveCssStyle({width: '100px'}); - expect(el).not.toHaveCssStyle({width: '100px', height: '555px'}); - - el.style.setProperty('height', '555px'); - expect(el).toHaveCssStyle({height: '555px'}); - expect(el).toHaveCssStyle({width: '100px', height: '555px'}); - }); - }); - }); - describe('using the async helper', () => { var actuallyDone: boolean; @@ -107,10 +66,10 @@ export function main() { describe('using the test injector with the inject helper', () => { describe('setting up Providers', () => { - beforeEachProviders(() => [{provide: FancyService, useValue: new FancyService()}]); + beforeEach(() => addProviders([{provide: FancyService, useValue: new FancyService()}])); it('provides a real XHR instance', - inject([XHR], (xhr: XHR) => { expect(xhr).toBeAnInstanceOf(XHRImpl); })); + inject([XHR], (xhr: XHR) => { expect(xhr instanceof XHRImpl).toBeTruthy(); })); it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service: any /** TODO #9100 */) => { @@ -166,8 +125,8 @@ export function main() { tcb.createAsync(ExternalTemplateComp).then((componentFixture) => { componentFixture.detectChanges(); - expect(componentFixture.debugElement.nativeElement) - .toHaveText('from external template\n'); + expect(componentFixture.debugElement.nativeElement.textContent) + .toEqual('from external template\n'); }); })), 10000); // Long timeout here because this test makes an actual XHR, and is slow on Edge. diff --git a/modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_spec.ts b/modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_spec.ts index 5017b29009..528da9851f 100644 --- a/modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_spec.ts +++ b/modules/@angular/platform-browser-dynamic/test/xhr/xhr_cache_spec.ts @@ -7,9 +7,8 @@ */ import {UrlResolver, XHR} from '@angular/compiler'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, provide} from '@angular/core'; -import {configureCompiler, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; +import {TestComponentBuilder, configureCompiler, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {expect} from '@angular/platform-browser/testing/matchers'; diff --git a/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts b/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts index ab80cef159..6ffc3188d6 100644 --- a/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts +++ b/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts @@ -6,8 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {TestComponentRenderer} from '@angular/compiler/testing'; import {Inject, Injectable} from '@angular/core'; +import {TestComponentRenderer} from '@angular/core/testing'; import {DOCUMENT} from '@angular/platform-browser'; import {getDOM} from '../platform_browser_private'; diff --git a/modules/@angular/platform-browser/test/browser/title_spec.ts b/modules/@angular/platform-browser/test/browser/title_spec.ts index 2418890128..db270c0a25 100644 --- a/modules/@angular/platform-browser/test/browser/title_spec.ts +++ b/modules/@angular/platform-browser/test/browser/title_spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {afterEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing'; import {Title} from '@angular/platform-browser'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; diff --git a/modules/@angular/platform-browser/test/browser_util_spec.ts b/modules/@angular/platform-browser/test/browser_util_spec.ts index c66226b11f..24baf3197b 100644 --- a/modules/@angular/platform-browser/test/browser_util_spec.ts +++ b/modules/@angular/platform-browser/test/browser_util_spec.ts @@ -6,8 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {ddescribe, describe, expect, iit, it} from '@angular/core/testing'; - import {StringMapWrapper} from '../src/facade/collection'; import {BrowserDetection} from '../testing/browser_util'; diff --git a/modules/@angular/platform-browser/test/testing_public_spec.ts b/modules/@angular/platform-browser/test/testing_public_spec.ts index 7f43a2f9a5..b247402a81 100644 --- a/modules/@angular/platform-browser/test/testing_public_spec.ts +++ b/modules/@angular/platform-browser/test/testing_public_spec.ts @@ -8,9 +8,8 @@ import {NgIf} from '@angular/common'; import {CompilerConfig, XHR} from '@angular/compiler'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {AppModule, Component, ComponentFactoryResolver, Directive, Injectable, Input, Pipe, ViewMetadata, provide} from '@angular/core'; -import {addProviders, async, configureCompiler, configureModule, fakeAsync, inject, tick, withModule, withProviders} from '@angular/core/testing'; +import {TestComponentBuilder, addProviders, async, configureCompiler, configureModule, fakeAsync, inject, tick, withModule, withProviders} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/matchers'; import {stringify} from '../../http/src/facade/lang'; diff --git a/modules/@angular/platform-browser/test/web_workers/shared/web_worker_test_util.ts b/modules/@angular/platform-browser/test/web_workers/shared/web_worker_test_util.ts index 441ba858d7..08b3d6befc 100644 --- a/modules/@angular/platform-browser/test/web_workers/shared/web_worker_test_util.ts +++ b/modules/@angular/platform-browser/test/web_workers/shared/web_worker_test_util.ts @@ -7,7 +7,6 @@ */ import {NgZone} from '@angular/core/src/zone/ng_zone'; -import {expect} from '@angular/core/testing'; import {UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker'; import {ClientMessageBroker, ClientMessageBrokerFactory_} from '@angular/platform-browser/src/web_workers/shared/client_message_broker'; import {MessageBus, MessageBusSink, MessageBusSource} from '@angular/platform-browser/src/web_workers/shared/message_bus'; diff --git a/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts b/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts index bf404ea7f9..dc302a3069 100644 --- a/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts +++ b/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts @@ -8,8 +8,7 @@ import {inject, ddescribe, describe, it, iit, expect, beforeEach, beforeEachProviders,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestInjector, configureModule} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestInjector, TestComponentBuilder, configureModule} from '@angular/core/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {provide, Injector, ViewMetadata, Component, Injectable, ComponentRef, ReflectiveInjector, getPlatform} from '@angular/core'; import {NgIf} from '@angular/common'; diff --git a/modules/@angular/platform-server/test/integration_spec.ts b/modules/@angular/platform-server/test/integration_spec.ts index 2d0c406b81..f8add7f216 100644 --- a/modules/@angular/platform-server/test/integration_spec.ts +++ b/modules/@angular/platform-server/test/integration_spec.ts @@ -7,7 +7,7 @@ */ import {Component, disposePlatform} from '@angular/core'; -import {afterEach, async, beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing'; +import {async} from '@angular/core/testing'; import {BROWSER_APP_PROVIDERS} from '@angular/platform-browser'; import {BROWSER_APP_COMPILER_PROVIDERS} from '@angular/platform-browser-dynamic'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; diff --git a/modules/@angular/router-deprecated/test/directives/router_link_spec.ts b/modules/@angular/router-deprecated/test/directives/router_link_spec.ts index f2846b79d9..b4c82a435c 100644 --- a/modules/@angular/router-deprecated/test/directives/router_link_spec.ts +++ b/modules/@angular/router-deprecated/test/directives/router_link_spec.ts @@ -7,7 +7,7 @@ */ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; +import {TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {SpyRouter, SpyLocation} from '../spies'; diff --git a/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts b/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts index 8458ff1f69..3747903271 100644 --- a/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts +++ b/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts @@ -8,11 +8,11 @@ import {APP_BASE_HREF, LocationStrategy} from '@angular/common'; import {MockLocationStrategy} from '@angular/common/testing/mock_location_strategy'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {disposePlatform} from '@angular/core'; import {ApplicationRef} from '@angular/core/src/application_ref'; import {Console} from '@angular/core/src/console'; import {Component} from '@angular/core/src/metadata'; +import {TestComponentBuilder} from '@angular/core/testing'; import {MockApplicationRef, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {bootstrap} from '@angular/platform-browser-dynamic'; diff --git a/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts b/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts index 81cc6165ea..03b4cd7938 100644 --- a/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts +++ b/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts @@ -7,8 +7,7 @@ */ import {beforeEach, beforeEachProviders, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {Location} from '@angular/common'; diff --git a/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts b/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts index d6b6dc8f74..f85e11e8aa 100644 --- a/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts +++ b/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts @@ -7,9 +7,8 @@ */ import {Location} from '@angular/common'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component} from '@angular/core'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {By} from '@angular/platform-browser/src/dom/debug/by'; diff --git a/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts b/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts index 201c66360d..9ac8747b52 100644 --- a/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts +++ b/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts @@ -8,8 +8,7 @@ import {beforeEach, beforeEachProviders, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {specs, compile, TEST_ROUTER_PROVIDERS, clickOnElement, getHref} from '../util'; import {Location} from '@angular/common'; diff --git a/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts b/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts index add4cabb28..ffae7ddfd0 100644 --- a/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts +++ b/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts @@ -6,9 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, Inject, Injector, provide} from '@angular/core'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated'; diff --git a/modules/@angular/router-deprecated/test/integration/navigation_spec.ts b/modules/@angular/router-deprecated/test/integration/navigation_spec.ts index aaf25a3265..764875398c 100644 --- a/modules/@angular/router-deprecated/test/integration/navigation_spec.ts +++ b/modules/@angular/router-deprecated/test/integration/navigation_spec.ts @@ -7,9 +7,8 @@ */ import {Location} from '@angular/common'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, Inject, Injector, provide} from '@angular/core'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {RouteData, RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated'; diff --git a/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts b/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts index c50809260f..0f60214596 100644 --- a/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts +++ b/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts @@ -7,8 +7,7 @@ */ import {Location} from '@angular/common'; -import {TestComponentBuilder} from '@angular/compiler/testing'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {RouteData, RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated'; diff --git a/modules/@angular/router-deprecated/test/integration/router_link_spec.ts b/modules/@angular/router-deprecated/test/integration/router_link_spec.ts index 0c499d3f02..cc1acd8d01 100644 --- a/modules/@angular/router-deprecated/test/integration/router_link_spec.ts +++ b/modules/@angular/router-deprecated/test/integration/router_link_spec.ts @@ -8,8 +8,7 @@ import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {TestComponentBuilder} from '@angular/compiler/testing'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {Location} from '@angular/common'; import {NumberWrapper, escapeRegExp} from '../../src/facade/lang'; import {PromiseWrapper} from '../../src/facade/async'; diff --git a/modules/@angular/router-deprecated/test/integration/util.ts b/modules/@angular/router-deprecated/test/integration/util.ts index fcbea52a7c..3e092be28d 100644 --- a/modules/@angular/router-deprecated/test/integration/util.ts +++ b/modules/@angular/router-deprecated/test/integration/util.ts @@ -8,9 +8,8 @@ import {Location} from '@angular/common'; import {SpyLocation} from '@angular/common/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; import {Component, provide} from '@angular/core'; -import {ComponentFixture} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT, Router} from '@angular/router-deprecated'; diff --git a/modules/@angular/router/test/router.spec.ts b/modules/@angular/router/test/router.spec.ts index 991030c4ff..08e7237f2a 100644 --- a/modules/@angular/router/test/router.spec.ts +++ b/modules/@angular/router/test/router.spec.ts @@ -1,11 +1,13 @@ import 'rxjs/add/operator/map'; + import {Location} from '@angular/common'; -import {ComponentFixture, TestComponentBuilder} from '@angular/compiler/testing'; import {AppModule, AppModuleFactory, AppModuleFactoryLoader, Compiler, Component, Injectable} from '@angular/core'; -import {beforeEach, beforeEachProviders, configureModule, describe, fakeAsync, inject, it, tick} from '@angular/core/testing'; +import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing'; +import {addProviders, configureModule, fakeAsync, inject, tick} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/matchers'; import {Observable} from 'rxjs/Observable'; import {of } from 'rxjs/observable/of'; + import {ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanDeactivate, Event, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Params, ROUTER_DIRECTIVES, Resolve, Router, RouterStateSnapshot, RoutesRecognized, provideRoutes} from '../index'; import {RouterTestModule, SpyAppModuleFactoryLoader} from '../testing'; @@ -462,11 +464,13 @@ describe('Integration', () => { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): number { return 6; } } - beforeEachProviders( - () => - [{provide: 'resolveTwo', useValue: (a: any, b: any) => 2}, - {provide: 'resolveFour', useValue: (a: any, b: any) => 4}, - {provide: 'resolveSix', useClass: ResolveSix}]); + beforeEach(() => { + addProviders([ + {provide: 'resolveTwo', useValue: (a: any, b: any) => 2}, + {provide: 'resolveFour', useValue: (a: any, b: any) => 4}, + {provide: 'resolveSix', useClass: ResolveSix} + ]); + }); it('should provide resolved data', fakeAsync(inject( @@ -725,7 +729,9 @@ describe('Integration', () => { describe('guards', () => { describe('CanActivate', () => { describe('should not activate a route when CanActivate returns false', () => { - beforeEachProviders(() => [{provide: 'alwaysFalse', useValue: (a: any, b: any) => false}]); + beforeEach(() => { + addProviders([{provide: 'alwaysFalse', useValue: (a: any, b: any) => false}]); + }); // handle errors @@ -748,8 +754,9 @@ describe('Integration', () => { describe( 'should not activate a route when CanActivate returns false (componentless route)', () => { - beforeEachProviders( - () => [{provide: 'alwaysFalse', useValue: (a: any, b: any) => false}]); + beforeEach(() => { + addProviders([{provide: 'alwaysFalse', useValue: (a: any, b: any) => false}]); + }); it('works', fakeAsync(inject( [Router, TestComponentBuilder, Location], @@ -770,10 +777,12 @@ describe('Integration', () => { }); describe('should activate a route when CanActivate returns true', () => { - beforeEachProviders(() => [{ - provide: 'alwaysTrue', - useValue: (a: ActivatedRouteSnapshot, s: RouterStateSnapshot) => true - }]); + beforeEach(() => { + addProviders([{ + provide: 'alwaysTrue', + useValue: (a: ActivatedRouteSnapshot, s: RouterStateSnapshot) => true + }]); + }); it('works', fakeAsync(inject( @@ -798,7 +807,7 @@ describe('Integration', () => { } } - beforeEachProviders(() => [AlwaysTrue]); + beforeEach(() => { addProviders([AlwaysTrue]); }); it('works', fakeAsync(inject( [Router, TestComponentBuilder, Location], @@ -816,12 +825,13 @@ describe('Integration', () => { }); describe('should work when returns an observable', () => { - beforeEachProviders(() => [{ - provide: 'CanActivate', - useValue: (a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { - return of (false); - } - }]); + beforeEach(() => { + addProviders([{ + provide: 'CanActivate', + useValue: (a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { return of (false); } + }]); + }); + it('works', fakeAsync(inject( @@ -841,26 +851,28 @@ describe('Integration', () => { describe('CanDeactivate', () => { describe('should not deactivate a route when CanDeactivate returns false', () => { - beforeEachProviders( - () => - [{ - provide: 'CanDeactivateParent', - useValue: (c: any, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { - return a.params['id'] === '22'; - } - }, - { - provide: 'CanDeactivateTeam', - useValue: (c: any, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { - return c.route.snapshot.params['id'] === '22'; - } - }, - { - provide: 'CanDeactivateUser', - useValue: (c: any, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { - return a.params['name'] === 'victor'; - } - }]); + beforeEach(() => { + addProviders([ + { + provide: 'CanDeactivateParent', + useValue: (c: any, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { + return a.params['id'] === '22'; + } + }, + { + provide: 'CanDeactivateTeam', + useValue: (c: any, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { + return c.route.snapshot.params['id'] === '22'; + } + }, + { + provide: 'CanDeactivateUser', + useValue: (c: any, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { + return a.params['name'] === 'victor'; + } + } + ]); + }); it('works', fakeAsync(inject( @@ -959,7 +971,7 @@ describe('Integration', () => { } } - beforeEachProviders(() => [AlwaysTrue]); + beforeEach(() => { addProviders([AlwaysTrue]); }); it('works', fakeAsync(inject( @@ -982,11 +994,14 @@ describe('Integration', () => { }); describe('should work when returns an observable', () => { - beforeEachProviders(() => [{ - provide: 'CanDeactivate', - useValue: (c: TeamCmp, a: ActivatedRouteSnapshot, - b: RouterStateSnapshot) => { return of (false); } - }]); + beforeEach(() => { + addProviders([{ + provide: 'CanDeactivate', + useValue: (c: TeamCmp, a: ActivatedRouteSnapshot, b: RouterStateSnapshot) => { + return of (false); + } + }]); + }); it('works', fakeAsync(inject( @@ -1379,4 +1394,4 @@ function createRoot(tcb: TestComponentBuilder, router: Router, type: any): Compo router.initialNavigation(); advance(f); return f; -} \ No newline at end of file +} diff --git a/tools/public_api_guard/core/testing.d.ts b/tools/public_api_guard/core/testing.d.ts index 139f745d2b..8e025bf1b9 100644 --- a/tools/public_api_guard/core/testing.d.ts +++ b/tools/public_api_guard/core/testing.d.ts @@ -1,18 +1,9 @@ /** @stable */ export declare function addProviders(providers: Array): void; -/** @deprecated */ -export declare var afterEach: Function; - /** @stable */ export declare function async(fn: Function): (done: any) => any; -/** @deprecated */ -export declare var beforeEach: any; - -/** @deprecated */ -export declare function beforeEachProviders(fn: () => Array): void; - /** @stable */ export declare class ComponentFixture { changeDetectorRef: ChangeDetectorRef; @@ -52,36 +43,18 @@ export declare function configureModule(moduleDef: { modules?: any[]; }): void; -/** @deprecated */ -export declare var ddescribe: any; - -/** @deprecated */ -export declare var describe: Function; - /** @experimental */ export declare function discardPeriodicTasks(): void; -/** @deprecated */ -export declare var expect: Function; - /** @experimental */ export declare function fakeAsync(fn: Function): (...args: any[]) => any; -/** @deprecated */ -export declare var fdescribe: any; - -/** @deprecated */ -export declare var fit: any; - /** @experimental */ export declare function flushMicrotasks(): void; /** @experimental */ export declare function getTestInjector(): TestInjector; -/** @deprecated */ -export declare var iit: any; - /** @experimental */ export declare function initTestEnvironment(appModule: Type, platform: PlatformRef): void; @@ -100,9 +73,6 @@ export declare class InjectSetupWrapper { inject(tokens: any[], fn: Function): () => any; } -/** @deprecated */ -export declare var it: any; - /** @deprecated */ export declare function resetBaseTestProviders(): void; @@ -169,9 +139,3 @@ export declare function withModule(moduleDef: () => { /** @experimental */ export declare function withProviders(providers: () => any): InjectSetupWrapper; - -/** @deprecated */ -export declare var xdescribe: Function; - -/** @deprecated */ -export declare var xit: any;