repackaging: all the repackaging changes squashed
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Starting point to import all public core APIs.
|
||||
*/
|
||||
export * from './src/core/metadata';
|
||||
export * from './src/core/util';
|
||||
export * from './src/core/prod_mode';
|
||||
export * from './src/core/di';
|
||||
export * from './src/facade/facade';
|
||||
export {enableProdMode} from 'angular2/src/facade/lang';
|
||||
export {
|
||||
createPlatform,
|
||||
assertPlatform,
|
||||
disposePlatform,
|
||||
getPlatform,
|
||||
coreBootstrap,
|
||||
coreLoadAndBootstrap,
|
||||
createNgZone,
|
||||
PlatformRef,
|
||||
ApplicationRef
|
||||
} from './src/core/application_ref';
|
||||
export {
|
||||
APP_ID,
|
||||
APP_INITIALIZER,
|
||||
PACKAGE_ROOT_URL,
|
||||
PLATFORM_INITIALIZER
|
||||
} from './src/core/application_tokens';
|
||||
export * from './src/core/zone';
|
||||
export * from './src/core/render';
|
||||
export * from './src/core/linker';
|
||||
export {DebugElement, DebugNode, asNativeElements} from './src/core/debug/debug_node';
|
||||
export * from './src/core/testability/testability';
|
||||
export * from './src/core/change_detection';
|
||||
export * from './src/core/platform_directives_and_pipes';
|
||||
export * from './src/core/platform_common_providers';
|
||||
export * from './src/core/application_common_providers';
|
||||
export * from './src/core/reflection/reflection';
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Starting point to import all public core APIs.
|
||||
*/
|
||||
export * from './src/metadata';
|
||||
export * from './src/util';
|
||||
export * from './src/di';
|
||||
export {
|
||||
createPlatform,
|
||||
assertPlatform,
|
||||
disposePlatform,
|
||||
getPlatform,
|
||||
coreBootstrap,
|
||||
coreLoadAndBootstrap,
|
||||
createNgZone,
|
||||
PlatformRef,
|
||||
ApplicationRef
|
||||
} from './src/application_ref';
|
||||
export {
|
||||
APP_ID,
|
||||
APP_INITIALIZER,
|
||||
PACKAGE_ROOT_URL,
|
||||
PLATFORM_INITIALIZER
|
||||
} from './src/application_tokens';
|
||||
export * from './src/zone';
|
||||
export * from './src/render';
|
||||
export * from './src/linker';
|
||||
export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './src/debug/debug_node';
|
||||
export * from './src/testability/testability';
|
||||
export * from './src/change_detection';
|
||||
export * from './src/platform_directives_and_pipes';
|
||||
export * from './src/platform_common_providers';
|
||||
export * from './src/application_common_providers';
|
||||
export * from './src/reflection/reflection';
|
||||
export {
|
||||
wtfCreateScope,
|
||||
wtfLeave,
|
||||
wtfStartTimeRange,
|
||||
wtfEndTimeRange,
|
||||
WtfScopeFn
|
||||
} from './src/profile/profile';
|
||||
export {Type, enableProdMode} from "./src/facade/lang";
|
||||
export {EventEmitter} from "./src/facade/async";
|
||||
export {ExceptionHandler, WrappedException, BaseException} from "./src/facade/exceptions";
|
||||
export * from './private_export';
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@angular/core",
|
||||
"version": "$$ANGULAR_VERSION$$",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"jsnext:main": "esm/index.js",
|
||||
"typings": "index.d.ts",
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "^0.6.6"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
export './src/core/change_detection/constants.dart' show isDefaultChangeDetectionStrategy, ChangeDetectorState, CHANGE_DETECTION_STRATEGY_VALUES;
|
||||
export './src/core/di/reflective_provider.dart' show constructDependencies;
|
||||
export './src/core/metadata/lifecycle_hooks.dart' show LifecycleHooks, LIFECYCLE_HOOKS_VALUES;
|
||||
export './src/core/reflection/reflector_reader.dart' show ReflectorReader;
|
||||
export './src/core/linker/component_resolver.dart' show ReflectorComponentResolver;
|
||||
export './src/core/linker/element.dart' show AppElement;
|
||||
export './src/core/linker/view.dart' show AppView;
|
||||
export './src/core/linker/view_type.dart' show ViewType;
|
||||
export './src/core/linker/view_utils.dart' show MAX_INTERPOLATION_VALUES, checkBinding, flattenNestedViewRenderNodes, interpolate, ViewUtils;
|
||||
export './src/core/metadata/view.dart' show VIEW_ENCAPSULATION_VALUES;
|
||||
export './src/core/linker/debug_context.dart' show DebugContext, StaticNodeDebugInfo;
|
||||
export './src/core/change_detection/change_detection_util.dart' show devModeEqual, uninitialized, ValueUnwrapper;
|
||||
export './src/core/render/api.dart' show RenderDebugInfo;
|
||||
export './src/core/linker/template_ref.dart' show TemplateRef_;
|
||||
export './src/core/profile/wtf_init.dart' show wtfInit;
|
||||
export './src/core/reflection/reflection_capabilities.dart' show ReflectionCapabilities;
|
||||
export './src/util/decorators' show makeDecorator;
|
||||
@@ -0,0 +1,128 @@
|
||||
import * as constants from './src/change_detection/constants';
|
||||
import * as reflective_provider from './src/di/reflective_provider';
|
||||
import * as lifecycle_hooks from './src/metadata/lifecycle_hooks';
|
||||
import * as reflector_reader from './src/reflection/reflector_reader';
|
||||
import * as component_resolver from './src/linker/component_resolver';
|
||||
import * as element from './src/linker/element';
|
||||
import * as view from './src/linker/view';
|
||||
import * as view_type from './src/linker/view_type';
|
||||
import * as view_utils from './src/linker/view_utils';
|
||||
import * as metadata_view from './src/metadata/view';
|
||||
import * as debug_context from './src/linker/debug_context';
|
||||
import * as change_detection_util from './src/change_detection/change_detection_util';
|
||||
import * as api from './src/render/api';
|
||||
import * as template_ref from './src/linker/template_ref';
|
||||
import * as wtf_init from './src/profile/wtf_init';
|
||||
import * as reflection_capabilities from './src/reflection/reflection_capabilities';
|
||||
import * as decorators from './src/util/decorators';
|
||||
import * as debug from './src/debug/debug_renderer';
|
||||
import * as provider_util from './src/di/provider_util';
|
||||
import * as console from './src/console';
|
||||
import {Provider} from './index';
|
||||
|
||||
export declare namespace __core_private_types__ {
|
||||
export var isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy;
|
||||
export type ChangeDetectorState = constants.ChangeDetectorState;
|
||||
export var ChangeDetectorState: typeof constants.ChangeDetectorState;
|
||||
export var CHANGE_DETECTION_STRATEGY_VALUES: typeof constants.CHANGE_DETECTION_STRATEGY_VALUES;
|
||||
export var constructDependencies: typeof reflective_provider.constructDependencies;
|
||||
export type LifecycleHooks = lifecycle_hooks.LifecycleHooks;
|
||||
export var LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks;
|
||||
export var LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES;
|
||||
export type ReflectorReader = reflector_reader.ReflectorReader;
|
||||
export var ReflectorReader: typeof reflector_reader.ReflectorReader;
|
||||
export var ReflectorComponentResolver: typeof component_resolver.ReflectorComponentResolver;
|
||||
export type AppElement = element.AppElement;
|
||||
export var AppElement: typeof element.AppElement;
|
||||
export var AppView: typeof view.AppView;
|
||||
export type DebugAppView<T> = view.DebugAppView<T>;
|
||||
export var DebugAppView: typeof view.DebugAppView;
|
||||
export type ViewType = view_type.ViewType;
|
||||
export var ViewType: typeof view_type.ViewType;
|
||||
export var MAX_INTERPOLATION_VALUES: typeof view_utils.MAX_INTERPOLATION_VALUES;
|
||||
export var checkBinding: typeof view_utils.checkBinding;
|
||||
export var flattenNestedViewRenderNodes: typeof view_utils.flattenNestedViewRenderNodes;
|
||||
export var interpolate: typeof view_utils.interpolate;
|
||||
export var ViewUtils: typeof view_utils.ViewUtils;
|
||||
export var VIEW_ENCAPSULATION_VALUES: typeof metadata_view.VIEW_ENCAPSULATION_VALUES;
|
||||
export var DebugContext: typeof debug_context.DebugContext;
|
||||
export var StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo;
|
||||
export var devModeEqual: typeof change_detection_util.devModeEqual;
|
||||
export var uninitialized: typeof change_detection_util.uninitialized;
|
||||
export var ValueUnwrapper: typeof change_detection_util.ValueUnwrapper;
|
||||
export type RenderDebugInfo = api.RenderDebugInfo;
|
||||
export var RenderDebugInfo: typeof api.RenderDebugInfo;
|
||||
export type TemplateRef_<C> = template_ref.TemplateRef_<C>;
|
||||
export var TemplateRef_: typeof template_ref.TemplateRef_;
|
||||
export var wtfInit: typeof wtf_init.wtfInit;
|
||||
export type ReflectionCapabilities = reflection_capabilities.ReflectionCapabilities;
|
||||
export var ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities;
|
||||
export var makeDecorator: typeof decorators.makeDecorator;
|
||||
export type DebugDomRootRenderer = debug.DebugDomRootRenderer;
|
||||
export var DebugDomRootRenderer: typeof debug.DebugDomRootRenderer;
|
||||
export var createProvider: typeof provider_util.createProvider;
|
||||
export var isProviderLiteral: typeof provider_util.isProviderLiteral;
|
||||
export var EMPTY_ARRAY: typeof view_utils.EMPTY_ARRAY;
|
||||
export var EMPTY_MAP: typeof view_utils.EMPTY_MAP;
|
||||
export var pureProxy1: typeof view_utils.pureProxy1;
|
||||
export var pureProxy2: typeof view_utils.pureProxy2;
|
||||
export var pureProxy3: typeof view_utils.pureProxy3;
|
||||
export var pureProxy4: typeof view_utils.pureProxy4;
|
||||
export var pureProxy5: typeof view_utils.pureProxy5;
|
||||
export var pureProxy6: typeof view_utils.pureProxy6;
|
||||
export var pureProxy7: typeof view_utils.pureProxy7;
|
||||
export var pureProxy8: typeof view_utils.pureProxy8;
|
||||
export var pureProxy9: typeof view_utils.pureProxy9;
|
||||
export var pureProxy10: typeof view_utils.pureProxy10;
|
||||
export var castByValue: typeof view_utils.castByValue;
|
||||
export type Console = console.Console;
|
||||
export var Console: typeof console.Console;
|
||||
}
|
||||
|
||||
export var __core_private__ = {
|
||||
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
|
||||
ChangeDetectorState: constants.ChangeDetectorState,
|
||||
CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES,
|
||||
constructDependencies: reflective_provider.constructDependencies,
|
||||
LifecycleHooks: lifecycle_hooks.LifecycleHooks,
|
||||
LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
|
||||
ReflectorReader: reflector_reader.ReflectorReader,
|
||||
ReflectorComponentResolver: component_resolver.ReflectorComponentResolver,
|
||||
AppElement: element.AppElement,
|
||||
AppView: view.AppView,
|
||||
DebugAppView: view.DebugAppView,
|
||||
ViewType: view_type.ViewType,
|
||||
MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES,
|
||||
checkBinding: view_utils.checkBinding,
|
||||
flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes,
|
||||
interpolate: view_utils.interpolate,
|
||||
ViewUtils: view_utils.ViewUtils,
|
||||
VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES,
|
||||
DebugContext: debug_context.DebugContext,
|
||||
StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo,
|
||||
devModeEqual: change_detection_util.devModeEqual,
|
||||
uninitialized: change_detection_util.uninitialized,
|
||||
ValueUnwrapper: change_detection_util.ValueUnwrapper,
|
||||
RenderDebugInfo: api.RenderDebugInfo,
|
||||
TemplateRef_: template_ref.TemplateRef_,
|
||||
wtfInit: wtf_init.wtfInit,
|
||||
ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities,
|
||||
makeDecorator: decorators.makeDecorator,
|
||||
DebugDomRootRenderer: debug.DebugDomRootRenderer,
|
||||
createProvider: provider_util.createProvider,
|
||||
isProviderLiteral: provider_util.isProviderLiteral,
|
||||
EMPTY_ARRAY: view_utils.EMPTY_ARRAY,
|
||||
EMPTY_MAP: view_utils.EMPTY_MAP,
|
||||
pureProxy1: view_utils.pureProxy1,
|
||||
pureProxy2: view_utils.pureProxy2,
|
||||
pureProxy3: view_utils.pureProxy3,
|
||||
pureProxy4: view_utils.pureProxy4,
|
||||
pureProxy5: view_utils.pureProxy5,
|
||||
pureProxy6: view_utils.pureProxy6,
|
||||
pureProxy7: view_utils.pureProxy7,
|
||||
pureProxy8: view_utils.pureProxy8,
|
||||
pureProxy9: view_utils.pureProxy9,
|
||||
pureProxy10: view_utils.pureProxy10,
|
||||
castByValue: view_utils.castByValue,
|
||||
Console: console.Console,
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/core/esm/index.js',
|
||||
dest: '../../../dist/packages-dist/core/esm/core.umd.js',
|
||||
sourceMap: true,
|
||||
format: 'umd',
|
||||
moduleName: 'ng.core',
|
||||
globals: {
|
||||
'rxjs/Subject': 'Rx',
|
||||
'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update.
|
||||
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
|
||||
'rxjs/Observable': 'Rx'
|
||||
},
|
||||
plugins: [
|
||||
// nodeResolve({ jsnext: true, main: true }),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Type} from '../src/facade/lang';
|
||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||
import {APPLICATION_CORE_PROVIDERS} from './application_ref';
|
||||
import {
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
KeyValueDiffers,
|
||||
defaultKeyValueDiffers
|
||||
} from './change_detection/change_detection';
|
||||
import {ViewUtils} from "./linker/view_utils";
|
||||
import {ViewUtils} from './linker/view_utils';
|
||||
import {ComponentResolver, ReflectorComponentResolver} from './linker/component_resolver';
|
||||
import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader';
|
||||
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
import {NgZone, NgZoneError} from 'angular2/src/core/zone/ng_zone';
|
||||
import {NgZone, NgZoneError} from './zone/ng_zone';
|
||||
import {
|
||||
Type,
|
||||
isBlank,
|
||||
isPresent,
|
||||
assertionsEnabled,
|
||||
print,
|
||||
IS_DART,
|
||||
lockMode,
|
||||
isPromise
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {provide, Provider, Injector, Injectable} from 'angular2/src/core/di';
|
||||
import {APP_ID_RANDOM_PROVIDER, PLATFORM_INITIALIZER, APP_INITIALIZER} from './application_tokens';
|
||||
import {PromiseWrapper, PromiseCompleter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||
import {ComponentResolver} from 'angular2/src/core/linker/component_resolver';
|
||||
import {ComponentRef, ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
} from '../src/facade/lang';
|
||||
import {Injector, Injectable} from './di';
|
||||
import {PLATFORM_INITIALIZER, APP_INITIALIZER} from './application_tokens';
|
||||
import {PromiseWrapper, ObservableWrapper} from '../src/facade/async';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {TestabilityRegistry, Testability} from './testability/testability';
|
||||
import {ComponentResolver} from './linker/component_resolver';
|
||||
import {ComponentRef, ComponentFactory} from './linker/component_factory';
|
||||
import {
|
||||
BaseException,
|
||||
WrappedException,
|
||||
ExceptionHandler,
|
||||
unimplemented
|
||||
} from 'angular2/src/facade/exceptions';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
} from '../src/facade/exceptions';
|
||||
import {Console} from './console';
|
||||
import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile';
|
||||
import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref';
|
||||
import {ChangeDetectorRef} from './change_detection/change_detector_ref';
|
||||
|
||||
/**
|
||||
* Create an Angular zone.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {OpaqueToken, Provider} from 'angular2/src/core/di';
|
||||
import {Math, StringWrapper} from 'angular2/src/facade/lang';
|
||||
import {OpaqueToken} from './di';
|
||||
import {Math, StringWrapper} from '../src/facade/lang';
|
||||
|
||||
/**
|
||||
* A DI Token representing a unique string id assigned to the application by Angular and used
|
||||
|
||||
@@ -12,6 +12,7 @@ export {
|
||||
WrappedValue,
|
||||
SimpleChange,
|
||||
PipeTransform,
|
||||
DefaultIterableDiffer,
|
||||
IterableDiffers,
|
||||
IterableDiffer,
|
||||
IterableDifferFactory,
|
||||
|
||||
@@ -30,6 +30,7 @@ export {
|
||||
TrackByFn
|
||||
} from './differs/iterable_differs';
|
||||
export {KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory} from './differs/keyvalue_differs';
|
||||
export {DefaultIterableDiffer} from './differs/default_iterable_differ';
|
||||
export {PipeTransform} from './pipe_transform';
|
||||
|
||||
export {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {isBlank, looseIdentical, isPrimitive} from 'angular2/src/facade/lang';
|
||||
import {looseIdentical, isPrimitive} from '../../src/facade/lang';
|
||||
import {
|
||||
StringMapWrapper,
|
||||
isListLikeIterable,
|
||||
areIterablesEqual
|
||||
} from 'angular2/src/facade/collection';
|
||||
} from '../../src/facade/collection';
|
||||
|
||||
export {looseIdentical} from 'angular2/src/facade/lang';
|
||||
export {looseIdentical} from '../../src/facade/lang';
|
||||
export var uninitialized: Object = /*@ts2dart_const*/ new Object();
|
||||
|
||||
export function devModeEqual(a: any, b: any): boolean {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {StringWrapper, normalizeBool, isBlank} from 'angular2/src/facade/lang';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
|
||||
/**
|
||||
* Describes the current state of the change detector.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {isListLikeIterable, iterateListLike, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {isListLikeIterable, iterateListLike} from '../../../src/facade/collection';
|
||||
|
||||
import {
|
||||
isBlank,
|
||||
@@ -8,10 +8,10 @@ import {
|
||||
getMapKey,
|
||||
looseIdentical,
|
||||
isArray
|
||||
} from 'angular2/src/facade/lang';
|
||||
} from '../../../src/facade/lang';
|
||||
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
import {IterableDiffer, IterableDifferFactory, TrackByFn} from '../differs/iterable_differs';
|
||||
import {IterableDiffer, IterableDifferFactory, TrackByFn} from './iterable_differs';
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class DefaultIterableDifferFactory implements IterableDifferFactory {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {stringify, looseIdentical, isJsObject, isBlank} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {MapWrapper, StringMapWrapper} from '../../../src/facade/collection';
|
||||
import {stringify, looseIdentical, isJsObject, isBlank} from '../../../src/facade/lang';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
import {KeyValueDiffer, KeyValueDifferFactory} from '../differs/keyvalue_differs';
|
||||
import {KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs';
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class DefaultKeyValueDifferFactory implements KeyValueDifferFactory {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {isBlank, isPresent, getTypeNameForDebugging} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {isBlank, isPresent, getTypeNameForDebugging} from '../../../src/facade/lang';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {ListWrapper} from '../../../src/facade/collection';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
import {Provider, SkipSelfMetadata, OptionalMetadata, Injectable} from 'angular2/src/core/di';
|
||||
import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di';
|
||||
|
||||
/**
|
||||
* A strategy for tracking changes over time to an iterable. Used for {@link NgFor} to
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {isBlank, isPresent} from '../../../src/facade/lang';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {ListWrapper} from '../../../src/facade/collection';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
import {Provider, SkipSelfMetadata, OptionalMetadata, Injectable} from 'angular2/src/core/di';
|
||||
import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di';
|
||||
|
||||
/**
|
||||
* A differ that tracks changes made to an object over time.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* The `RepeatPipe` below repeats the value as many times as indicated by the first argument:
|
||||
*
|
||||
* ```
|
||||
* import {Pipe, PipeTransform} from 'angular2/core';
|
||||
* import {Pipe, PipeTransform} from '@angular/core';
|
||||
*
|
||||
* @Pipe({name: 'repeat'})
|
||||
* export class RepeatPipe implements PipeTransform {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {print, warn} from 'angular2/src/facade/lang';
|
||||
import {print, warn} from './facade/lang';
|
||||
import {Injectable} from './di/decorators';
|
||||
|
||||
// Note: Need to rename warn as in Dart
|
||||
// class members and imports can't use the same name.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {isPresent, Type} from 'angular2/src/facade/lang';
|
||||
import {Predicate, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injector} from 'angular2/src/core/di';
|
||||
import {RenderDebugInfo} from 'angular2/src/core/render/api';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
import {Predicate, ListWrapper, MapWrapper} from '../../src/facade/collection';
|
||||
import {Injector} from '../di';
|
||||
import {RenderDebugInfo} from '../render/api';
|
||||
|
||||
export class EventListener { constructor(public name: string, public callback: Function){}; }
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
import {
|
||||
Renderer,
|
||||
RootRenderer,
|
||||
RenderComponentType,
|
||||
RenderDebugInfo
|
||||
} from 'angular2/src/core/render/api';
|
||||
} from '../render/api';
|
||||
import {
|
||||
DebugNode,
|
||||
DebugElement,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
getDebugNode,
|
||||
indexDebugNode,
|
||||
removeDebugNodeFromIndex
|
||||
} from 'angular2/src/core/debug/debug_node';
|
||||
} from './debug_node';
|
||||
|
||||
export class DebugDomRootRenderer implements RootRenderer {
|
||||
constructor(private _delegate: RootRenderer) {}
|
||||
|
||||
@@ -85,4 +85,4 @@ export var Host: HostMetadataFactory = makeParamDecorator(HostMetadata);
|
||||
/**
|
||||
* Factory for creating {@link SkipSelfMetadata}.
|
||||
*/
|
||||
export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata);
|
||||
export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Type, stringify, isFunction} from 'angular2/src/facade/lang';
|
||||
import {Type, stringify, isFunction} from '../../src/facade/lang';
|
||||
|
||||
/**
|
||||
* An interface that a function passed into {@link forwardRef} has to implement.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
|
||||
const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object();
|
||||
export const THROW_IF_NOT_FOUND = /*@ts2dart_const*/ _THROW_IF_NOT_FOUND;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {stringify, isBlank, isPresent} from "angular2/src/facade/lang";
|
||||
import {stringify} from '../../src/facade/lang';
|
||||
|
||||
/**
|
||||
* A parameter metadata that specifies a dependency.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* Creates a token that can be used in a DI Provider.
|
||||
*
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
isBlank,
|
||||
isFunction,
|
||||
stringify
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
|
||||
/**
|
||||
* Describes how the {@link Injector} should instantiate a given token.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import './provider.dart' show Provider;
|
||||
|
||||
bool isProviderLiteral(dynamic obj) {
|
||||
if (obj is Map) {
|
||||
Map map = obj as Map;
|
||||
return map.containsKey('provide');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Provider createProvider(dynamic obj) {
|
||||
Map map = obj as Map;
|
||||
return new Provider(map['provide'], useClass: map['useClass'],
|
||||
useValue: map['useValue'],
|
||||
useExisting: map['useExisting'],
|
||||
useFactory: map['useFactory'],
|
||||
deps: map['deps'],
|
||||
multi: map['multi']);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import {Provider} from './provider';
|
||||
|
||||
export function isProviderLiteral(obj: any): boolean {
|
||||
return obj && typeof obj == 'object' && obj.provide;
|
||||
}
|
||||
|
||||
export function createProvider(obj: any): Provider {
|
||||
return new Provider(obj.provide, obj);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {stringify, isBlank} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException, unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {stringify, isBlank} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {ReflectiveInjector} from './reflective_injector';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Provider, ProviderBuilder, provide} from './provider';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {Provider} from './provider';
|
||||
import {
|
||||
ResolvedReflectiveProvider,
|
||||
ReflectiveDependency,
|
||||
@@ -11,13 +11,12 @@ import {
|
||||
NoProviderError,
|
||||
CyclicDependencyError,
|
||||
InstantiationError,
|
||||
InvalidProviderError,
|
||||
OutOfBoundsError
|
||||
} from './reflective_exceptions';
|
||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||
import {BaseException, unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {Type} from '../../src/facade/lang';
|
||||
import {BaseException, unimplemented} from '../../src/facade/exceptions';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {SelfMetadata, HostMetadata, SkipSelfMetadata} from './metadata';
|
||||
import {SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||
import {Injector, THROW_IF_NOT_FOUND} from './injector';
|
||||
|
||||
var __unused: Type; // avoid unused import when Type union types are erased
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {stringify, Type, isBlank} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {stringify, isBlank} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import {Type, isBlank, isPresent, isArray, isType} from 'angular2/src/facade/lang';
|
||||
import {MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||
import {
|
||||
Type,
|
||||
isBlank,
|
||||
isPresent,
|
||||
isArray,
|
||||
} from '../../src/facade/lang';
|
||||
import {MapWrapper, ListWrapper} from '../../src/facade/collection';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {
|
||||
InjectMetadata,
|
||||
InjectableMetadata,
|
||||
OptionalMetadata,
|
||||
SelfMetadata,
|
||||
HostMetadata,
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../facade/src
|
||||
@@ -7,4 +7,4 @@ export {TemplateRef} from './linker/template_ref';
|
||||
export {EmbeddedViewRef, ViewRef} from './linker/view_ref';
|
||||
export {ViewContainerRef} from './linker/view_container_ref';
|
||||
export {ComponentRef, ComponentFactory} from './linker/component_factory';
|
||||
export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions';
|
||||
export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {Injector} from 'angular2/src/core/di';
|
||||
import {Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {Type, isPresent, isBlank} from '../../src/facade/lang';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {ViewRef, ViewRef_} from './view_ref';
|
||||
import {AppElement} from './element';
|
||||
import {ViewUtils} from './view_utils';
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
/**
|
||||
* Represents an instance of a Component created via a {@link ComponentFactory}.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {Type, isBlank, stringify} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||
import {Type, isBlank, stringify} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {PromiseWrapper} from '../../src/facade/async';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {Injectable} from '../di/decorators';
|
||||
|
||||
/**
|
||||
* Low-level service for loading {@link ComponentFactory}s, which
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injector} from 'angular2/src/core/di';
|
||||
import {RenderDebugInfo} from 'angular2/src/core/render/api';
|
||||
import {DebugAppView} from './view';
|
||||
import {isPresent, isBlank} from '../../src/facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from '../../src/facade/collection';
|
||||
import {Injector} from '../di';
|
||||
import {ViewType} from './view_type';
|
||||
import {RenderDebugInfo} from '../render/api';
|
||||
import {DebugAppView} from './view';
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class StaticNodeDebugInfo {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import {
|
||||
Injector,
|
||||
ResolvedReflectiveProvider,
|
||||
Injectable,
|
||||
ReflectiveInjector
|
||||
} from 'angular2/src/core/di';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
import {isType, Type, stringify, isPresent} from 'angular2/src/facade/lang';
|
||||
import {Type, isPresent} from '../../src/facade/lang';
|
||||
import {ComponentRef} from './component_factory';
|
||||
import {ViewContainerRef} from './view_container_ref';
|
||||
import {ResolvedReflectiveProvider} from '../di/reflective_provider';
|
||||
import {ReflectiveInjector} from '../di/reflective_injector';
|
||||
import {Injectable} from '../di/decorators';
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
/**
|
||||
* Use ComponentResolver and ViewContainerRef directly.
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import {isPresent, isBlank, Type} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
|
||||
import {Injector} from 'angular2/src/core/di';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
|
||||
import {AppView} from './view';
|
||||
import {ViewType} from './view_type';
|
||||
import {ElementRef} from './element_ref';
|
||||
|
||||
import {ViewContainerRef, ViewContainerRef_} from './view_container_ref';
|
||||
import {ViewContainerRef_} from './view_container_ref';
|
||||
|
||||
import {QueryList} from './query_list';
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
/**
|
||||
* An AppElement is created for elements that have a ViewContainerRef,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injector, THROW_IF_NOT_FOUND} from 'angular2/src/core/di/injector';
|
||||
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
||||
import {AppView} from './view';
|
||||
|
||||
const _UNDEFINED = /*@ts2dart_const*/ new Object();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {BaseException, WrappedException} from "angular2/src/facade/exceptions";
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
|
||||
/**
|
||||
* An error thrown if application changes model breaking the top-down data flow.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {getSymbolIterator} from 'angular2/src/facade/lang';
|
||||
import {Observable, EventEmitter} from 'angular2/src/facade/async';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {getSymbolIterator} from '../../src/facade/lang';
|
||||
import {Observable, EventEmitter} from '../../src/facade/async';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {isBlank} from '../facade/lang';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {AppElement} from './element';
|
||||
import {AppView} from './view';
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import {
|
||||
ListWrapper,
|
||||
MapWrapper,
|
||||
Map,
|
||||
StringMapWrapper,
|
||||
isListLikeIterable,
|
||||
areIterablesEqual
|
||||
} from 'angular2/src/facade/collection';
|
||||
} from '../../src/facade/collection';
|
||||
|
||||
import {Injector} from 'angular2/src/core/di';
|
||||
import {AppElement} from './element';
|
||||
import {
|
||||
assertionsEnabled,
|
||||
@@ -19,15 +14,10 @@ import {
|
||||
stringify,
|
||||
isPrimitive,
|
||||
isString
|
||||
} from 'angular2/src/facade/lang';
|
||||
} from '../../src/facade/lang';
|
||||
|
||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {
|
||||
Renderer,
|
||||
RootRenderer,
|
||||
RenderComponentType,
|
||||
RenderDebugInfo
|
||||
} from 'angular2/src/core/render/api';
|
||||
import {ObservableWrapper} from '../../src/facade/async';
|
||||
import {Renderer, RootRenderer, RenderComponentType, RenderDebugInfo} from '../render/api';
|
||||
import {ViewRef_} from './view_ref';
|
||||
|
||||
import {ViewType} from './view_type';
|
||||
@@ -42,9 +32,7 @@ import {
|
||||
ChangeDetectorRef,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorState,
|
||||
isDefaultChangeDetectionStrategy,
|
||||
devModeEqual
|
||||
} from 'angular2/src/core/change_detection/change_detection';
|
||||
} from '../change_detection/change_detection';
|
||||
import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile';
|
||||
import {
|
||||
ExpressionChangedAfterItHasBeenCheckedException,
|
||||
@@ -53,6 +41,7 @@ import {
|
||||
} from './exceptions';
|
||||
import {StaticNodeDebugInfo, DebugContext} from './debug_context';
|
||||
import {ElementInjector} from './element_injector';
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
var _scope_check: WtfScopeFn = wtfCreateScope(`AppView#check(ascii id)`);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {Injector} from 'angular2/src/core/di/injector';
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {Injector} from '../di/injector';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile';
|
||||
|
||||
import {AppElement} from './element';
|
||||
|
||||
import {ElementRef} from './element_ref';
|
||||
import {TemplateRef, TemplateRef_} from './template_ref';
|
||||
import {TemplateRef} from './template_ref';
|
||||
import {EmbeddedViewRef, ViewRef, ViewRef_} from './view_ref';
|
||||
import {ComponentFactory, ComponentRef} from './component_factory';
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||
import {AppView} from './view';
|
||||
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/constants';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
|
||||
export abstract class ViewRef {
|
||||
get destroyed(): boolean { return <boolean>unimplemented(); }
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import {isBlank, isPresent, Type, stringify, looseIdentical} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {
|
||||
isBlank,
|
||||
isPresent,
|
||||
looseIdentical
|
||||
} from '../../src/facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from '../../src/facade/collection';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {AppElement} from './element';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedException} from './exceptions';
|
||||
import {devModeEqual, uninitialized} from 'angular2/src/core/change_detection/change_detection';
|
||||
import {Inject, Injectable} from 'angular2/src/core/di';
|
||||
import {RootRenderer, RenderComponentType, Renderer} from 'angular2/src/core/render/api';
|
||||
import {APP_ID} from 'angular2/src/core/application_tokens';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||
import {devModeEqual} from '../change_detection/change_detection';
|
||||
import {RootRenderer, RenderComponentType, Renderer} from '../render/api';
|
||||
import {APP_ID} from '../application_tokens';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Injectable, Inject} from '../di/decorators';
|
||||
import {uninitialized} from "../change_detection/change_detection_util";
|
||||
|
||||
@Injectable()
|
||||
export class ViewUtils {
|
||||
|
||||
@@ -57,16 +57,15 @@ import {
|
||||
} from './metadata/directives';
|
||||
|
||||
import {ViewMetadata, ViewEncapsulation} from './metadata/view';
|
||||
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/change_detection';
|
||||
import {ChangeDetectionStrategy} from './change_detection/change_detection';
|
||||
|
||||
import {
|
||||
makeDecorator,
|
||||
makeParamDecorator,
|
||||
makePropDecorator,
|
||||
TypeDecorator,
|
||||
Class
|
||||
} from './util/decorators';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Type} from '../src/facade/lang';
|
||||
|
||||
/**
|
||||
* Interface for the {@link DirectiveMetadata} decorator function.
|
||||
@@ -262,7 +261,7 @@ export interface ComponentMetadataFactory {
|
||||
* ### Example as TypeScript Decorator
|
||||
*
|
||||
* ```
|
||||
* import {Component, View} from "angular2/core";
|
||||
* import {Component, View} from '@angular/core';
|
||||
*
|
||||
* @Component({...})
|
||||
* class MyComponent {
|
||||
@@ -364,7 +363,7 @@ export interface AttributeMetadataFactory {
|
||||
* ### Example as TypeScript Decorator
|
||||
*
|
||||
* ```
|
||||
* import {Query, QueryList, Component} from "angular2/core";
|
||||
* import {Query, QueryList, Component} from '@angular/core';
|
||||
*
|
||||
* @Component({...})
|
||||
* class MyComponent {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Type, stringify, isPresent, isString} from 'angular2/src/facade/lang';
|
||||
import {resolveForwardRef} from 'angular2/src/core/di';
|
||||
import {DependencyMetadata} from 'angular2/src/core/di/metadata';
|
||||
import {stringify, isString, Type} from '../../src/facade/lang';
|
||||
import {DependencyMetadata} from '../di/metadata';
|
||||
import {resolveForwardRef} from '../di/forward_ref';
|
||||
|
||||
/**
|
||||
* Specifies that a constant attribute value should be injected.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {isPresent, Type} from 'angular2/src/facade/lang';
|
||||
import {InjectableMetadata} from 'angular2/src/core/di/metadata';
|
||||
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||
import {isPresent, Type} from '../../src/facade/lang';
|
||||
import {InjectableMetadata} from '../di/metadata';
|
||||
import {ViewEncapsulation} from './view';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
|
||||
/**
|
||||
* Directives allow you to attach behavior to elements in the DOM.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {SimpleChange} from 'angular2/src/core/change_detection/change_detection_util';
|
||||
import {SimpleChange} from '../change_detection/change_detection_util';
|
||||
|
||||
export enum LifecycleHooks {
|
||||
OnInit,
|
||||
@@ -242,7 +242,7 @@ export interface DoCheck { ngDoCheck(); }
|
||||
* the interval when the binding is destroyed or the countdown completes.
|
||||
*
|
||||
* ```
|
||||
* import {OnDestroy, Pipe, PipeTransform} from 'angular2/core'
|
||||
* import {OnDestroy, Pipe, PipeTransform} from '@angular/core'
|
||||
* @Pipe({name: 'countdown', pure: false})
|
||||
* class CountDown implements PipeTransform, OnDestroy {
|
||||
* remainingTime:Number;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Type} from '../../src/facade/lang';
|
||||
|
||||
/**
|
||||
* Defines template and style encapsulation options available for Component's {@link View}.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Provider} from 'angular2/src/core/di';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {Type, isBlank, isPresent, assertionsEnabled} from '../src/facade/lang';
|
||||
import {provide, Provider, Injector, OpaqueToken} from './di';
|
||||
import {Console} from './console';
|
||||
import {Reflector, reflector} from './reflection/reflection';
|
||||
import {ReflectorReader} from './reflection/reflector_reader';
|
||||
import {TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||
import {TestabilityRegistry} from './testability/testability';
|
||||
import {PLATFORM_CORE_PROVIDERS} from './application_ref';
|
||||
|
||||
function _reflector(): Reflector {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {OpaqueToken} from "angular2/src/core/di";
|
||||
import {OpaqueToken} from './di';
|
||||
|
||||
/**
|
||||
* A token that can be provided when bootstraping an application to make an array of directives
|
||||
@@ -7,7 +7,7 @@ import {OpaqueToken} from "angular2/src/core/di";
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* import {PLATFORM_DIRECTIVES} from 'angular2/core';
|
||||
* import {PLATFORM_DIRECTIVES} from '@angular/core';
|
||||
* import {OtherDirective} from './myDirectives';
|
||||
*
|
||||
* @Component({
|
||||
@@ -34,7 +34,7 @@ export const PLATFORM_DIRECTIVES: OpaqueToken =
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* import {PLATFORM_PIPES} from 'angular2/core';
|
||||
* import {PLATFORM_PIPES} from '@angular/core';
|
||||
* import {OtherPipe} from './myPipe';
|
||||
*
|
||||
* @Component({
|
||||
|
||||
@@ -1 +1 @@
|
||||
export {enableProdMode} from 'angular2/src/facade/lang';
|
||||
export {enableProdMode} from '../src/facade/lang';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export {WtfScopeFn} from './wtf_impl';
|
||||
|
||||
import * as impl from "./wtf_impl";
|
||||
import * as impl from './wtf_impl';
|
||||
|
||||
// Change exports to const once https://github.com/angular/ts2dart/issues/150
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
import {global} from '../../src/facade/lang';
|
||||
|
||||
/**
|
||||
* A scope function for the Web Tracing Framework (WTF).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Type} from '../../src/facade/lang';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
|
||||
export interface PlatformReflectionCapabilities {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Reflector} from './reflector';
|
||||
export {Reflector, ReflectionInfo} from './reflector';
|
||||
import {ReflectionCapabilities} from './reflection_capabilities';
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
global,
|
||||
stringify,
|
||||
ConcreteType
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Type, isPresent, stringify} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {Type, isPresent, stringify} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {
|
||||
ListWrapper,
|
||||
Map,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
Set,
|
||||
SetWrapper,
|
||||
StringMapWrapper
|
||||
} from 'angular2/src/facade/collection';
|
||||
} from '../../src/facade/collection';
|
||||
import {SetterFn, GetterFn, MethodFn} from './types';
|
||||
import {ReflectorReader} from './reflector_reader';
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
|
||||
export type SetterFn = (obj: any, value: any) => void;
|
||||
export type GetterFn = (obj: any) => any;
|
||||
export type MethodFn = (obj: any, args: any[]) => any;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||
import {Injector, Injectable} from 'angular2/src/core/di';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
export class RenderComponentType {
|
||||
constructor(public id: string, public templateUrl: string, public slotCount: number,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {scheduleMicroTask} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {Map, MapWrapper} from '../../src/facade/collection';
|
||||
import {scheduleMicroTask} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {NgZone} from '../zone/ng_zone';
|
||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {ObservableWrapper} from '../../src/facade/async';
|
||||
import {Injectable} from '../di/decorators';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Public API for util
|
||||
export {Class, ClassDefinition, TypeDecorator} from './util/decorators';
|
||||
export {Class, ClassDefinition, TypeDecorator} from './util/decorators';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ConcreteType, global, Type, isFunction, stringify} from 'angular2/src/facade/lang';
|
||||
import {ConcreteType, global, Type, isFunction, stringify} from '../../src/facade/lang';
|
||||
|
||||
var _nextClassId = 0;
|
||||
|
||||
@@ -222,7 +222,7 @@ export function Class(clsDef: ClassDefinition): ConcreteType {
|
||||
}
|
||||
for (var key in clsDef) {
|
||||
if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) {
|
||||
proto[key] = applyParams(clsDef[key], key);
|
||||
proto[key] = applyParams(<any>clsDef[key], key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {EventEmitter} from 'angular2/src/facade/async';
|
||||
import {EventEmitter} from '../../src/facade/async';
|
||||
import {NgZoneImpl, NgZoneError} from './ng_zone_impl';
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
export {NgZoneError} from './ng_zone_impl';
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ export {NgZoneError} from './ng_zone_impl';
|
||||
*
|
||||
* ### Example ([live demo](http://plnkr.co/edit/lY9m8HLy7z06vDoUaSN2?p=preview))
|
||||
* ```
|
||||
* import {Component, View, NgZone} from 'angular2/core';
|
||||
* import {NgIf} from 'angular2/common';
|
||||
* import {Component, View, NgZone} from '@angular/core';
|
||||
* import {NgIf} from '@angular/common';
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'ng-zone-demo'.
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
|
||||
/**
|
||||
* Stores error information; delivered via [NgZone.onError] stream.
|
||||
*/
|
||||
@@ -90,7 +88,7 @@ export class NgZoneImpl {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error('Angular2 needs to be run with Zone.js polyfill.');
|
||||
throw new Error('Angular requires Zone.js polyfill.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,21 +7,17 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
el,
|
||||
AsyncTestCompleter,
|
||||
fakeAsync,
|
||||
tick,
|
||||
inject,
|
||||
SpyObject
|
||||
} from 'angular2/testing_internal';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {Type} from '@angular/core';
|
||||
import {SpyChangeDetectorRef} from './spies';
|
||||
import {
|
||||
ApplicationRef_,
|
||||
ApplicationRef,
|
||||
PLATFORM_CORE_PROVIDERS,
|
||||
APPLICATION_CORE_PROVIDERS
|
||||
} from "angular2/src/core/application_ref";
|
||||
} from '@angular/core/src/application_ref';
|
||||
import {
|
||||
Injector,
|
||||
Provider,
|
||||
@@ -35,16 +31,16 @@ import {
|
||||
disposePlatform,
|
||||
ComponentResolver,
|
||||
ChangeDetectorRef
|
||||
} from "angular2/core";
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {PromiseWrapper, PromiseCompleter, TimerWrapper} from "angular2/src/facade/async";
|
||||
} from '@angular/core';
|
||||
import {Console} from '@angular/core/src/console';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {PromiseWrapper, PromiseCompleter, TimerWrapper} from '../src/facade/async';
|
||||
import {
|
||||
ComponentFactory,
|
||||
ComponentRef_,
|
||||
ComponentRef
|
||||
} from 'angular2/src/core/linker/component_factory';
|
||||
import {ExceptionHandler} from 'angular2/src/facade/exception_handler';
|
||||
} from '@angular/core/src/linker/component_factory';
|
||||
import {ExceptionHandler} from '../src/facade/exception_handler';
|
||||
|
||||
export function main() {
|
||||
describe("bootstrap", () => {
|
||||
@@ -66,8 +62,8 @@ export function main() {
|
||||
var appInjector = ReflectiveInjector.resolveAndCreate(
|
||||
[
|
||||
APPLICATION_CORE_PROVIDERS,
|
||||
new Provider(Console, {useValue: new _MockConsole()}),
|
||||
new Provider(ExceptionHandler, {useValue: new ExceptionHandler(errorLogger, false)}),
|
||||
{provide: Console, useValue: new _MockConsole()},
|
||||
{provide: ExceptionHandler, useValue: new ExceptionHandler(errorLogger, false)},
|
||||
new Provider(ComponentResolver,
|
||||
{useValue: new _MockComponentResolver(someCompFactory)}),
|
||||
providers
|
||||
@@ -117,8 +113,8 @@ export function main() {
|
||||
initializerDone = true;
|
||||
}, 1);
|
||||
var app = createApplication(
|
||||
[new Provider(APP_INITIALIZER, {useValue: () => completer.promise, multi: true})]);
|
||||
coreLoadAndBootstrap(app.injector, MyComp)
|
||||
[{provide: APP_INITIALIZER, useValue: () => completer.promise, multi: true}]);
|
||||
coreLoadAndBootstrap(app.injector, MyComp6)
|
||||
.then((compRef) => {
|
||||
expect(initializerDone).toBe(true);
|
||||
async.done();
|
||||
@@ -142,7 +138,7 @@ export function main() {
|
||||
}
|
||||
|
||||
@Component({selector: 'my-comp', template: ''})
|
||||
class MyComp {
|
||||
class MyComp6 {
|
||||
}
|
||||
|
||||
class _ArrayLogger {
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {devModeEqual} from 'angular2/src/core/change_detection/change_detection_util';
|
||||
import {devModeEqual} from '@angular/core/src/change_detection/change_detection_util';
|
||||
|
||||
export function main() {
|
||||
describe("ChangeDetectionUtil", () => {
|
||||
|
||||
@@ -7,17 +7,17 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
DefaultIterableDiffer,
|
||||
DefaultIterableDifferFactory
|
||||
} from 'angular2/src/core/change_detection/differs/default_iterable_differ';
|
||||
} from '@angular/core/src/change_detection/differs/default_iterable_differ';
|
||||
|
||||
import {NumberWrapper} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {NumberWrapper} from '../../../src/facade/lang';
|
||||
import {ListWrapper} from '../../../src/facade/collection';
|
||||
|
||||
import {TestIterable} from '../../../core/change_detection/iterable';
|
||||
import {iterableChangesAsString} from '../../../core/change_detection/util';
|
||||
import {TestIterable} from '../../change_detection/iterable';
|
||||
import {iterableChangesAsString} from '../../change_detection/util';
|
||||
|
||||
class ItemWithId {
|
||||
constructor(private id: string) {}
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
DefaultKeyValueDiffer,
|
||||
DefaultKeyValueDifferFactory
|
||||
} from 'angular2/src/core/change_detection/differs/default_keyvalue_differ';
|
||||
import {NumberWrapper, isJsObject} from 'angular2/src/facade/lang';
|
||||
import {kvChangesAsString} from '../../../core/change_detection/util';
|
||||
} from '@angular/core/src/change_detection/differs/default_keyvalue_differ';
|
||||
import {NumberWrapper, isJsObject} from '../../../src/facade/lang';
|
||||
import {kvChangesAsString} from '../../change_detection/util';
|
||||
|
||||
// todo(vicb): Update the code & tests for object equality
|
||||
export function main() {
|
||||
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {SpyIterableDifferFactory} from '../../spies';
|
||||
import {IterableDiffers} from 'angular2/src/core/change_detection/differs/iterable_differs';
|
||||
import {Injector, provide, ReflectiveInjector} from 'angular2/core';
|
||||
import {IterableDiffers} from '@angular/core/src/change_detection/differs/iterable_differs';
|
||||
import {Injector, provide, ReflectiveInjector} from '@angular/core';
|
||||
|
||||
export function main() {
|
||||
describe('IterableDiffers', function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {getSymbolIterator} from 'angular2/src/facade/lang';
|
||||
import {getSymbolIterator} from '../../src/facade/lang';
|
||||
|
||||
export class TestIterable {
|
||||
list: number[];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
|
||||
export function iterableChangesAsString(
|
||||
{collection = /*@ts2dart_const*/[], previous = /*@ts2dart_const*/[],
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {PromiseWrapper, EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {PromiseWrapper, EventEmitter, ObservableWrapper} from '../../src/facade/async';
|
||||
|
||||
import {Injectable} from 'angular2/core';
|
||||
import {NgFor, NgIf} from 'angular2/common';
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {NgFor, NgIf} from '@angular/common';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
|
||||
import {Directive, Component, Input} from 'angular2/src/core/metadata';
|
||||
import {Directive, Component, Input} from '@angular/core/src/metadata';
|
||||
|
||||
@Injectable()
|
||||
class Logger {
|
||||
log: string[];
|
||||
logs: string[];
|
||||
|
||||
constructor() { this.log = []; }
|
||||
constructor() { this.logs = []; }
|
||||
|
||||
add(thing: string) { this.log.push(thing); }
|
||||
add(thing: string) { this.logs.push(thing); }
|
||||
}
|
||||
|
||||
@Directive({selector: '[message]', inputs: ['message']})
|
||||
@@ -208,24 +207,24 @@ export function main() {
|
||||
|
||||
// The root component has 3 elements in its view.
|
||||
expect(childEls.length).toEqual(3);
|
||||
expect(DOM.hasClass(childEls[0].nativeElement, 'parent')).toBe(true);
|
||||
expect(DOM.hasClass(childEls[1].nativeElement, 'parent')).toBe(true);
|
||||
expect(DOM.hasClass(childEls[2].nativeElement, 'child-comp-class')).toBe(true);
|
||||
expect(getDOM().hasClass(childEls[0].nativeElement, 'parent')).toBe(true);
|
||||
expect(getDOM().hasClass(childEls[1].nativeElement, 'parent')).toBe(true);
|
||||
expect(getDOM().hasClass(childEls[2].nativeElement, 'child-comp-class')).toBe(true);
|
||||
|
||||
var nested = childEls[0].children;
|
||||
expect(nested.length).toEqual(1);
|
||||
expect(DOM.hasClass(nested[0].nativeElement, 'parentnested')).toBe(true);
|
||||
expect(getDOM().hasClass(nested[0].nativeElement, 'parentnested')).toBe(true);
|
||||
|
||||
var childComponent = childEls[2];
|
||||
|
||||
var childCompChildren = childComponent.children;
|
||||
expect(childCompChildren.length).toEqual(2);
|
||||
expect(DOM.hasClass(childCompChildren[0].nativeElement, 'child')).toBe(true);
|
||||
expect(DOM.hasClass(childCompChildren[1].nativeElement, 'child')).toBe(true);
|
||||
expect(getDOM().hasClass(childCompChildren[0].nativeElement, 'child')).toBe(true);
|
||||
expect(getDOM().hasClass(childCompChildren[1].nativeElement, 'child')).toBe(true);
|
||||
|
||||
var childNested = childCompChildren[0].children;
|
||||
expect(childNested.length).toEqual(1);
|
||||
expect(DOM.hasClass(childNested[0].nativeElement, 'childnested')).toBe(true);
|
||||
expect(getDOM().hasClass(childNested[0].nativeElement, 'childnested')).toBe(true);
|
||||
|
||||
async.done();
|
||||
});
|
||||
@@ -241,8 +240,8 @@ export function main() {
|
||||
|
||||
// The root component has 2 elements in its view.
|
||||
expect(childEls.length).toEqual(2);
|
||||
expect(DOM.hasClass(childEls[0].nativeElement, 'parent')).toBe(true);
|
||||
expect(DOM.hasClass(childEls[1].nativeElement, 'cond-content-comp-class'))
|
||||
expect(getDOM().hasClass(childEls[0].nativeElement, 'parent')).toBe(true);
|
||||
expect(getDOM().hasClass(childEls[1].nativeElement, 'cond-content-comp-class'))
|
||||
.toBe(true);
|
||||
|
||||
var conditionalContentComp = childEls[1];
|
||||
@@ -295,7 +294,7 @@ export function main() {
|
||||
var childTestEls = fixture.debugElement.queryAll(By.css('child-comp'));
|
||||
|
||||
expect(childTestEls.length).toBe(1);
|
||||
expect(DOM.hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true);
|
||||
expect(getDOM().hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true);
|
||||
|
||||
async.done();
|
||||
});
|
||||
@@ -310,10 +309,10 @@ export function main() {
|
||||
var childTestEls = fixture.debugElement.queryAll(By.directive(MessageDir));
|
||||
|
||||
expect(childTestEls.length).toBe(4);
|
||||
expect(DOM.hasClass(childTestEls[0].nativeElement, 'parent')).toBe(true);
|
||||
expect(DOM.hasClass(childTestEls[1].nativeElement, 'parentnested')).toBe(true);
|
||||
expect(DOM.hasClass(childTestEls[2].nativeElement, 'child')).toBe(true);
|
||||
expect(DOM.hasClass(childTestEls[3].nativeElement, 'childnested')).toBe(true);
|
||||
expect(getDOM().hasClass(childTestEls[0].nativeElement, 'parent')).toBe(true);
|
||||
expect(getDOM().hasClass(childTestEls[1].nativeElement, 'parentnested')).toBe(true);
|
||||
expect(getDOM().hasClass(childTestEls[2].nativeElement, 'child')).toBe(true);
|
||||
expect(getDOM().hasClass(childTestEls[3].nativeElement, 'childnested')).toBe(true);
|
||||
|
||||
async.done();
|
||||
});
|
||||
@@ -351,7 +350,7 @@ export function main() {
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect((<Logger>(fixture.debugElement.children[0].inject(Logger))).log)
|
||||
expect((<Logger>(fixture.debugElement.children[0].inject(Logger))).logs)
|
||||
.toEqual(['parent', 'nestedparent', 'child', 'nestedchild']);
|
||||
|
||||
async.done();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@@ -9,9 +8,9 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '../testing';
|
||||
|
||||
import {assertionsEnabled, IS_DART} from 'angular2/src/facade/lang';
|
||||
import {assertionsEnabled, IS_DART} from '../../router/src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe('dev mode', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
library angular2.test.di.binding_dart_spec;
|
||||
|
||||
import 'dart:mirrors';
|
||||
import 'package:angular2/testing_internal.dart';
|
||||
import 'package:@angular/core/testing/testing_internal.dart';
|
||||
import 'package:angular2/core.dart';
|
||||
|
||||
main() {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@@ -8,9 +7,9 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {bind, provide} from 'angular2/core';
|
||||
import {bind, provide} from '@angular/core';
|
||||
|
||||
export function main() {
|
||||
describe('provider', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@@ -8,9 +7,9 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
} from 'angular2/testing_internal';
|
||||
import {forwardRef, resolveForwardRef} from 'angular2/src/core/di';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {forwardRef, resolveForwardRef} from '@angular/core/src/di';
|
||||
import {Type} from '../../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe("forwardRef", function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {isBlank, stringify, isPresent} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {describe, ddescribe, it, iit, expect, beforeEach} from 'angular2/testing_internal';
|
||||
import {isBlank, stringify, isPresent} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {describe, ddescribe, it, iit, expect, beforeEach} from '@angular/core/testing';
|
||||
import {
|
||||
provide,
|
||||
ReflectiveKey,
|
||||
@@ -14,15 +14,15 @@ import {
|
||||
Optional,
|
||||
Inject,
|
||||
Provider
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ReflectiveInjector_,
|
||||
ReflectiveInjectorInlineStrategy,
|
||||
ReflectiveInjectorDynamicStrategy,
|
||||
ReflectiveProtoInjector
|
||||
} from 'angular2/src/core/di/reflective_injector';
|
||||
import {DependencyMetadata} from 'angular2/src/core/di/metadata';
|
||||
import {ResolvedReflectiveProvider_} from 'angular2/src/core/di/reflective_provider';
|
||||
} from '@angular/core/src/di/reflective_injector';
|
||||
import {DependencyMetadata} from '@angular/core/src/di/metadata';
|
||||
import {ResolvedReflectiveProvider_} from '@angular/core/src/di/reflective_provider';
|
||||
|
||||
class CustomDependencyMetadata extends DependencyMetadata {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {describe, iit, it, expect, beforeEach} from 'angular2/testing_internal';
|
||||
import {ReflectiveKey, KeyRegistry} from 'angular2/src/core/di/reflective_key';
|
||||
import {describe, iit, it, expect, beforeEach} from '@angular/core/testing';
|
||||
import {ReflectiveKey, KeyRegistry} from '@angular/core/src/di/reflective_key';
|
||||
|
||||
export function main() {
|
||||
describe("key", function() {
|
||||
@@ -17,4 +17,4 @@ export function main() {
|
||||
function() { expect(registry.get(registry.get('car'))).toBe(registry.get('car')); });
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@@ -9,9 +8,10 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit,
|
||||
Log,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import { Log } from '@angular/core/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
|
||||
import {
|
||||
OnChanges,
|
||||
@@ -21,8 +21,8 @@ import {
|
||||
AfterContentChecked,
|
||||
AfterViewInit,
|
||||
AfterViewChecked
|
||||
} from 'angular2/core';
|
||||
import {Directive, Component, ViewMetadata} from 'angular2/src/core/metadata';
|
||||
} from '@angular/core';
|
||||
import {Directive, Component, ViewMetadata} from '@angular/core/src/metadata';
|
||||
|
||||
export function main() {
|
||||
describe('directive lifecycle integration spec', () => {
|
||||
@@ -31,10 +31,10 @@ export function main() {
|
||||
inject([TestComponentBuilder, Log, AsyncTestCompleter], (tcb: TestComponentBuilder, log: Log,
|
||||
async) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
MyComp5,
|
||||
new ViewMetadata(
|
||||
{template: '<div [field]="123" lifecycle></div>', directives: [LifecycleCmp]}))
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp5)
|
||||
.then((tc) => {
|
||||
tc.detectChanges();
|
||||
|
||||
@@ -90,5 +90,5 @@ class LifecycleCmp implements OnChanges,
|
||||
}
|
||||
|
||||
@Component({selector: 'my-comp', directives: []})
|
||||
class MyComp {
|
||||
class MyComp5 {
|
||||
}
|
||||
|
||||
@@ -1,103 +1,100 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
beforeEachProviders,
|
||||
SpyObject,
|
||||
stringifyElement
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {el, stringifyElement} from '@angular/platform-browser/testing';
|
||||
|
||||
export function main() {
|
||||
describe('dom adapter', () => {
|
||||
it('should not coalesque text nodes', () => {
|
||||
var el1 = el('<div>a</div>');
|
||||
var el2 = el('<div>b</div>');
|
||||
DOM.appendChild(el2, DOM.firstChild(el1));
|
||||
expect(DOM.childNodes(el2).length).toBe(2);
|
||||
getDOM().appendChild(el2, getDOM().firstChild(el1));
|
||||
expect(getDOM().childNodes(el2).length).toBe(2);
|
||||
|
||||
var el2Clone = DOM.clone(el2);
|
||||
expect(DOM.childNodes(el2Clone).length).toBe(2);
|
||||
var el2Clone = getDOM().clone(el2);
|
||||
expect(getDOM().childNodes(el2Clone).length).toBe(2);
|
||||
});
|
||||
|
||||
it('should clone correctly', () => {
|
||||
var el1 = el('<div x="y">a<span>b</span></div>');
|
||||
var clone = DOM.clone(el1);
|
||||
var clone = getDOM().clone(el1);
|
||||
|
||||
expect(clone).not.toBe(el1);
|
||||
DOM.setAttribute(clone, 'test', '1');
|
||||
getDOM().setAttribute(clone, 'test', '1');
|
||||
expect(stringifyElement(clone)).toEqual('<div test="1" x="y">a<span>b</span></div>');
|
||||
expect(DOM.getAttribute(el1, 'test')).toBeFalsy();
|
||||
expect(getDOM().getAttribute(el1, 'test')).toBeFalsy();
|
||||
|
||||
var cNodes = DOM.childNodes(clone);
|
||||
var cNodes = getDOM().childNodes(clone);
|
||||
var firstChild = cNodes[0];
|
||||
var secondChild = cNodes[1];
|
||||
expect(DOM.parentElement(firstChild)).toBe(clone);
|
||||
expect(DOM.nextSibling(firstChild)).toBe(secondChild);
|
||||
expect(DOM.isTextNode(firstChild)).toBe(true);
|
||||
expect(getDOM().parentElement(firstChild)).toBe(clone);
|
||||
expect(getDOM().nextSibling(firstChild)).toBe(secondChild);
|
||||
expect(getDOM().isTextNode(firstChild)).toBe(true);
|
||||
|
||||
expect(DOM.parentElement(secondChild)).toBe(clone);
|
||||
expect(DOM.nextSibling(secondChild)).toBeFalsy();
|
||||
expect(DOM.isElementNode(secondChild)).toBe(true);
|
||||
expect(getDOM().parentElement(secondChild)).toBe(clone);
|
||||
expect(getDOM().nextSibling(secondChild)).toBeFalsy();
|
||||
expect(getDOM().isElementNode(secondChild)).toBe(true);
|
||||
|
||||
});
|
||||
|
||||
it('should be able to create text nodes and use them with the other APIs', () => {
|
||||
var t = DOM.createTextNode('hello');
|
||||
expect(DOM.isTextNode(t)).toBe(true);
|
||||
var d = DOM.createElement('div');
|
||||
DOM.appendChild(d, t);
|
||||
expect(DOM.getInnerHTML(d)).toEqual('hello');
|
||||
var t = getDOM().createTextNode('hello');
|
||||
expect(getDOM().isTextNode(t)).toBe(true);
|
||||
var d = getDOM().createElement('div');
|
||||
getDOM().appendChild(d, t);
|
||||
expect(getDOM().getInnerHTML(d)).toEqual('hello');
|
||||
});
|
||||
|
||||
it('should set className via the class attribute', () => {
|
||||
var d = DOM.createElement('div');
|
||||
DOM.setAttribute(d, 'class', 'class1');
|
||||
var d = getDOM().createElement('div');
|
||||
getDOM().setAttribute(d, 'class', 'class1');
|
||||
expect(d.className).toEqual('class1');
|
||||
});
|
||||
|
||||
it('should allow to remove nodes without parents', () => {
|
||||
var d = DOM.createElement('div');
|
||||
expect(() => DOM.remove(d)).not.toThrow();
|
||||
var d = getDOM().createElement('div');
|
||||
expect(() => getDOM().remove(d)).not.toThrow();
|
||||
});
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
describe('getBaseHref', () => {
|
||||
beforeEach(() => DOM.resetBaseElement());
|
||||
beforeEach(() => getDOM().resetBaseElement());
|
||||
|
||||
it('should return null if base element is absent',
|
||||
() => { expect(DOM.getBaseHref()).toBeNull(); });
|
||||
() => { expect(getDOM().getBaseHref()).toBeNull(); });
|
||||
|
||||
it('should return the value of the base element', () => {
|
||||
var baseEl = DOM.createElement('base');
|
||||
DOM.setAttribute(baseEl, 'href', '/drop/bass/connon/');
|
||||
var headEl = DOM.defaultDoc().head;
|
||||
DOM.appendChild(headEl, baseEl);
|
||||
var baseEl = getDOM().createElement('base');
|
||||
getDOM().setAttribute(baseEl, 'href', '/drop/bass/connon/');
|
||||
var headEl = getDOM().defaultDoc().head;
|
||||
getDOM().appendChild(headEl, baseEl);
|
||||
|
||||
var baseHref = DOM.getBaseHref();
|
||||
DOM.removeChild(headEl, baseEl);
|
||||
DOM.resetBaseElement();
|
||||
var baseHref = getDOM().getBaseHref();
|
||||
getDOM().removeChild(headEl, baseEl);
|
||||
getDOM().resetBaseElement();
|
||||
|
||||
expect(baseHref).toEqual('/drop/bass/connon/');
|
||||
});
|
||||
|
||||
it('should return a relative url', () => {
|
||||
var baseEl = DOM.createElement('base');
|
||||
DOM.setAttribute(baseEl, 'href', 'base');
|
||||
var headEl = DOM.defaultDoc().head;
|
||||
DOM.appendChild(headEl, baseEl);
|
||||
var baseEl = getDOM().createElement('base');
|
||||
getDOM().setAttribute(baseEl, 'href', 'base');
|
||||
var headEl = getDOM().defaultDoc().head;
|
||||
getDOM().appendChild(headEl, baseEl);
|
||||
|
||||
var baseHref = DOM.getBaseHref();
|
||||
DOM.removeChild(headEl, baseEl);
|
||||
DOM.resetBaseElement();
|
||||
var baseHref = getDOM().getBaseHref();
|
||||
getDOM().removeChild(headEl, baseEl);
|
||||
getDOM().resetBaseElement();
|
||||
|
||||
expect(baseHref.endsWith('/base')).toBe(true);
|
||||
});
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
export function main() {
|
||||
describe('Shim', () => {
|
||||
|
||||
@@ -6,13 +6,11 @@ import {
|
||||
ddescribe,
|
||||
iit,
|
||||
xit,
|
||||
el,
|
||||
SpyObject,
|
||||
AsyncTestCompleter,
|
||||
inject
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {Observable, Subject, EventEmitter, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {Observable, Subject, EventEmitter, PromiseWrapper} from '../../src/facade/async';
|
||||
|
||||
export function main() {
|
||||
describe("Observable", () => {
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
expect,
|
||||
fakeAsync,
|
||||
flushMicrotasks,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
fakeAsync,
|
||||
flushMicrotasks,
|
||||
Log,
|
||||
tick,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
import {TimerWrapper, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {Parser} from 'angular2/src/compiler/expression_parser/parser';
|
||||
} from '@angular/core/testing';
|
||||
import {TimerWrapper, PromiseWrapper} from '../../router/src/facade/async';
|
||||
import {BaseException} from '../../router/src/facade/exceptions';
|
||||
import {Parser} from '../../compiler/src/expression_parser/parser';
|
||||
|
||||
export function main() {
|
||||
describe('fake async', () => {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
TestComponentBuilder,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@@ -9,7 +7,7 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
bind,
|
||||
provide,
|
||||
@@ -20,10 +18,12 @@ import {
|
||||
Inject,
|
||||
Query,
|
||||
QueryList
|
||||
} from 'angular2/core';
|
||||
import {NgFor} from 'angular2/common';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {asNativeElements} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {NgFor} from '@angular/common';
|
||||
import {Type} from '../src/facade/lang';
|
||||
import {asNativeElements} from '@angular/core';
|
||||
|
||||
export function main() {
|
||||
describe("forwardRef integration", function() {
|
||||
|
||||
@@ -7,17 +7,18 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
tick,
|
||||
fakeAsync,
|
||||
TestComponentBuilder,
|
||||
ComponentFixture,
|
||||
inject,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
fakeAsync,
|
||||
flushMicrotasks,
|
||||
Log,
|
||||
tick,
|
||||
} from '@angular/core/testing';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
|
||||
import {
|
||||
IS_DART,
|
||||
Type,
|
||||
isPresent,
|
||||
isBlank,
|
||||
isNumber,
|
||||
@@ -25,20 +26,21 @@ import {
|
||||
FunctionWrapper,
|
||||
NumberWrapper,
|
||||
normalizeBool
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {MapWrapper, StringMapWrapper} from '../../src/facade/collection';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {
|
||||
PipeTransform,
|
||||
ChangeDetectionStrategy,
|
||||
WrappedValue,
|
||||
} from 'angular2/src/core/change_detection/change_detection';
|
||||
} from '@angular/core/src/change_detection/change_detection';
|
||||
|
||||
import {OnDestroy} from 'angular2/src/core/metadata/lifecycle_hooks';
|
||||
import {OnDestroy} from '@angular/core/src/metadata/lifecycle_hooks';
|
||||
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {IS_DART, Type} from '../../src/facade/lang';
|
||||
import {EventEmitter, ObservableWrapper} from '../../src/facade/async';
|
||||
|
||||
|
||||
import {
|
||||
@@ -65,15 +67,15 @@ import {
|
||||
AfterContentChecked,
|
||||
AfterViewInit,
|
||||
AfterViewChecked
|
||||
} from 'angular2/core';
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {AsyncPipe} from 'angular2/common';
|
||||
} from '@angular/core';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {AsyncPipe} from '@angular/common';
|
||||
|
||||
import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
|
||||
import {MockSchemaRegistry} from '../../compiler/schema_registry_mock';
|
||||
import {TEST_PROVIDERS} from '../../compiler/test_bindings';
|
||||
import {DebugDomRootRenderer, DebugDomRenderer} from 'angular2/src/core/debug/debug_renderer';
|
||||
import {DomRootRenderer} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry';
|
||||
import {MockSchemaRegistry} from '@angular/compiler/testing';
|
||||
import {TEST_PROVIDERS} from '@angular/compiler/test/test_bindings';
|
||||
import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer';
|
||||
import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer';
|
||||
|
||||
export function main() {
|
||||
var tcb: TestComponentBuilder;
|
||||
@@ -117,7 +119,7 @@ export function main() {
|
||||
|
||||
describe(`ChangeDetection`, () => {
|
||||
// On CJS fakeAsync is not supported...
|
||||
if (!DOM.supportsDOMEvents()) return;
|
||||
if (!getDOM().supportsDOMEvents()) return;
|
||||
|
||||
beforeEachProviders(() => [
|
||||
RenderLog,
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder,
|
||||
ComponentFixture
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {Predicate} from 'angular2/src/facade/collection';
|
||||
import {Injector, OnDestroy, DebugElement, Type, ViewContainerRef, ViewChild} from 'angular2/core';
|
||||
import {Component, ViewMetadata} from 'angular2/src/core/metadata';
|
||||
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/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';
|
||||
import {DynamicComponentLoader} from '@angular/core/src/linker/dynamic_component_loader';
|
||||
import {ElementRef} from '@angular/core/src/linker/element_ref';
|
||||
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {PromiseWrapper} from '../../src/facade/promise';
|
||||
import {el} from '@angular/platform-browser/testing';
|
||||
|
||||
export function main() {
|
||||
describe('DynamicComponentLoader', function() {
|
||||
@@ -32,7 +29,7 @@ export function main() {
|
||||
it('should work',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoaded,
|
||||
tc.componentInstance.viewContainerRef)
|
||||
@@ -48,7 +45,7 @@ export function main() {
|
||||
inject(
|
||||
[DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef)
|
||||
.then(ref => {
|
||||
@@ -71,7 +68,7 @@ export function main() {
|
||||
it('should update host properties',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithHostProps,
|
||||
@@ -94,7 +91,7 @@ export function main() {
|
||||
it('should leave the view tree in a consistent state if hydration fails',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc: ComponentFixture<any>) => {
|
||||
tcb.createAsync(MyComp3).then((tc: ComponentFixture<any>) => {
|
||||
tc.detectChanges();
|
||||
PromiseWrapper.catchError(
|
||||
loader.loadNextToLocation(DynamicallyLoadedThrows,
|
||||
@@ -111,11 +108,11 @@ export function main() {
|
||||
it('should allow to pass projectable nodes',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
|
||||
tc.componentInstance.viewContainerRef, null,
|
||||
[[DOM.createTextNode('hello')]])
|
||||
[[getDOM().createTextNode('hello')]])
|
||||
.then(ref => {
|
||||
tc.detectChanges();
|
||||
var newlyInsertedElement = tc.debugElement.childNodes[1].nativeNode;
|
||||
@@ -128,7 +125,7 @@ export function main() {
|
||||
it('should not throw if not enough projectable nodes are passed in',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
|
||||
tc.componentInstance.viewContainerRef, null, [])
|
||||
@@ -143,7 +140,7 @@ export function main() {
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async, loader: DynamicComponentLoader, doc, injector: Injector) => {
|
||||
var rootEl = createRootElement(doc, 'child-cmp');
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(ChildComp, null, injector)
|
||||
.then((componentRef) => {
|
||||
var el = new ComponentFixture<any>(componentRef, null, false);
|
||||
@@ -172,9 +169,9 @@ export function main() {
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async, loader: DynamicComponentLoader, doc, injector: Injector) => {
|
||||
var rootEl = createRootElement(doc, 'dummy');
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(DynamicallyLoadedWithNgContent, null, injector, null,
|
||||
[[DOM.createTextNode('hello')]])
|
||||
[[getDOM().createTextNode('hello')]])
|
||||
.then((_) => {
|
||||
expect(rootEl).toHaveText('dynamic(hello)');
|
||||
|
||||
@@ -188,12 +185,12 @@ export function main() {
|
||||
}
|
||||
|
||||
function createRootElement(doc: any, name: string): any {
|
||||
var nodes = DOM.querySelectorAll(doc, name);
|
||||
var nodes = getDOM().querySelectorAll(doc, name);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
DOM.remove(nodes[i]);
|
||||
getDOM().remove(nodes[i]);
|
||||
}
|
||||
var rootEl = el(`<${name}></${name}>`);
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
return rootEl;
|
||||
}
|
||||
|
||||
@@ -235,7 +232,7 @@ class DynamicallyLoadedWithNgContent {
|
||||
}
|
||||
|
||||
@Component({selector: 'my-comp', directives: [], template: '<div #loc></div>'})
|
||||
class MyComp {
|
||||
class MyComp3 {
|
||||
ctxBoolProp: boolean;
|
||||
|
||||
@ViewChild('loc', {read: ViewContainerRef}) viewContainerRef: ViewContainerRef;
|
||||
|
||||
@@ -4,7 +4,7 @@ library angular2.test.di.integration_dart_spec;
|
||||
import 'package:angular2/angular2.dart';
|
||||
import 'package:angular2/core.dart';
|
||||
import 'package:angular2/src/core/debug/debug_node.dart';
|
||||
import 'package:angular2/testing_internal.dart';
|
||||
import 'package:@angular/core/testing/testing_internal.dart';
|
||||
import 'package:observe/observe.dart';
|
||||
import 'package:angular2/src/core/change_detection/differs/default_iterable_differ.dart';
|
||||
import 'package:angular2/src/core/change_detection/change_detection.dart';
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
containsRegexp,
|
||||
stringifyElement,
|
||||
TestComponentBuilder,
|
||||
fakeAsync,
|
||||
tick,
|
||||
clearPendingTimers,
|
||||
ComponentFixture
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
clearPendingTimers
|
||||
} from '@angular/core/testing';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {
|
||||
Type,
|
||||
isPresent,
|
||||
@@ -31,15 +27,14 @@ import {
|
||||
global,
|
||||
stringify,
|
||||
isBlank,
|
||||
IS_DART
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {
|
||||
PromiseWrapper,
|
||||
EventEmitter,
|
||||
ObservableWrapper,
|
||||
PromiseCompleter,
|
||||
} from 'angular2/src/facade/async';
|
||||
} from '../../src/facade/async';
|
||||
|
||||
import {
|
||||
Injector,
|
||||
@@ -55,17 +50,17 @@ import {
|
||||
SkipSelfMetadata,
|
||||
OnDestroy,
|
||||
ReflectiveInjector
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
|
||||
import {NgIf, NgFor, AsyncPipe} from 'angular2/common';
|
||||
import {NgIf, NgFor, AsyncPipe} from '@angular/common';
|
||||
|
||||
import {
|
||||
PipeTransform,
|
||||
ChangeDetectorRef,
|
||||
ChangeDetectionStrategy
|
||||
} from 'angular2/src/core/change_detection/change_detection';
|
||||
} from '@angular/core/src/change_detection/change_detection';
|
||||
|
||||
import {CompilerConfig} from 'angular2/compiler';
|
||||
import {CompilerConfig} from '@angular/compiler';
|
||||
|
||||
import {
|
||||
Directive,
|
||||
@@ -78,18 +73,20 @@ import {
|
||||
Output,
|
||||
HostBinding,
|
||||
HostListener
|
||||
} from 'angular2/src/core/metadata';
|
||||
} from '@angular/core/src/metadata';
|
||||
|
||||
import {QueryList} from 'angular2/src/core/linker/query_list';
|
||||
import {QueryList} from '@angular/core/src/linker/query_list';
|
||||
|
||||
import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
|
||||
import {EmbeddedViewRef} from 'angular2/src/core/linker/view_ref';
|
||||
import {ViewContainerRef} from '@angular/core/src/linker/view_container_ref';
|
||||
import {EmbeddedViewRef} from '@angular/core/src/linker/view_ref';
|
||||
|
||||
import {ComponentResolver} from 'angular2/src/core/linker/component_resolver';
|
||||
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
||||
import {TemplateRef_, TemplateRef} from 'angular2/src/core/linker/template_ref';
|
||||
import {ComponentResolver} from '@angular/core/src/linker/component_resolver';
|
||||
import {ElementRef} from '@angular/core/src/linker/element_ref';
|
||||
import {TemplateRef, TemplateRef_} from '@angular/core/src/linker/template_ref';
|
||||
|
||||
import {Renderer} from 'angular2/src/core/render';
|
||||
import {Renderer} from '@angular/core/src/render';
|
||||
import {IS_DART} from '../../src/facade/lang';
|
||||
import {el, dispatchEvent} from '@angular/platform-browser/testing';
|
||||
|
||||
const ANCHOR_ELEMENT = /*@ts2dart_const*/ new OpaqueToken('AnchorElement');
|
||||
|
||||
@@ -167,13 +164,13 @@ function declareTests(isJit: boolean) {
|
||||
fixture.debugElement.componentInstance.ctxProp = 'Initial aria label';
|
||||
fixture.detectChanges();
|
||||
expect(
|
||||
DOM.getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
|
||||
getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
|
||||
.toEqual('Initial aria label');
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = 'Changed aria label';
|
||||
fixture.detectChanges();
|
||||
expect(
|
||||
DOM.getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
|
||||
getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
|
||||
.toEqual('Changed aria label');
|
||||
|
||||
async.done();
|
||||
@@ -190,12 +187,12 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = 'bar';
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
|
||||
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
|
||||
.toEqual('bar');
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = null;
|
||||
fixture.detectChanges();
|
||||
expect(DOM.hasAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
|
||||
expect(getDOM().hasAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
|
||||
.toBeFalsy();
|
||||
|
||||
async.done();
|
||||
@@ -212,12 +209,12 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = '10';
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'height'))
|
||||
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'height'))
|
||||
.toEqual('10px');
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = null;
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'height'))
|
||||
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'height'))
|
||||
.toEqual('');
|
||||
|
||||
async.done();
|
||||
@@ -272,12 +269,12 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = 'Some <span>HTML</span>';
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getInnerHTML(fixture.debugElement.children[0].nativeElement))
|
||||
expect(getDOM().getInnerHTML(fixture.debugElement.children[0].nativeElement))
|
||||
.toEqual('Some <span>HTML</span>');
|
||||
|
||||
fixture.debugElement.componentInstance.ctxProp = 'Some other <div>HTML</div>';
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getInnerHTML(fixture.debugElement.children[0].nativeElement))
|
||||
expect(getDOM().getInnerHTML(fixture.debugElement.children[0].nativeElement))
|
||||
.toEqual('Some other <div>HTML</div>');
|
||||
|
||||
async.done();
|
||||
@@ -480,7 +477,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement);
|
||||
var childNodesOfWrapper = getDOM().childNodes(fixture.debugElement.nativeElement);
|
||||
// 1 template + 2 copies.
|
||||
expect(childNodesOfWrapper.length).toBe(3);
|
||||
expect(childNodesOfWrapper[1]).toHaveText('hello');
|
||||
@@ -495,9 +492,9 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement);
|
||||
var childNodesOfWrapper = getDOM().childNodes(fixture.debugElement.nativeElement);
|
||||
expect(childNodesOfWrapper.length).toBe(1);
|
||||
expect(DOM.isCommentNode(childNodesOfWrapper[0])).toBe(true);
|
||||
expect(getDOM().isCommentNode(childNodesOfWrapper[0])).toBe(true);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
@@ -515,7 +512,7 @@ function declareTests(isJit: boolean) {
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement);
|
||||
var childNodesOfWrapper = getDOM().childNodes(fixture.debugElement.nativeElement);
|
||||
// 1 template + 2 copies.
|
||||
expect(childNodesOfWrapper.length).toBe(3);
|
||||
expect(childNodesOfWrapper[1]).toHaveText('hello');
|
||||
@@ -705,7 +702,7 @@ function declareTests(isJit: boolean) {
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
// Get the element at index 2, since index 0 is the <template>.
|
||||
expect(DOM.childNodes(fixture.debugElement.nativeElement)[2])
|
||||
expect(getDOM().childNodes(fixture.debugElement.nativeElement)[2])
|
||||
.toHaveText("1-hello");
|
||||
|
||||
async.done();
|
||||
@@ -766,7 +763,7 @@ function declareTests(isJit: boolean) {
|
||||
async.done();
|
||||
})}));
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it("should allow to destroy a component from within a host event handler",
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
|
||||
@@ -855,7 +852,7 @@ function declareTests(isJit: boolean) {
|
||||
async.done();
|
||||
})}));
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should be checked when an async pipe requests a check',
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
tcb =
|
||||
@@ -1063,16 +1060,16 @@ function declareTests(isJit: boolean) {
|
||||
.then((fixture) => {
|
||||
var tc = fixture.debugElement.children[0];
|
||||
var listener = tc.inject(DirectiveListeningDomEvent);
|
||||
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
|
||||
dispatchEvent(getDOM().getGlobalEventTarget("window"), 'domEvent');
|
||||
expect(listener.eventTypes).toEqual(['window_domEvent']);
|
||||
|
||||
listener.eventTypes = [];
|
||||
dispatchEvent(DOM.getGlobalEventTarget("document"), 'domEvent');
|
||||
dispatchEvent(getDOM().getGlobalEventTarget("document"), 'domEvent');
|
||||
expect(listener.eventTypes).toEqual(['document_domEvent', 'window_domEvent']);
|
||||
|
||||
fixture.destroy();
|
||||
listener.eventTypes = [];
|
||||
dispatchEvent(DOM.getGlobalEventTarget("body"), 'domEvent');
|
||||
dispatchEvent(getDOM().getGlobalEventTarget("body"), 'domEvent');
|
||||
expect(listener.eventTypes).toEqual([]);
|
||||
|
||||
async.done();
|
||||
@@ -1090,7 +1087,7 @@ function declareTests(isJit: boolean) {
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(DOM.getAttribute(fixture.debugElement.children[0].nativeElement, "role"))
|
||||
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, "role"))
|
||||
.toEqual("button");
|
||||
|
||||
async.done();
|
||||
@@ -1120,7 +1117,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should support preventing default on render events',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async) => {
|
||||
@@ -1136,17 +1133,17 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
var dispatchedEvent = DOM.createMouseEvent('click');
|
||||
var dispatchedEvent2 = DOM.createMouseEvent('click');
|
||||
DOM.dispatchEvent(fixture.debugElement.children[0].nativeElement,
|
||||
var dispatchedEvent = getDOM().createMouseEvent('click');
|
||||
var dispatchedEvent2 = getDOM().createMouseEvent('click');
|
||||
getDOM().dispatchEvent(fixture.debugElement.children[0].nativeElement,
|
||||
dispatchedEvent);
|
||||
DOM.dispatchEvent(fixture.debugElement.children[1].nativeElement,
|
||||
getDOM().dispatchEvent(fixture.debugElement.children[1].nativeElement,
|
||||
dispatchedEvent2);
|
||||
expect(DOM.isPrevented(dispatchedEvent)).toBe(true);
|
||||
expect(DOM.isPrevented(dispatchedEvent2)).toBe(false);
|
||||
expect(DOM.getChecked(fixture.debugElement.children[0].nativeElement))
|
||||
expect(getDOM().isPrevented(dispatchedEvent)).toBe(true);
|
||||
expect(getDOM().isPrevented(dispatchedEvent2)).toBe(false);
|
||||
expect(getDOM().getChecked(fixture.debugElement.children[0].nativeElement))
|
||||
.toBeFalsy();
|
||||
expect(DOM.getChecked(fixture.debugElement.children[1].nativeElement))
|
||||
expect(getDOM().getChecked(fixture.debugElement.children[1].nativeElement))
|
||||
.toBeTruthy();
|
||||
async.done();
|
||||
});
|
||||
@@ -1172,7 +1169,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
var listener = tc.inject(DirectiveListeningDomEvent);
|
||||
var listenerother = tc.inject(DirectiveListeningDomEventOther);
|
||||
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
|
||||
dispatchEvent(getDOM().getGlobalEventTarget("window"), 'domEvent');
|
||||
expect(listener.eventTypes).toEqual(['window_domEvent']);
|
||||
expect(listenerother.eventType).toEqual('other_domEvent');
|
||||
expect(globalCounter).toEqual(1);
|
||||
@@ -1180,12 +1177,12 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
fixture.debugElement.componentInstance.ctxBoolProp = false;
|
||||
fixture.detectChanges();
|
||||
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
|
||||
dispatchEvent(getDOM().getGlobalEventTarget("window"), 'domEvent');
|
||||
expect(globalCounter).toEqual(1);
|
||||
|
||||
fixture.debugElement.componentInstance.ctxBoolProp = true;
|
||||
fixture.detectChanges();
|
||||
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
|
||||
dispatchEvent(getDOM().getGlobalEventTarget("window"), 'domEvent');
|
||||
expect(globalCounter).toEqual(2);
|
||||
|
||||
// need to destroy to release all remaining global event listeners
|
||||
@@ -1382,7 +1379,7 @@ function declareTests(isJit: boolean) {
|
||||
}))
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'script').length)
|
||||
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'script').length)
|
||||
.toEqual(0);
|
||||
async.done();
|
||||
});
|
||||
@@ -1438,7 +1435,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
PromiseWrapper.catchError(tcb.createAsync(MyComp), (e) => {
|
||||
var c = e.context;
|
||||
expect(DOM.nodeName(c.componentRenderElement).toUpperCase()).toEqual("DIV");
|
||||
expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual("DIV");
|
||||
expect((<Injector>c.injector).get).toBeTruthy();
|
||||
async.done();
|
||||
return null;
|
||||
@@ -1457,8 +1454,8 @@ function declareTests(isJit: boolean) {
|
||||
throw "Should throw";
|
||||
} catch (e) {
|
||||
var c = e.context;
|
||||
expect(DOM.nodeName(c.renderNode).toUpperCase()).toEqual("INPUT");
|
||||
expect(DOM.nodeName(c.componentRenderElement).toUpperCase()).toEqual("DIV");
|
||||
expect(getDOM().nodeName(c.renderNode).toUpperCase()).toEqual("INPUT");
|
||||
expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual("DIV");
|
||||
expect((<Injector>c.injector).get).toBeTruthy();
|
||||
expect(c.source).toContain(":0:7");
|
||||
expect(c.context).toBe(fixture.debugElement.componentInstance);
|
||||
@@ -1489,7 +1486,7 @@ function declareTests(isJit: boolean) {
|
||||
});
|
||||
}));
|
||||
|
||||
if (DOM.supportsDOMEvents()) { // this is required to use fakeAsync
|
||||
if (getDOM().supportsDOMEvents()) { // this is required to use fakeAsync
|
||||
it('should provide an error context when an error happens in an event handler',
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
tcb = tcb.overrideView(
|
||||
@@ -1511,8 +1508,8 @@ function declareTests(isJit: boolean) {
|
||||
clearPendingTimers();
|
||||
|
||||
var c = e.context;
|
||||
expect(DOM.nodeName(c.renderNode).toUpperCase()).toEqual("SPAN");
|
||||
expect(DOM.nodeName(c.componentRenderElement).toUpperCase()).toEqual("DIV");
|
||||
expect(getDOM().nodeName(c.renderNode).toUpperCase()).toEqual("SPAN");
|
||||
expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual("DIV");
|
||||
expect((<Injector>c.injector).get).toBeTruthy();
|
||||
expect(c.context).toBe(fixture.debugElement.componentInstance);
|
||||
expect(c.references["local"]).toBeDefined();
|
||||
@@ -1660,7 +1657,7 @@ function declareTests(isJit: boolean) {
|
||||
fixture.debugElement.componentInstance.ctxProp = "TITLE";
|
||||
fixture.detectChanges();
|
||||
|
||||
var el = DOM.querySelector(fixture.debugElement.nativeElement, "span");
|
||||
var el = getDOM().querySelector(fixture.debugElement.nativeElement, "span");
|
||||
expect(isBlank(el.title) || el.title == '').toBeTruthy();
|
||||
|
||||
async.done();
|
||||
@@ -1679,7 +1676,7 @@ function declareTests(isJit: boolean) {
|
||||
fixture.debugElement.componentInstance.ctxProp = "TITLE";
|
||||
fixture.detectChanges();
|
||||
|
||||
var el = DOM.querySelector(fixture.debugElement.nativeElement, "span");
|
||||
var el = getDOM().querySelector(fixture.debugElement.nativeElement, "span");
|
||||
expect(el.title).toEqual("TITLE");
|
||||
|
||||
async.done();
|
||||
@@ -1704,7 +1701,7 @@ function declareTests(isJit: boolean) {
|
||||
fixture.debugElement.componentInstance.ctxProp = 'hello';
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(DOM.getInnerHTML(fixture.debugElement.nativeElement))
|
||||
expect(getDOM().getInnerHTML(fixture.debugElement.nativeElement))
|
||||
.toContain('ng-reflect-dir-prop="hello"');
|
||||
async.done();
|
||||
});
|
||||
@@ -1720,7 +1717,7 @@ function declareTests(isJit: boolean) {
|
||||
fixture.debugElement.componentInstance.ctxBoolProp = true;
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(DOM.getInnerHTML(fixture.debugElement.nativeElement))
|
||||
expect(getDOM().getInnerHTML(fixture.debugElement.nativeElement))
|
||||
.toContain('"ng\-reflect\-ng\-if"\: "true"');
|
||||
async.done();
|
||||
});
|
||||
@@ -1810,13 +1807,13 @@ function declareTests(isJit: boolean) {
|
||||
dir.myAttr = "aaa";
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getOuterHTML(fixture.debugElement.children[0].nativeElement))
|
||||
expect(getDOM().getOuterHTML(fixture.debugElement.children[0].nativeElement))
|
||||
.toContain('my-attr="aaa"');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should support event decorators',
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
tcb =
|
||||
@@ -1849,7 +1846,7 @@ function declareTests(isJit: boolean) {
|
||||
fixture.detectChanges();
|
||||
var dir = fixture.debugElement.children[0].inject(DirectiveWithPropDecorators);
|
||||
var native = fixture.debugElement.children[0].nativeElement;
|
||||
DOM.dispatchEvent(native, DOM.createMouseEvent('click'));
|
||||
getDOM().dispatchEvent(native, getDOM().createMouseEvent('click'));
|
||||
|
||||
expect(dir.target).toBe(native);
|
||||
async.done();
|
||||
@@ -1874,7 +1871,7 @@ function declareTests(isJit: boolean) {
|
||||
});
|
||||
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
describe('svg', () => {
|
||||
it('should support svg elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
@@ -1884,20 +1881,20 @@ function declareTests(isJit: boolean) {
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
var el = fixture.debugElement.nativeElement;
|
||||
var svg = DOM.childNodes(el)[0];
|
||||
var use = DOM.childNodes(svg)[0];
|
||||
expect(DOM.getProperty(<Element>svg, 'namespaceURI'))
|
||||
var svg = getDOM().childNodes(el)[0];
|
||||
var use = getDOM().childNodes(svg)[0];
|
||||
expect(getDOM().getProperty(<Element>svg, 'namespaceURI'))
|
||||
.toEqual('http://www.w3.org/2000/svg');
|
||||
expect(DOM.getProperty(<Element>use, 'namespaceURI'))
|
||||
expect(getDOM().getProperty(<Element>use, 'namespaceURI'))
|
||||
.toEqual('http://www.w3.org/2000/svg');
|
||||
|
||||
if (!IS_DART) {
|
||||
var firstAttribute = DOM.getProperty(<Element>use, 'attributes')[0];
|
||||
var firstAttribute = getDOM().getProperty(<Element>use, 'attributes')[0];
|
||||
expect(firstAttribute.name).toEqual('xlink:href');
|
||||
expect(firstAttribute.namespaceURI).toEqual('http://www.w3.org/1999/xlink');
|
||||
} else {
|
||||
// For Dart where '_Attr' has no instance getter 'namespaceURI'
|
||||
expect(DOM.getOuterHTML(<HTMLElement>use)).toContain('xmlns:xlink');
|
||||
expect(getDOM().getOuterHTML(<HTMLElement>use)).toContain('xmlns:xlink');
|
||||
}
|
||||
|
||||
async.done();
|
||||
@@ -1914,8 +1911,8 @@ function declareTests(isJit: boolean) {
|
||||
tcb.overrideView(SomeCmp, new ViewMetadata({template: '<svg:use xlink:href="#id" />'}))
|
||||
.createAsync(SomeCmp)
|
||||
.then((fixture) => {
|
||||
let useEl = DOM.firstChild(fixture.debugElement.nativeElement);
|
||||
expect(DOM.getAttributeNS(useEl, 'http://www.w3.org/1999/xlink', 'href'))
|
||||
let useEl = getDOM().firstChild(fixture.debugElement.nativeElement);
|
||||
expect(getDOM().getAttributeNS(useEl, 'http://www.w3.org/1999/xlink', 'href'))
|
||||
.toEqual('#id');
|
||||
async.done();
|
||||
});
|
||||
@@ -1929,18 +1926,18 @@ function declareTests(isJit: boolean) {
|
||||
.createAsync(SomeCmp)
|
||||
.then((fixture) => {
|
||||
let cmp = fixture.debugElement.componentInstance;
|
||||
let useEl = DOM.firstChild(fixture.debugElement.nativeElement);
|
||||
let useEl = getDOM().firstChild(fixture.debugElement.nativeElement);
|
||||
|
||||
cmp.value = "#id";
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(DOM.getAttributeNS(useEl, 'http://www.w3.org/1999/xlink', 'href'))
|
||||
expect(getDOM().getAttributeNS(useEl, 'http://www.w3.org/1999/xlink', 'href'))
|
||||
.toEqual('#id');
|
||||
|
||||
cmp.value = null;
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(DOM.hasAttributeNS(useEl, 'http://www.w3.org/1999/xlink', 'href'))
|
||||
expect(getDOM().hasAttributeNS(useEl, 'http://www.w3.org/1999/xlink', 'href'))
|
||||
.toEqual(false);
|
||||
|
||||
async.done();
|
||||
@@ -1964,7 +1961,7 @@ class SimpleImperativeViewComponent {
|
||||
|
||||
constructor(self: ElementRef, renderer: Renderer) {
|
||||
var hostElement = self.nativeElement;
|
||||
DOM.appendChild(hostElement, el('hello imp view'));
|
||||
getDOM().appendChild(hostElement, el('hello imp view'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2510,7 +2507,7 @@ class SomeImperativeViewport {
|
||||
this.view = this.vc.createEmbeddedView(this.templateRef);
|
||||
var nodes = this.view.rootNodes;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
DOM.appendChild(this.anchor, nodes[i]);
|
||||
getDOM().appendChild(this.anchor, nodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2527,14 +2524,14 @@ class ComponentWithoutView {
|
||||
@Directive({selector: '[no-duplicate]'})
|
||||
class DuplicateDir {
|
||||
constructor(elRef: ElementRef) {
|
||||
DOM.setText(elRef.nativeElement, DOM.getText(elRef.nativeElement) + 'noduplicate');
|
||||
getDOM().setText(elRef.nativeElement, getDOM().getText(elRef.nativeElement) + 'noduplicate');
|
||||
}
|
||||
}
|
||||
|
||||
@Directive({selector: '[no-duplicate]'})
|
||||
class OtherDuplicateDir {
|
||||
constructor(elRef: ElementRef) {
|
||||
DOM.setText(elRef.nativeElement, DOM.getText(elRef.nativeElement) + 'othernoduplicate');
|
||||
getDOM().setText(elRef.nativeElement, getDOM().getText(elRef.nativeElement) + 'othernoduplicate');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,19 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
containsRegexp,
|
||||
stringifyElement,
|
||||
TestComponentBuilder,
|
||||
ComponentFixture,
|
||||
fakeAsync,
|
||||
tick
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {
|
||||
bind,
|
||||
@@ -33,11 +26,11 @@ import {
|
||||
ViewContainerRef,
|
||||
ViewEncapsulation,
|
||||
ViewMetadata
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
import {
|
||||
By,
|
||||
} from 'angular2/platform/common_dom';
|
||||
import {getAllDebugNodes} from 'angular2/src/core/debug/debug_node';
|
||||
} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {getAllDebugNodes} from '@angular/core/src/debug/debug_node';
|
||||
|
||||
export function main() {
|
||||
describe('projection', () => {
|
||||
@@ -473,7 +466,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
if (DOM.supportsNativeShadowDOM()) {
|
||||
if (getDOM().supportsNativeShadowDOM()) {
|
||||
it('should support native content projection and isolate styles per component',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
@@ -483,7 +476,7 @@ export function main() {
|
||||
}))
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
var childNodes = DOM.childNodes(main.debugElement.nativeElement);
|
||||
var childNodes = getDOM().childNodes(main.debugElement.nativeElement);
|
||||
expect(childNodes[0]).toHaveText('div {color: red}SIMPLE1(A)');
|
||||
expect(childNodes[1]).toHaveText('div {color: blue}SIMPLE2(B)');
|
||||
main.destroy();
|
||||
@@ -492,7 +485,7 @@ export function main() {
|
||||
}));
|
||||
}
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should support non emulated styles',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
@@ -504,12 +497,12 @@ export function main() {
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
var mainEl = main.debugElement.nativeElement;
|
||||
var div1 = DOM.firstChild(mainEl);
|
||||
var div2 = DOM.createElement('div');
|
||||
DOM.setAttribute(div2, 'class', 'redStyle');
|
||||
DOM.appendChild(mainEl, div2);
|
||||
expect(DOM.getComputedStyle(div1).color).toEqual('rgb(255, 0, 0)');
|
||||
expect(DOM.getComputedStyle(div2).color).toEqual('rgb(255, 0, 0)');
|
||||
var div1 = getDOM().firstChild(mainEl);
|
||||
var div2 = getDOM().createElement('div');
|
||||
getDOM().setAttribute(div2, 'class', 'redStyle');
|
||||
getDOM().appendChild(mainEl, div2);
|
||||
expect(getDOM().getComputedStyle(div1).color).toEqual('rgb(255, 0, 0)');
|
||||
expect(getDOM().getComputedStyle(div2).color).toEqual('rgb(255, 0, 0)');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
@@ -524,11 +517,11 @@ export function main() {
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
var mainEl = main.debugElement.nativeElement;
|
||||
var div1 = DOM.firstChild(mainEl);
|
||||
var div2 = DOM.createElement('div');
|
||||
DOM.appendChild(mainEl, div2);
|
||||
expect(DOM.getComputedStyle(div1).color).toEqual('rgb(255, 0, 0)');
|
||||
expect(DOM.getComputedStyle(div2).color).toEqual('rgb(0, 0, 0)');
|
||||
var div1 = getDOM().firstChild(mainEl);
|
||||
var div2 = getDOM().createElement('div');
|
||||
getDOM().appendChild(mainEl, div2);
|
||||
expect(getDOM().getComputedStyle(div1).color).toEqual('rgb(255, 0, 0)');
|
||||
expect(getDOM().getComputedStyle(div2).color).toEqual('rgb(0, 0, 0)');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
@@ -567,7 +560,7 @@ export function main() {
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
main.detectChanges();
|
||||
expect(DOM.getInnerHTML(main.debugElement.nativeElement))
|
||||
expect(getDOM().getInnerHTML(main.debugElement.nativeElement))
|
||||
.toEqual('<cmp-a><cmp-b><cmp-d><d>cmp-d</d></cmp-d></cmp-b>' +
|
||||
'<cmp-c><c>cmp-c</c></cmp-c></cmp-a>');
|
||||
async.done();
|
||||
@@ -583,7 +576,7 @@ export function main() {
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
main.detectChanges();
|
||||
expect(DOM.getInnerHTML(main.debugElement.nativeElement))
|
||||
expect(getDOM().getInnerHTML(main.debugElement.nativeElement))
|
||||
.toEqual('<cmp-a1>a1<cmp-b11>b11</cmp-b11><cmp-b12>b12</cmp-b12></cmp-a1>' +
|
||||
'<cmp-a2>a2<cmp-b21>b21</cmp-b21><cmp-b22>b22</cmp-b22></cmp-a2>');
|
||||
async.done();
|
||||
@@ -788,7 +781,7 @@ class Tree {
|
||||
class CmpD {
|
||||
tagName: string;
|
||||
constructor(elementRef: ElementRef) {
|
||||
this.tagName = DOM.tagName(elementRef.nativeElement).toLowerCase();
|
||||
this.tagName = getDOM().tagName(elementRef.nativeElement).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +790,7 @@ class CmpD {
|
||||
class CmpC {
|
||||
tagName: string;
|
||||
constructor(elementRef: ElementRef) {
|
||||
this.tagName = DOM.tagName(elementRef.nativeElement).toLowerCase();
|
||||
this.tagName = getDOM().tagName(elementRef.nativeElement).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder,
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
import {ObservableWrapper} from '../../src/facade/async';
|
||||
|
||||
import {
|
||||
Component,
|
||||
@@ -32,9 +31,9 @@ import {
|
||||
AfterViewInit,
|
||||
AfterContentChecked,
|
||||
AfterViewChecked
|
||||
} from 'angular2/core';
|
||||
import {NgIf, NgFor} from 'angular2/common';
|
||||
import {asNativeElements, ViewContainerRef} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
import {NgIf, NgFor} from '@angular/common';
|
||||
import {asNativeElements, ViewContainerRef} from '@angular/core';
|
||||
|
||||
export function main() {
|
||||
describe('Query API', () => {
|
||||
@@ -47,8 +46,8 @@ export function main() {
|
||||
'</div></needs-query>' +
|
||||
'<div text="4"></div>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -63,8 +62,8 @@ export function main() {
|
||||
var template =
|
||||
'<needs-content-children #q><div text="foo"></div></needs-content-children>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -84,20 +83,20 @@ export function main() {
|
||||
var template =
|
||||
'<needs-content-child #q><div *ngIf="shouldShow" text="foo"></div></needs-content-child>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.debugElement.componentInstance.shouldShow = true;
|
||||
view.detectChanges();
|
||||
|
||||
var q: NeedsContentChild = view.debugElement.children[0].references['q'];
|
||||
|
||||
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
|
||||
expect(q.logs).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
|
||||
|
||||
view.debugElement.componentInstance.shouldShow = false;
|
||||
view.detectChanges();
|
||||
|
||||
expect(q.log).toEqual([
|
||||
expect(q.logs).toEqual([
|
||||
["setter", "foo"],
|
||||
["init", "foo"],
|
||||
["check", "foo"],
|
||||
@@ -113,18 +112,18 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-child #q></needs-view-child>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
var q: NeedsViewChild = view.debugElement.children[0].references['q'];
|
||||
|
||||
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
|
||||
expect(q.logs).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
|
||||
|
||||
q.shouldShow = false;
|
||||
view.detectChanges();
|
||||
|
||||
expect(q.log).toEqual([
|
||||
expect(q.logs).toEqual([
|
||||
["setter", "foo"],
|
||||
["init", "foo"],
|
||||
["check", "foo"],
|
||||
@@ -139,30 +138,30 @@ export function main() {
|
||||
it('should contain the first view child accross embedded views',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-child #q></needs-view-child>';
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.overrideTemplate(
|
||||
NeedsViewChild,
|
||||
'<div *ngIf="true"><div *ngIf="shouldShow" text="foo"></div></div><div *ngIf="shouldShow2" text="bar"></div>')
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
var q: NeedsViewChild = view.debugElement.children[0].references['q'];
|
||||
|
||||
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
|
||||
expect(q.logs).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
|
||||
|
||||
q.shouldShow = false;
|
||||
q.shouldShow2 = true;
|
||||
q.log = [];
|
||||
q.logs = [];
|
||||
view.detectChanges();
|
||||
|
||||
expect(q.log).toEqual([["setter", "bar"], ["check", "bar"]]);
|
||||
expect(q.logs).toEqual([["setter", "bar"], ["check", "bar"]]);
|
||||
|
||||
q.shouldShow = false;
|
||||
q.shouldShow2 = false;
|
||||
q.log = [];
|
||||
q.logs = [];
|
||||
view.detectChanges();
|
||||
|
||||
expect(q.log).toEqual([["setter", null], ["check", null]]);
|
||||
expect(q.logs).toEqual([["setter", null], ["check", null]]);
|
||||
|
||||
async.done();
|
||||
});
|
||||
@@ -176,8 +175,8 @@ export function main() {
|
||||
'</div></needs-query-desc>' +
|
||||
'<div text="5"></div>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
expect(asNativeElements(view.debugElement.children)).toHaveText('2|3|4|');
|
||||
@@ -192,8 +191,8 @@ export function main() {
|
||||
'<needs-query text="2"><div text="3"></div></needs-query>' +
|
||||
'<div text="4"></div>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
expect(asNativeElements(view.debugElement.children)).toHaveText('2|3|');
|
||||
@@ -209,8 +208,8 @@ export function main() {
|
||||
'<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' +
|
||||
'<div text="4"></div>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
|
||||
view.detectChanges();
|
||||
@@ -231,8 +230,8 @@ export function main() {
|
||||
'<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' +
|
||||
'<div text="4"></div>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((fixture) => {
|
||||
fixture.debugElement.componentInstance.shouldShow = true;
|
||||
fixture.detectChanges();
|
||||
@@ -249,8 +248,8 @@ export function main() {
|
||||
'<needs-query text="2"><div *ngFor="let i of list" [text]="i"></div></needs-query>' +
|
||||
'<div text="4"></div>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -269,27 +268,27 @@ export function main() {
|
||||
it('should find TemplateRefs in the light and shadow dom',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-tpl><template><div>light</div></template></needs-tpl>';
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
var needsTpl: NeedsTpl = view.debugElement.children[0].inject(NeedsTpl);
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
var needsTpl: NeedsTpl = view.debugElement.children[0].inject(NeedsTpl);
|
||||
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.query.first).rootNodes[0])
|
||||
.toHaveText('light');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.viewQuery.first).rootNodes[0])
|
||||
.toHaveText('shadow');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.query.first).rootNodes[0])
|
||||
.toHaveText('light');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.viewQuery.first).rootNodes[0])
|
||||
.toHaveText('shadow');
|
||||
|
||||
async.done();
|
||||
});
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should find named TemplateRefs',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template =
|
||||
'<needs-named-tpl><template #tpl><div>light</div></template></needs-named-tpl>';
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
var needsTpl: NeedsNamedTpl = view.debugElement.children[0].inject(NeedsNamedTpl);
|
||||
@@ -309,8 +308,8 @@ export function main() {
|
||||
var template =
|
||||
'<needs-content-children-read #q text="ca"><div #q text="cb"></div></needs-content-children-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -328,8 +327,8 @@ export function main() {
|
||||
var template =
|
||||
'<needs-content-child-read><div #q text="ca"></div></needs-content-child-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -345,8 +344,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-child-read></needs-view-child-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -362,8 +361,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-children-read></needs-view-children-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -381,8 +380,8 @@ export function main() {
|
||||
var template =
|
||||
'<needs-viewcontainer-read><template>hello</template></needs-viewcontainer-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -404,8 +403,8 @@ export function main() {
|
||||
'<div *ngIf="shouldShow" text="2"></div>' +
|
||||
'</needs-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q = view.debugElement.children[0].references["q"];
|
||||
view.detectChanges();
|
||||
@@ -429,8 +428,8 @@ export function main() {
|
||||
'</needs-query-desc>' +
|
||||
'</needs-query-desc>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q1 = view.debugElement.children[0].references["q1"];
|
||||
var q2 = view.debugElement.children[0].children[0].references["q2"];
|
||||
@@ -451,8 +450,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-query #q *ngIf="shouldShow"><div text="foo"></div></needs-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.debugElement.componentInstance.shouldShow = true;
|
||||
view.detectChanges();
|
||||
@@ -484,8 +483,8 @@ export function main() {
|
||||
'<div *ngFor="let item of list" [text]="item" #textLabel="textDir"></div>' +
|
||||
'</needs-query-by-ref-binding>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -507,8 +506,8 @@ export function main() {
|
||||
'<div text="two" #textLabel2="textDir"></div>' +
|
||||
'</needs-query-by-ref-bindings>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q = view.debugElement.children[0].references["q"];
|
||||
view.detectChanges();
|
||||
@@ -527,8 +526,8 @@ export function main() {
|
||||
'<div *ngFor="let item of list" [text]="item" #textLabel="textDir"></div>' +
|
||||
'</needs-query-by-ref-binding>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -554,8 +553,8 @@ export function main() {
|
||||
'</div>' +
|
||||
'</needs-query-by-ref-binding>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -576,8 +575,8 @@ export function main() {
|
||||
'<div text="hello"></div><div text="world"></div>' +
|
||||
'</needs-query-and-project>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -591,8 +590,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query-by-ref-binding #q></needs-view-query-by-ref-binding>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQueryByLabel = view.debugElement.children[0].references["q"];
|
||||
view.detectChanges();
|
||||
@@ -607,8 +606,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-children #q></needs-view-children>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -630,8 +629,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query #q><div text="ignoreme"></div></needs-view-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQuery = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -647,8 +646,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query #q text="self"></needs-view-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQuery = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -664,8 +663,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query-if #q></needs-view-query-if>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQueryIf = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -687,8 +686,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query-nested-if #q></needs-view-query-nested-if>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQueryNestedIf = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -712,8 +711,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query-order #q></needs-view-query-order>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQueryOrder = view.debugElement.children[0].references["q"];
|
||||
|
||||
@@ -735,8 +734,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query-order-with-p #q></needs-view-query-order-with-p>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQueryOrderWithParent =
|
||||
view.debugElement.children[0].references["q"];
|
||||
@@ -759,8 +758,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-view-query-order #q></needs-view-query-order>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
var q: NeedsViewQueryOrder = view.debugElement.children[0].references['q'];
|
||||
|
||||
@@ -781,8 +780,8 @@ export function main() {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var template = '<needs-four-queries #q><div text="1"></div></needs-four-queries>';
|
||||
|
||||
tcb.overrideTemplate(MyComp, template)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
.then((view) => {
|
||||
view.detectChanges();
|
||||
|
||||
@@ -830,16 +829,16 @@ class NeedsContentChild implements AfterContentInit, AfterContentChecked {
|
||||
@ContentChild(TextDirective)
|
||||
set child(value) {
|
||||
this._child = value;
|
||||
this.log.push(['setter', isPresent(value) ? value.text : null]);
|
||||
this.logs.push(['setter', isPresent(value) ? value.text : null]);
|
||||
}
|
||||
|
||||
get child() { return this._child; }
|
||||
log = [];
|
||||
logs = [];
|
||||
|
||||
ngAfterContentInit() { this.log.push(["init", isPresent(this.child) ? this.child.text : null]); }
|
||||
ngAfterContentInit() { this.logs.push(["init", isPresent(this.child) ? this.child.text : null]); }
|
||||
|
||||
ngAfterContentChecked() {
|
||||
this.log.push(["check", isPresent(this.child) ? this.child.text : null]);
|
||||
this.logs.push(["check", isPresent(this.child) ? this.child.text : null]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,15 +858,15 @@ class NeedsViewChild implements AfterViewInit,
|
||||
@ViewChild(TextDirective)
|
||||
set child(value) {
|
||||
this._child = value;
|
||||
this.log.push(['setter', isPresent(value) ? value.text : null]);
|
||||
this.logs.push(['setter', isPresent(value) ? value.text : null]);
|
||||
}
|
||||
|
||||
get child() { return this._child; }
|
||||
log = [];
|
||||
logs = [];
|
||||
|
||||
ngAfterViewInit() { this.log.push(["init", isPresent(this.child) ? this.child.text : null]); }
|
||||
ngAfterViewInit() { this.logs.push(["init", isPresent(this.child) ? this.child.text : null]); }
|
||||
|
||||
ngAfterViewChecked() { this.log.push(["check", isPresent(this.child) ? this.child.text : null]); }
|
||||
ngAfterViewChecked() { this.logs.push(["check", isPresent(this.child) ? this.child.text : null]); }
|
||||
}
|
||||
|
||||
@Directive({selector: '[dir]'})
|
||||
@@ -1119,7 +1118,7 @@ class NeedsViewContainerWithRead {
|
||||
template: ''
|
||||
})
|
||||
@Injectable()
|
||||
class MyComp {
|
||||
class MyComp0 {
|
||||
shouldShow: boolean;
|
||||
list;
|
||||
constructor() {
|
||||
|
||||
@@ -6,15 +6,16 @@ import {
|
||||
ddescribe,
|
||||
iit,
|
||||
xit,
|
||||
el,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
fakeAsync,
|
||||
tick
|
||||
} from 'angular2/testing_internal';
|
||||
import {MapWrapper, ListWrapper, iterateListLike} from 'angular2/src/facade/collection';
|
||||
import {IS_DART, StringWrapper} from 'angular2/src/facade/lang';
|
||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {QueryList} from 'angular2/src/core/linker/query_list';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
tick,
|
||||
} from '@angular/core/testing';
|
||||
import {MapWrapper, ListWrapper, iterateListLike} from '../../src/facade/collection';
|
||||
import {IS_DART, StringWrapper} from '../../src/facade/lang';
|
||||
import {ObservableWrapper} from '../../src/facade/async';
|
||||
import {QueryList} from '@angular/core/src/linker/query_list';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
interface _JsQueryList {
|
||||
filter(c: any): any;
|
||||
@@ -92,7 +93,7 @@ export function main() {
|
||||
expect(queryList.last).toEqual('three');
|
||||
});
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
describe('simple observable interface', () => {
|
||||
it('should fire callbacks on change', fakeAsync(() => {
|
||||
var fires = 0;
|
||||
|
||||
@@ -8,18 +8,18 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {provide} from 'angular2/core';
|
||||
import {provide} from '@angular/core';
|
||||
import {
|
||||
ComponentResolver,
|
||||
ReflectorComponentResolver
|
||||
} from 'angular2/src/core/linker/component_resolver';
|
||||
import {reflector, ReflectionInfo} from 'angular2/src/core/reflection/reflection';
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
} from '@angular/core/src/linker/component_resolver';
|
||||
import {reflector, ReflectionInfo} from '@angular/core/src/reflection/reflection';
|
||||
import {ComponentFactory} from '@angular/core/src/linker/component_factory';
|
||||
|
||||
export function main() {
|
||||
describe('Compiler', () => {
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
containsRegexp,
|
||||
stringifyElement,
|
||||
TestComponentBuilder,
|
||||
fakeAsync,
|
||||
tick,
|
||||
clearPendingTimers,
|
||||
ComponentFixture
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {IS_DART} from '../../src/facade/lang';
|
||||
|
||||
import {
|
||||
Component,
|
||||
@@ -32,9 +24,9 @@ import {
|
||||
PLATFORM_PIPES,
|
||||
OpaqueToken,
|
||||
Injector
|
||||
} from 'angular2/core';
|
||||
import {NgIf, NgClass} from 'angular2/common';
|
||||
import {CompilerConfig} from 'angular2/compiler';
|
||||
} from '@angular/core';
|
||||
import {NgIf, NgClass} from '@angular/common';
|
||||
import {CompilerConfig} from '@angular/compiler';
|
||||
|
||||
export function main() {
|
||||
if (IS_DART) {
|
||||
@@ -64,8 +56,8 @@ function declareTests(isJit: boolean) {
|
||||
it('should overwrite them by custom pipes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({template: '{{true | somePipe}}', pipes: [CustomPipe]}))
|
||||
.createAsync(MyComp)
|
||||
MyComp1, new ViewMetadata({template: '{{true | somePipe}}', pipes: [CustomPipe]}))
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement).toHaveText('someCustomPipe');
|
||||
@@ -78,9 +70,9 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should evaluate conditional and boolean operators with right precedence - #8244',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp,
|
||||
tcb.overrideView(MyComp1,
|
||||
new ViewMetadata({template: `{{'red' + (true ? ' border' : '')}}`}))
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement).toHaveText('red border');
|
||||
@@ -92,8 +84,8 @@ function declareTests(isJit: boolean) {
|
||||
it('should evaluate conditional and unary operators with right precedence - #8235',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: `{{!null?.length}}`}))
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideView(MyComp1, new ViewMetadata({template: `{{!null?.length}}`}))
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement).toHaveText('true');
|
||||
@@ -105,8 +97,8 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
describe('providers', () => {
|
||||
function createInjector(tcb: TestComponentBuilder, proviers: any[]): Promise<Injector> {
|
||||
return tcb.overrideProviders(MyComp, [proviers])
|
||||
.createAsync(MyComp)
|
||||
return tcb.overrideProviders(MyComp1, [proviers])
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => fixture.componentInstance.injector);
|
||||
}
|
||||
|
||||
@@ -162,8 +154,8 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should allow logging a previous elements class binding via interpolation',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideTemplate(MyComp, `<div [class.a]="true" #el>Class: {{el.className}}</div>`)
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideTemplate(MyComp1, `<div [class.a]="true" #el>Class: {{el.className}}</div>`)
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement).toHaveText('Class: a');
|
||||
@@ -174,11 +166,11 @@ function declareTests(isJit: boolean) {
|
||||
it('should support ngClass before a component and content projection inside of an ngIf',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
MyComp1, new ViewMetadata({
|
||||
template: `A<cmp-content *ngIf="true" [ngClass]="'red'">B</cmp-content>C`,
|
||||
directives: [NgClass, NgIf, CmpWithNgContent]
|
||||
}))
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement).toHaveText('ABC');
|
||||
@@ -191,7 +183,7 @@ function declareTests(isJit: boolean) {
|
||||
}
|
||||
|
||||
@Component({selector: 'my-comp', template: ''})
|
||||
class MyComp {
|
||||
class MyComp1 {
|
||||
constructor(public injector: Injector) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,18 @@ import {
|
||||
beforeEach,
|
||||
beforeEachProviders,
|
||||
inject,
|
||||
AsyncTestCompleter,
|
||||
el,
|
||||
containsRegexp,
|
||||
ComponentFixture,
|
||||
TestComponentBuilder,
|
||||
fakeAsync,
|
||||
tick
|
||||
} from 'angular2/testing_internal';
|
||||
import {isBlank, isPresent, stringify, Type} from 'angular2/src/facade/lang';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
fakeAsync,
|
||||
flushMicrotasks,
|
||||
Log,
|
||||
tick,
|
||||
containsRegexp
|
||||
} from '@angular/core/testing';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
import {
|
||||
Type,
|
||||
ViewContainerRef,
|
||||
TemplateRef,
|
||||
ElementRef,
|
||||
@@ -33,21 +35,16 @@ import {
|
||||
Attribute,
|
||||
ViewMetadata,
|
||||
provide,
|
||||
Injector,
|
||||
Provider,
|
||||
Optional,
|
||||
Inject,
|
||||
Injectable,
|
||||
Self,
|
||||
SkipSelf,
|
||||
InjectMetadata,
|
||||
Pipe,
|
||||
Host,
|
||||
HostMetadata,
|
||||
SkipSelfMetadata
|
||||
} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
} from '@angular/core';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
const ALL_DIRECTIVES = /*@ts2dart_const*/[
|
||||
forwardRef(() => SimpleDirective),
|
||||
@@ -293,7 +290,7 @@ export function main() {
|
||||
|
||||
describe("View Injector", () => {
|
||||
// On CJS fakeAsync is not supported...
|
||||
if (!DOM.supportsDOMEvents()) return;
|
||||
if (!getDOM().supportsDOMEvents()) return;
|
||||
|
||||
beforeEachProviders(() => [provide("appService", {useValue: 'appService'})]);
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user