mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
build: move private testing helpers outside platform-browser/testing (#61472)
These helpers are often imported by various tests throughout the repository, but the helpers aren't exported/exposed from the public entry-point; even though they confusingly reside in there. This commit fixes this, and moves the helpers into `packages/private/testing`. This is a preparation for the `ts_project` migration where we don't want to leverage deep imports between packages. PR Close #61472
This commit is contained in:
parent
fc14ca5e34
commit
3a106a35bc
71 changed files with 110 additions and 63 deletions
|
|
@ -32,3 +32,5 @@ export {
|
|||
camelCaseToDashCase as ɵcamelCaseToDashCase,
|
||||
normalizeKeyframes as ɵnormalizeKeyframes,
|
||||
} from './util';
|
||||
export {TransitionAnimationPlayer as ɵTransitionAnimationPlayer} from './render/transition_animation_engine';
|
||||
export {ENTER_CLASSNAME as ɵENTER_CLASSNAME, LEAVE_CLASSNAME as ɵLEAVE_CLASSNAME} from './util';
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ ts_project(
|
|||
name = "test_lib",
|
||||
testonly = True,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
interop_deps = [
|
||||
"//packages/private/testing",
|
||||
],
|
||||
deps = [
|
||||
"//packages:types_rjs",
|
||||
"//packages/animations:animations_rjs",
|
||||
"//packages/animations/browser:browser_rjs",
|
||||
"//packages/animations/browser/testing:testing_rjs",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
import {
|
||||
animate,
|
||||
animation,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
import {animate, AnimationOptions, state, style, transition} from '../../../src/animations';
|
||||
import {AnimationTransitionInstruction} from '../../src/dsl/animation_transition_instruction';
|
||||
import {AnimationTrigger} from '../../src/dsl/animation_trigger';
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
import {animate, AnimationMetadata, style} from '../../../src/animations';
|
||||
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
AnimationEvent,
|
||||
AnimationMetadata,
|
||||
AnimationTriggerMetadata,
|
||||
NoopAnimationPlayer,
|
||||
state,
|
||||
style,
|
||||
transition,
|
||||
|
|
@ -30,6 +29,7 @@ import {
|
|||
TransitionAnimationPlayer,
|
||||
} from '../../src/render/transition_animation_engine';
|
||||
import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_animation_driver';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
const DEFAULT_NAMESPACE_ID = 'id';
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import {isNode} from '@angular/private/testing';
|
||||
import {WebAnimationsDriver} from '../../../src/render/web_animations/web_animations_driver';
|
||||
import {WebAnimationsPlayer} from '../../../src/render/web_animations/web_animations_player';
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ ts_project(
|
|||
"//packages/platform-browser/animations",
|
||||
"//packages/platform-browser/animations/async",
|
||||
"//packages/platform-browser/testing",
|
||||
"//packages/private/testing",
|
||||
],
|
||||
deps = [
|
||||
"//packages:types_rjs",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {ɵDomRendererFactory2 as DomRendererFactory2} from '@angular/platform-br
|
|||
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {ɵAsyncAnimationRendererFactory as AsyncAnimationRendererFactory} from '@angular/platform-browser/animations/async';
|
||||
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
describe('BrowserAnimationBuilder', () => {
|
||||
if (isNode) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {isNode} from '@angular/private/testing';
|
||||
import {ApplicationRef, Injector, signal} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import {
|
|||
ViewContainerRef,
|
||||
} from '@angular/core';
|
||||
import {TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('insert/remove', () => {
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {CommonModule, NgFor, NgForOf} from '../../index';
|
|||
import {Component} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
let thisArg: any;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {CommonModule, NgIf, ɵgetDOM as getDOM} from '../../index';
|
|||
import {Component} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('ngIf directive', () => {
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {CommonModule, DOCUMENT, IMAGE_CONFIG, ImageConfig} from '../../index';
|
||||
import {RuntimeErrorCode} from '../../src/errors';
|
||||
import {PLATFORM_SERVER_ID} from '../../src/platform_id';
|
||||
import {ChangeDetectionStrategy, Component, PLATFORM_ID, Provider, Type} from '@angular/core';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {withHead} from '@angular/private/testing';
|
||||
import {isBrowser, isNode, withHead} from '@angular/private/testing';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {CommonModule, DOCUMENT, IMAGE_CONFIG, ImageConfig} from '../../index';
|
||||
import {RuntimeErrorCode} from '../../src/errors';
|
||||
import {PLATFORM_SERVER_ID} from '../../src/platform_id';
|
||||
|
||||
import {PRELOADED_IMAGES} from '../..//src/directives/ng_optimized_image/tokens';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {CommonModule, NgLocalization, NgPlural, NgPluralCase} from '../../index';
|
||||
import {Component, Injectable} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('ngPlural', () => {
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {CommonModule, NgSwitch, NgSwitchCase, NgSwitchDefault} from '../../index';
|
||||
import {Attribute, Component, Directive, TemplateRef, ViewChild} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('NgSwitch', () => {
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import {
|
|||
TemplateRef,
|
||||
} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('NgTemplateOutlet', () => {
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
import {Component, Directive} from '@angular/core';
|
||||
import {ElementRef} from '@angular/core/src/linker/element_ref';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {hasClass} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {hasClass} from '@angular/private/testing';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('non-bindable', () => {
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {CommonModule, JsonPipe} from '../../index';
|
||||
import {Component} from '@angular/core';
|
||||
import {TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('JsonPipe', () => {
|
||||
const regNewLine = '\n';
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {CommonModule, SlicePipe} from '../../index';
|
||||
import {Component} from '@angular/core';
|
||||
import {TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('SlicePipe', () => {
|
||||
let list: number[];
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
import {BrowserViewportScroller, ViewportScroller} from '../src/viewport_scroller';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
describe('BrowserViewportScroller', () => {
|
||||
describe('setHistoryScrollRestoration', () => {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import {publishFacade} from './jit_compiler_facade';
|
|||
import * as outputAst from './output/output_ast';
|
||||
import {global} from './util';
|
||||
|
||||
export {SECURITY_SCHEMA} from './schema/dom_security_schema';
|
||||
export {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SchemaMetadata} from './core';
|
||||
export {core};
|
||||
|
||||
|
|
@ -247,9 +248,11 @@ export * from './resource_loader';
|
|||
export * from './schema/dom_element_schema_registry';
|
||||
export * from './schema/element_schema_registry';
|
||||
export * from './directive_matching';
|
||||
export {Version} from './util';
|
||||
export {Version, escapeRegExp} from './util';
|
||||
export * from './version';
|
||||
export {outputAst};
|
||||
export {CompilerFacadeImpl} from './jit_compiler_facade';
|
||||
|
||||
// This file only reexports content of the `src` folder. Keep it that way.
|
||||
|
||||
// This function call has a global side effects and publishes the compiler into global namespace for
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ ts_library(
|
|||
"//packages/platform-browser",
|
||||
"//packages/platform-browser-dynamic",
|
||||
"//packages/platform-browser/testing",
|
||||
"//packages/private/testing",
|
||||
"@npm//source-map",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ ts_library(
|
|||
testonly = True,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler/test/expression_parser/utils",
|
||||
"//packages/platform-browser/testing",
|
||||
"//packages/private/testing",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import {
|
|||
} from '../../src/expression_parser/ast';
|
||||
import {Lexer} from '../../src/expression_parser/lexer';
|
||||
import {Parser, SplitInterpolation} from '../../src/expression_parser/parser';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
import {unparse, unparseWithSpan} from './utils/unparser';
|
||||
import {validate} from './utils/validator';
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import {ResourceLoader} from '../../src/resource_loader';
|
|||
import {Component, DebugElement, TRANSLATIONS, TRANSLATIONS_FORMAT} from '@angular/core';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {stringifyElement} from '@angular/private/testing';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
@Component({
|
||||
selector: 'i18n-cmp',
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {Xliff2} from '../../src/i18n/serializers/xliff2';
|
||||
import {waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
import {
|
||||
configureCompiler,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {Xliff} from '../../src/i18n/serializers/xliff';
|
||||
import {waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
import {
|
||||
configureCompiler,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {Xmb} from '../../src/i18n/serializers/xmb';
|
||||
import {waitForAsync} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
import {
|
||||
configureCompiler,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {Component, Directive, Input} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('integration tests', () => {
|
||||
let fixture: ComponentFixture<TestComponent>;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import {DomElementSchemaRegistry} from '../../src/schema/dom_element_schema_registry';
|
||||
import {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SecurityContext} from '@angular/core';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
import {Element} from '../../src/ml_parser/ast';
|
||||
import {HtmlParser} from '../../src/ml_parser/html_parser';
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ ts_library(
|
|||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"//packages/platform-browser/testing",
|
||||
"//packages/private/testing",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {CssSelector, SelectorMatcher} from '../../src/directive_matching';
|
||||
import {el} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {el} from '@angular/private/testing';
|
||||
|
||||
describe('SelectorMatcher', () => {
|
||||
let matcher: SelectorMatcher;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ import {
|
|||
ViewChild,
|
||||
} from '@angular/core';
|
||||
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {dispatchEvent, isNode, sortedClassList} from '@angular/private/testing';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {merge, NEVER, Observable, of, Subject, Subscription, timer} from 'rxjs';
|
||||
import {map, tap} from 'rxjs/operators';
|
||||
import {
|
||||
AbstractControl,
|
||||
AsyncValidator,
|
||||
|
|
@ -41,11 +46,6 @@ import {
|
|||
Validator,
|
||||
Validators,
|
||||
} from '../index';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {dispatchEvent, sortedClassList} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {merge, NEVER, Observable, of, Subject, Subscription, timer} from 'rxjs';
|
||||
import {map, tap} from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
ControlEvent,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import {
|
|||
Validator,
|
||||
} from '../index';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {dispatchEvent, sortedClassList} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {dispatchEvent, sortedClassList} from '@angular/private/testing';
|
||||
import {merge} from 'rxjs';
|
||||
|
||||
import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integration_spec';
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import {
|
|||
Validators,
|
||||
} from '../index';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {dispatchEvent, isNode} from '@angular/private/testing';
|
||||
|
||||
describe('value accessors', () => {
|
||||
function initTest<T>(component: Type<T>, ...directives: Type<any>[]): ComponentFixture<T> {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {ɵMetadataOverrider as MetadataOverrider} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
interface SomeMetadataType {
|
||||
plainProp?: string;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {isBrowser} from '@angular/private/testing';
|
||||
import {ResourceLoaderImpl} from '../../src/resource_loader/resource_loader_impl';
|
||||
|
||||
if (isBrowser) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {ResourceLoaderImpl} from '../src/resource_loader/resource_loader_impl';
|
|||
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '../testing';
|
||||
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';
|
||||
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {isBrowser} from '@angular/private/testing';
|
||||
|
||||
// Components for the tests.
|
||||
class FancyService {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import {
|
|||
import {TestBed} from '@angular/core/testing';
|
||||
import {ɵDomRendererFactory2 as DomRendererFactory2} from '../../../index';
|
||||
import {InjectableAnimationEngine} from '../../../animations/src/providers';
|
||||
import {el} from '../../../testing/src/browser_util';
|
||||
import {el, isNode} from '@angular/private/testing';
|
||||
|
||||
import {
|
||||
AsyncAnimationRendererFactory,
|
||||
|
|
|
|||
|
|
@ -38,9 +38,7 @@ import {
|
|||
} from '../index';
|
||||
import {provideAnimationsAsync} from '../async';
|
||||
import {DomRendererFactory2} from '../../src/dom/dom_renderer';
|
||||
import {withBody} from '@angular/private/testing';
|
||||
|
||||
import {el} from '../../testing/src/browser_util';
|
||||
import {withBody, isNode, el} from '@angular/private/testing';
|
||||
|
||||
(function () {
|
||||
if (isNode) return;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {ɵAnimationEngine} from '@angular/animations/browser';
|
|||
import {Component} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserAnimationsModule, NoopAnimationsModule, provideNoopAnimations} from '../index';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
describe('NoopAnimationsModule', () => {
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ import {Log} from '@angular/core/testing/src/testing_internal';
|
|||
import {BrowserModule} from '../../index';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import {provideAnimations, provideNoopAnimations} from '../../animations';
|
||||
import {expect} from '../../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
import {bootstrapApplication} from '../../src/browser';
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {ɵgetDOM as getDOM} from '@angular/common';
|
|||
import {Injectable} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserModule, Meta} from '../../index';
|
||||
import {expect} from '../../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('Meta service', () => {
|
||||
let doc: Document;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {ɵgetDOM as getDOM} from '@angular/common';
|
|||
import {Injectable} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserModule, Title} from '../../index';
|
||||
import {expect} from '../../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('title service', () => {
|
||||
let doc: Document;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import {ApplicationRef, Injector, ɵglobal as global} from '@angular/core';
|
||||
import {ComponentRef} from '@angular/core/src/render3';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
import {disableDebugTools, enableDebugTools} from '../../../index';
|
||||
|
||||
import {AngularProfiler} from '../../../src/browser/tools/common_tools';
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ import {
|
|||
NAMESPACE_URIS,
|
||||
REMOVE_STYLES_ON_COMPONENT_DESTROY,
|
||||
} from '../../src/dom/dom_renderer';
|
||||
import {expect} from '../../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
describe('DefaultDomRendererV2', () => {
|
||||
if (isNode) {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import {NgZone} from '@angular/core/src/zone/ng_zone';
|
|||
import {DomEventsPlugin} from '../../../src/dom/events/dom_events';
|
||||
import {EventManager, EventManagerPlugin} from '../../../src/dom/events/event_manager';
|
||||
|
||||
import {createMouseEvent, el} from '../../../testing/src/browser_util';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {isNode, createMouseEvent, el} from '@angular/private/testing';
|
||||
|
||||
(function () {
|
||||
if (isNode) return;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {ApplicationRef, Injector, NgZone} from '@angular/core';
|
|||
import {fakeAsync, inject, TestBed, tick} from '@angular/core/testing';
|
||||
import {EventManager} from '../../../index';
|
||||
import {HammerGestureConfig, HammerGesturesPlugin} from '../../../src/dom/events/hammer_gestures';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
describe('HammerGesturesPlugin', () => {
|
||||
let plugin: HammerGesturesPlugin;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
import {Component, NgModule, ViewEncapsulation} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {BrowserModule} from '../../index';
|
||||
import {expect} from '../../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
|
||||
describe('ShadowDOM Support', () => {
|
||||
if (isNode) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {ɵgetDOM as getDOM} from '@angular/common';
|
||||
import {SharedStylesHost} from '../../src/dom/shared_styles_host';
|
||||
import {expect} from '../../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
|
||||
describe('SharedStylesHost', () => {
|
||||
let doc: Document;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ import {
|
|||
waitForAsync,
|
||||
withModule,
|
||||
} from '@angular/core/testing';
|
||||
import {expect} from '../testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {isBrowser} from '@angular/private/testing';
|
||||
|
||||
// Services, and components for the tests.
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ export {
|
|||
} from './server';
|
||||
export {SERVER_CONTEXT as ɵSERVER_CONTEXT, renderInternal as ɵrenderInternal} from './utils';
|
||||
export {ENABLE_DOM_EMULATION as ɵENABLE_DOM_EMULATION} from './tokens';
|
||||
export {DominoAdapter as ɵDominoAdapter} from './domino_adapter';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ ng_module(
|
|||
),
|
||||
module_name = "@angular/private/testing",
|
||||
deps = [
|
||||
"//packages/common",
|
||||
"//packages/core",
|
||||
"//packages/core/testing",
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-server:bundled_domino_lib",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,3 +7,5 @@
|
|||
*/
|
||||
|
||||
export * from './src/utils';
|
||||
export * from './src/browser_utils';
|
||||
export * from './src/globals';
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
import {ɵgetDOM as getDOM} from '@angular/common';
|
||||
import {Type} from '@angular/core';
|
||||
import {ComponentFixture} from '@angular/core/testing';
|
||||
import {By} from '../../index';
|
||||
import {By} from '@angular/platform-browser';
|
||||
|
||||
import {childNodesAsList, hasClass, hasStyle, isCommentNode} from './browser_util';
|
||||
import {childNodesAsList, hasClass, hasStyle, isCommentNode} from '../src/browser_utils';
|
||||
|
||||
/**
|
||||
* Jasmine matchers that check Angular specific conditions.
|
||||
12
packages/private/testing/src/globals.ts
Normal file
12
packages/private/testing/src/globals.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC 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.dev/license
|
||||
*/
|
||||
|
||||
// Set by the test initialization scripts.
|
||||
|
||||
export const isBrowser = !!(globalThis as any).isBrowser;
|
||||
export const isNode = !!(globalThis as any).isNode;
|
||||
|
|
@ -22,6 +22,7 @@ import {
|
|||
provideZonelessChangeDetection,
|
||||
} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {isNode} from '@angular/private/testing';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {Location} from '@angular/common';
|
||||
import {Component, Injectable, NgModule, Type} from '@angular/core';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {Router, RouterModule, RouterOutlet, UrlTree, withRouterConfig} from '../index';
|
||||
import {EMPTY, of} from 'rxjs';
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import {
|
|||
createRoot,
|
||||
advance,
|
||||
} from './integration_helpers';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {timeout} from '../helpers';
|
||||
|
||||
export function eagerUrlUpdateStrategyIntegrationSuite() {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import {
|
|||
} from '../../src';
|
||||
import {wrapIntoObservable} from '../../src/utils/collection';
|
||||
import {RouterTestingHarness} from '../../testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {
|
||||
TeamCmp,
|
||||
RootCmp,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
signal,
|
||||
} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {
|
||||
ActivationEnd,
|
||||
ActivationStart,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
QueryList,
|
||||
} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {
|
||||
Router,
|
||||
Event,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {Location} from '@angular/common';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {CommonModule, Location} from '@angular/common';
|
||||
import {Component, OnDestroy, NgModule, InjectionToken, Inject, signal} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
import {filter, tap, first} from 'rxjs/operators';
|
||||
import {Event} from '../../index';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {
|
||||
Router,
|
||||
ChildActivationStart,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {Location} from '@angular/common';
|
|||
import {TestBed, ComponentFixture} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {Router} from '../../src';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {
|
||||
RootCmp,
|
||||
BlankCmp,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import {DOCUMENT} from '@angular/common';
|
||||
import {Component, destroyPlatform, provideZonelessChangeDetection} from '@angular/core';
|
||||
import {bootstrapApplication} from '@angular/platform-browser';
|
||||
import {withBody} from '@angular/private/testing';
|
||||
import {withBody, isNode} from '@angular/private/testing';
|
||||
import {
|
||||
Event,
|
||||
NavigationEnd,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@
|
|||
"importHelpers": true,
|
||||
"paths": {
|
||||
"zone.js": ["./zone.js/lib/zone"],
|
||||
"@angular/*": ["./*/index"]
|
||||
"@angular/*": ["./*/index"],
|
||||
"@angular/common/locales/*": ["./common/locales/*"]
|
||||
}
|
||||
},
|
||||
"bazelOptions": {
|
||||
|
|
|
|||
3
packages/types.d.ts
vendored
3
packages/types.d.ts
vendored
|
|
@ -21,6 +21,3 @@
|
|||
// /packages/tsconfig-test.json when `testonly = True` is set
|
||||
// and packages such as platform-server that need these types should
|
||||
// use `/// <reference types="x">` in their main entry points
|
||||
|
||||
declare let isNode: boolean;
|
||||
declare let isBrowser: boolean;
|
||||
|
|
|
|||
Loading…
Reference in a new issue