chore(packaging): update import for the new file structure
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {ChangeDetector, CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED} from './interfaces';
|
||||
|
||||
export class AbstractChangeDetector extends ChangeDetector {
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
iterateListLike,
|
||||
ListWrapper,
|
||||
MapWrapper
|
||||
} from 'facade/src/collection';
|
||||
} from 'angular2/src/facade/collection';
|
||||
|
||||
import {
|
||||
int,
|
||||
@ -12,7 +12,7 @@ import {
|
||||
stringify,
|
||||
getMapKey,
|
||||
looseIdentical,
|
||||
} from 'facade/src/lang';
|
||||
} from 'angular2/src/facade/lang';
|
||||
|
||||
export class ArrayChanges {
|
||||
_collection;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent, isBlank, BaseException, Type} from 'facade/src/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {isPresent, isBlank, BaseException, Type} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ContextWithVariableBindings} from './parser/context_with_variable_bindings';
|
||||
import {AbstractChangeDetector} from './abstract_change_detector';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent, isBlank, BaseException, Type} from 'facade/src/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {isPresent, isBlank, BaseException, Type} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {ContextWithVariableBindings} from './parser/context_with_variable_bindings';
|
||||
import {ArrayChanges} from './array_changes';
|
||||
import {KeyValueChanges} from './keyvalue_changes';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper, Map, MapWrapper} from 'facade/src/collection';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {RECORD_TYPE_SELF, ProtoRecord} from './proto_change_detector';
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent, isBlank, BaseException, FunctionWrapper} from 'facade/src/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {isPresent, isBlank, BaseException, FunctionWrapper} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {ContextWithVariableBindings} from './parser/context_with_variable_bindings';
|
||||
|
||||
import {AbstractChangeDetector} from './abstract_change_detector';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {List} from 'facade/src/collection';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
|
||||
export class ChangeRecord {
|
||||
bindingMemento:any;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {ListWrapper, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {stringify, looseIdentical, isJsObject} from 'facade/src/lang';
|
||||
import {stringify, looseIdentical, isJsObject} from 'angular2/src/facade/lang';
|
||||
|
||||
export class KeyValueChanges {
|
||||
_records:Map;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {FIELD, autoConvertAdd, isBlank, isPresent, FunctionWrapper, BaseException} from "facade/src/lang";
|
||||
import {List, Map, ListWrapper, StringMapWrapper} from "facade/src/collection";
|
||||
import {FIELD, autoConvertAdd, isBlank, isPresent, FunctionWrapper, BaseException} from "angular2/src/facade/lang";
|
||||
import {List, Map, ListWrapper, StringMapWrapper} from "angular2/src/facade/collection";
|
||||
import {ContextWithVariableBindings} from "./context_with_variable_bindings";
|
||||
|
||||
export class AST {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {MapWrapper} from 'facade/src/collection';
|
||||
import {BaseException} from 'facade/src/lang';
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {BaseException} from 'angular2/src/facade/lang';
|
||||
|
||||
export class ContextWithVariableBindings {
|
||||
parent:any;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {List, ListWrapper, SetWrapper} from "facade/src/collection";
|
||||
import {int, FIELD, NumberWrapper, StringJoiner, StringWrapper} from "facade/src/lang";
|
||||
import {List, ListWrapper, SetWrapper} from "angular2/src/facade/collection";
|
||||
import {int, FIELD, NumberWrapper, StringJoiner, StringWrapper} from "angular2/src/facade/lang";
|
||||
|
||||
export const TOKEN_TYPE_CHARACTER = 1;
|
||||
export const TOKEN_TYPE_IDENTIFIER = 2;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {FIELD, int, isBlank, isPresent, BaseException, StringWrapper, RegExpWrapper} from 'facade/src/lang';
|
||||
import {ListWrapper, List} from 'facade/src/collection';
|
||||
import {FIELD, int, isBlank, isPresent, BaseException, StringWrapper, RegExpWrapper} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, List} from 'angular2/src/facade/collection';
|
||||
import {Lexer, EOF, Token, $PERIOD, $COLON, $SEMICOLON, $LBRACKET, $RBRACKET,
|
||||
$COMMA, $LBRACE, $RBRACE, $LPAREN, $RPAREN} from './lexer';
|
||||
import {reflector, Reflector} from 'reflection/src/reflection';
|
||||
import {reflector, Reflector} from 'angular2/src/reflection/reflection';
|
||||
import {
|
||||
AST,
|
||||
EmptyExpr,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent, isBlank, BaseException, Type, isString} from 'facade/src/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {isPresent, isBlank, BaseException, Type, isString} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {
|
||||
AccessMember,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {ABSTRACT, CONST, normalizeBlank} from 'facade/src/lang';
|
||||
import {List} from 'facade/src/collection';
|
||||
import {ABSTRACT, CONST, normalizeBlank} from 'angular2/src/facade/lang';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
import {TemplateConfig} from './template_config';
|
||||
import {ShadowDomStrategy} from '../compiler/shadow_dom';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {CONST} from 'facade/src/lang';
|
||||
import {DependencyAnnotation} from 'di/di';
|
||||
import {CONST} from 'angular2/src/facade/lang';
|
||||
import {DependencyAnnotation} from 'angular2/di';
|
||||
|
||||
/**
|
||||
* The directive can inject an emitter function that would emit events onto the
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {ABSTRACT, CONST, Type} from 'facade/src/lang';
|
||||
import {List} from 'facade/src/collection';
|
||||
import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
|
||||
export class TemplateConfig {
|
||||
url:any; //string;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {CONST} from 'facade/src/lang';
|
||||
import {DependencyAnnotation} from 'di/di';
|
||||
import {CONST} from 'angular2/src/facade/lang';
|
||||
import {DependencyAnnotation} from 'angular2/di';
|
||||
|
||||
/**
|
||||
* The directive can only be injected from the current element
|
||||
|
18
modules/angular2/src/core/application.js
vendored
18
modules/angular2/src/core/application.js
vendored
@ -1,17 +1,17 @@
|
||||
import {Injector, bind, OpaqueToken} from 'di/di';
|
||||
import {Type, FIELD, isBlank, isPresent, BaseException, assertionsEnabled, print} from 'facade/src/lang';
|
||||
import {DOM, Element} from 'facade/src/dom';
|
||||
import {Injector, bind, OpaqueToken} from 'angular2/di';
|
||||
import {Type, FIELD, isBlank, isPresent, BaseException, assertionsEnabled, print} from 'angular2/src/facade/lang';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
import {Compiler, CompilerCache} from './compiler/compiler';
|
||||
import {ProtoView} from './compiler/view';
|
||||
import {Reflector, reflector} from 'reflection/src/reflection';
|
||||
import {Parser, Lexer, ChangeDetection, dynamicChangeDetection, jitChangeDetection} from 'change_detection/change_detection';
|
||||
import {Reflector, reflector} from 'angular2/src/reflection/reflection';
|
||||
import {Parser, Lexer, ChangeDetection, dynamicChangeDetection, jitChangeDetection} from 'angular2/change_detection';
|
||||
import {TemplateLoader} from './compiler/template_loader';
|
||||
import {DirectiveMetadataReader} from './compiler/directive_metadata_reader';
|
||||
import {DirectiveMetadata} from './compiler/directive_metadata';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {PromiseWrapper} from 'facade/src/async';
|
||||
import {VmTurnZone} from 'core/src/zone/vm_turn_zone';
|
||||
import {LifeCycle} from 'core/src/life_cycle/life_cycle';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
|
||||
var _rootInjector: Injector;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {ChangeDetector, CHECK_ONCE, DETACHED, CHECK_ALWAYS} from 'change_detection/change_detection';
|
||||
import {ChangeDetector, CHECK_ONCE, DETACHED, CHECK_ALWAYS} from 'angular2/change_detection';
|
||||
|
||||
export class BindingPropagationConfig {
|
||||
_cd:ChangeDetector;
|
||||
|
10
modules/angular2/src/core/compiler/compiler.js
vendored
10
modules/angular2/src/core/compiler/compiler.js
vendored
@ -1,9 +1,9 @@
|
||||
import {Type, FIELD, isBlank, isPresent, BaseException, stringify} from 'facade/src/lang';
|
||||
import {Promise, PromiseWrapper} from 'facade/src/async';
|
||||
import {List, ListWrapper, MapWrapper} from 'facade/src/collection';
|
||||
import {DOM, Element} from 'facade/src/dom';
|
||||
import {Type, FIELD, isBlank, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
|
||||
import {ChangeDetection, Parser} from 'change_detection/change_detection';
|
||||
import {ChangeDetection, Parser} from 'angular2/change_detection';
|
||||
|
||||
import {DirectiveMetadataReader} from './directive_metadata_reader';
|
||||
import {ProtoView} from './view';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Type} from 'facade/src/lang';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Directive} from '../annotations/annotations'
|
||||
import {List} from 'facade/src/collection'
|
||||
import {List} from 'angular2/src/facade/collection'
|
||||
import {ShadowDomStrategy} from './shadow_dom';
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {Type, isPresent, BaseException, stringify} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {Type, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Directive, Component} from '../annotations/annotations';
|
||||
import {DirectiveMetadata} from './directive_metadata';
|
||||
import {reflector} from 'reflection/src/reflection';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ShadowDom, ShadowDomStrategy, ShadowDomNative} from './shadow_dom';
|
||||
|
||||
export class DirectiveMetadataReader {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {ProtoElementInjector} from './element_injector';
|
||||
import {FIELD} from 'facade/src/lang';
|
||||
import {MapWrapper} from 'facade/src/collection';
|
||||
import {FIELD} from 'angular2/src/facade/lang';
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DirectiveMetadata} from './directive_metadata';
|
||||
import {List, Map} from 'facade/src/collection';
|
||||
import {List, Map} from 'angular2/src/facade/collection';
|
||||
import {ProtoView} from './view';
|
||||
|
||||
export class ElementBinder {
|
||||
|
@ -1,16 +1,16 @@
|
||||
import {FIELD, isPresent, isBlank, Type, int, BaseException} from 'facade/src/lang';
|
||||
import {Math} from 'facade/src/math';
|
||||
import {List, ListWrapper, MapWrapper} from 'facade/src/collection';
|
||||
import {Injector, Key, Dependency, bind, Binding, NoProviderError, ProviderError, CyclicDependencyError} from 'di/di';
|
||||
import {Parent, Ancestor} from 'core/src/annotations/visibility';
|
||||
import {EventEmitter} from 'core/src/annotations/events';
|
||||
import {onDestroy} from 'core/src/annotations/annotations';
|
||||
import {View, ProtoView} from 'core/src/compiler/view';
|
||||
import {LightDom, SourceLightDom, DestinationLightDom} from 'core/src/compiler/shadow_dom_emulation/light_dom';
|
||||
import {ViewPort} from 'core/src/compiler/viewport';
|
||||
import {NgElement} from 'core/src/dom/element';
|
||||
import {Directive} from 'core/src/annotations/annotations'
|
||||
import {BindingPropagationConfig} from 'core/src/compiler/binding_propagation_config'
|
||||
import {FIELD, isPresent, isBlank, Type, int, BaseException} from 'angular2/src/facade/lang';
|
||||
import {Math} from 'angular2/src/facade/math';
|
||||
import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injector, Key, Dependency, bind, Binding, NoProviderError, ProviderError, CyclicDependencyError} from 'angular2/di';
|
||||
import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility';
|
||||
import {EventEmitter} from 'angular2/src/core/annotations/events';
|
||||
import {onDestroy} from 'angular2/src/core/annotations/annotations';
|
||||
import {View, ProtoView} from 'angular2/src/core/compiler/view';
|
||||
import {LightDom, SourceLightDom, DestinationLightDom} from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom';
|
||||
import {ViewPort} from 'angular2/src/core/compiler/viewport';
|
||||
import {NgElement} from 'angular2/src/core/dom/element';
|
||||
import {Directive} from 'angular2/src/core/annotations/annotations'
|
||||
import {BindingPropagationConfig} from 'angular2/src/core/compiler/binding_propagation_config'
|
||||
|
||||
var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {isBlank} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {DOM, Element} from 'facade/src/dom';
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
import {CompileElement} from './compile_element';
|
||||
import {CompileStep} from './compile_step';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {List, Map, ListWrapper, MapWrapper} from 'facade/src/collection';
|
||||
import {Element, DOM} from 'facade/src/dom';
|
||||
import {int, isBlank, isPresent, Type} from 'facade/src/lang';
|
||||
import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Element, DOM} from 'angular2/src/facade/dom';
|
||||
import {int, isBlank, isPresent, Type} from 'angular2/src/facade/lang';
|
||||
import {DirectiveMetadata} from '../directive_metadata';
|
||||
import {Decorator} from '../../annotations/annotations';
|
||||
import {Component} from '../../annotations/annotations';
|
||||
@ -9,7 +9,7 @@ import {ElementBinder} from '../element_binder';
|
||||
import {ProtoElementInjector} from '../element_injector';
|
||||
import {ProtoView} from '../view';
|
||||
|
||||
import {AST} from 'change_detection/change_detection';
|
||||
import {AST} from 'angular2/change_detection';
|
||||
|
||||
/**
|
||||
* Collects all data that is needed to process an element
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {Element, Node, DOM} from 'facade/src/dom';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Element, Node, DOM} from 'angular2/src/facade/dom';
|
||||
import {CompileElement} from './compile_element';
|
||||
import {CompileControl} from './compile_control';
|
||||
import {CompileStep} from './compile_step';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {ChangeDetection, Parser} from 'change_detection/change_detection';
|
||||
import {List} from 'facade/src/collection';
|
||||
import {ChangeDetection, Parser} from 'angular2/change_detection';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
|
||||
import {PropertyBindingParser} from './property_binding_parser';
|
||||
import {TextInterpolationParser} from './text_interpolation_parser';
|
||||
@ -9,8 +9,8 @@ import {ElementBindingMarker} from './element_binding_marker';
|
||||
import {ProtoViewBuilder} from './proto_view_builder';
|
||||
import {ProtoElementInjectorBuilder} from './proto_element_injector_builder';
|
||||
import {ElementBinderBuilder} from './element_binder_builder';
|
||||
import {DirectiveMetadata} from 'core/src/compiler/directive_metadata';
|
||||
import {stringify} from 'facade/src/lang';
|
||||
import {DirectiveMetadata} from 'angular2/src/core/compiler/directive_metadata';
|
||||
import {stringify} from 'angular2/src/facade/lang';
|
||||
|
||||
/**
|
||||
* Default steps used for compiling a template.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {isPresent, BaseException} from 'facade/src/lang';
|
||||
import {List, MapWrapper} from 'facade/src/collection';
|
||||
import {TemplateElement} from 'facade/src/dom';
|
||||
import {isPresent, BaseException} from 'angular2/src/facade/lang';
|
||||
import {List, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {TemplateElement} from 'angular2/src/facade/dom';
|
||||
import {SelectorMatcher} from '../selector';
|
||||
import {CssSelector} from '../selector';
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import {int, isPresent, isBlank, Type, BaseException, StringWrapper, stringify} from 'facade/src/lang';
|
||||
import {Element, DOM} from 'facade/src/dom';
|
||||
import {ListWrapper, List, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {int, isPresent, isBlank, Type, BaseException, StringWrapper, stringify} from 'angular2/src/facade/lang';
|
||||
import {Element, DOM} from 'angular2/src/facade/dom';
|
||||
import {ListWrapper, List, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {reflector} from 'reflection/src/reflection';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
|
||||
import {Parser, ProtoChangeDetector} from 'change_detection/change_detection';
|
||||
import {Parser, ProtoChangeDetector} from 'angular2/change_detection';
|
||||
|
||||
import {Component, Directive} from '../../annotations/annotations';
|
||||
import {DirectiveMetadata} from '../directive_metadata';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {isPresent} from 'facade/src/lang';
|
||||
import {MapWrapper} from 'facade/src/collection';
|
||||
import {DOM} from 'facade/src/dom';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
|
||||
import {CompileStep} from './compile_step';
|
||||
import {CompileElement} from './compile_element';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {isPresent, isBlank, RegExpWrapper, BaseException} from 'facade/src/lang';
|
||||
import {MapWrapper} from 'facade/src/collection';
|
||||
import {TemplateElement} from 'facade/src/dom';
|
||||
import {isPresent, isBlank, RegExpWrapper, BaseException} from 'angular2/src/facade/lang';
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {TemplateElement} from 'angular2/src/facade/dom';
|
||||
|
||||
import {Parser, AST, ExpressionWithSource} from 'change_detection/change_detection';
|
||||
import {Parser, AST, ExpressionWithSource} from 'angular2/change_detection';
|
||||
|
||||
import {CompileStep} from './compile_step';
|
||||
import {CompileElement} from './compile_element';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {isPresent, isBlank} from 'facade/src/lang';
|
||||
import {ListWrapper} from 'facade/src/collection';
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {Key} from 'di/di';
|
||||
import {Key} from 'angular2/di';
|
||||
import {ProtoElementInjector, ComponentKeyMetaData, DirectiveBinding} from '../element_injector';
|
||||
|
||||
import {CompileStep} from './compile_step';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {isPresent, BaseException} from 'facade/src/lang';
|
||||
import {ListWrapper, MapWrapper} from 'facade/src/collection';
|
||||
import {isPresent, BaseException} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ProtoView} from '../view';
|
||||
import {ChangeDetection} from 'change_detection/change_detection';
|
||||
import {ChangeDetection} from 'angular2/change_detection';
|
||||
|
||||
import {CompileStep} from './compile_step';
|
||||
import {CompileElement} from './compile_element';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {RegExpWrapper, StringWrapper, isPresent} from 'facade/src/lang';
|
||||
import {Node, DOM} from 'facade/src/dom';
|
||||
import {RegExpWrapper, StringWrapper, isPresent} from 'angular2/src/facade/lang';
|
||||
import {Node, DOM} from 'angular2/src/facade/dom';
|
||||
|
||||
import {Parser} from 'change_detection/change_detection';
|
||||
import {Parser} from 'angular2/change_detection';
|
||||
|
||||
import {CompileStep} from './compile_step';
|
||||
import {CompileElement} from './compile_element';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {isBlank, isPresent, BaseException} from 'facade/src/lang';
|
||||
import {DOM, TemplateElement} from 'facade/src/dom';
|
||||
import {MapWrapper, ListWrapper} from 'facade/src/collection';
|
||||
import {isBlank, isPresent, BaseException} from 'angular2/src/facade/lang';
|
||||
import {DOM, TemplateElement} from 'angular2/src/facade/dom';
|
||||
import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {Parser} from 'change_detection/change_detection';
|
||||
import {Parser} from 'angular2/change_detection';
|
||||
|
||||
import {CompileStep} from './compile_step';
|
||||
import {CompileElement} from './compile_element';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {List, Map, ListWrapper, MapWrapper} from 'facade/src/collection';
|
||||
import {isPresent, isBlank, RegExpWrapper, RegExpMatcherWrapper, StringWrapper} from 'facade/src/lang';
|
||||
import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {isPresent, isBlank, RegExpWrapper, RegExpMatcherWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
||||
|
||||
const _EMPTY_ATTR_VALUE = '';
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import {Decorator} from '../../annotations/annotations';
|
||||
import {SourceLightDom, DestinationLightDom, LightDom} from './light_dom';
|
||||
import {Inject} from 'di/di';
|
||||
import {Element, Node, DOM} from 'facade/src/dom';
|
||||
import {isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {NgElement} from 'core/src/dom/element';
|
||||
import {Inject} from 'angular2/di';
|
||||
import {Element, Node, DOM} from 'angular2/src/facade/dom';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {NgElement} from 'angular2/src/core/dom/element';
|
||||
|
||||
var _scriptTemplate = DOM.createScriptTag('type', 'ng/content')
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Element, Node, DOM} from 'facade/src/dom';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {isBlank, isPresent} from 'facade/src/lang';
|
||||
import {Element, Node, DOM} from 'angular2/src/facade/dom';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
import {View} from '../view';
|
||||
import {ElementInjector} from '../element_injector';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {CONST} from 'facade/src/lang';
|
||||
import {DOM, Element} from 'facade/src/dom';
|
||||
import {List} from 'facade/src/collection';
|
||||
import {CONST} from 'angular2/src/facade/lang';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
import {View} from './view';
|
||||
import {Content} from './shadow_dom_emulation/content_tag';
|
||||
import {LightDom} from './shadow_dom_emulation/light_dom';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Promise} from 'facade/src/async';
|
||||
//import {Document} from 'facade/src/dom';
|
||||
import {Promise} from 'angular2/src/facade/async';
|
||||
//import {Document} from 'angular2/src/facade/dom';
|
||||
|
||||
/**
|
||||
* Strategy to load component templates.
|
||||
|
14
modules/angular2/src/core/compiler/view.js
vendored
14
modules/angular2/src/core/compiler/view.js
vendored
@ -1,16 +1,16 @@
|
||||
import {DOM, Element, Node, Text, DocumentFragment, TemplateElement} from 'facade/src/dom';
|
||||
import {ListWrapper, MapWrapper, StringMapWrapper, List} from 'facade/src/collection';
|
||||
import {DOM, Element, Node, Text, DocumentFragment, TemplateElement} from 'angular2/src/facade/dom';
|
||||
import {ListWrapper, MapWrapper, StringMapWrapper, List} from 'angular2/src/facade/collection';
|
||||
import {AST, ContextWithVariableBindings, ChangeDispatcher, ProtoChangeDetector, ChangeDetector, ChangeRecord}
|
||||
from 'change_detection/change_detection';
|
||||
from 'angular2/change_detection';
|
||||
|
||||
import {ProtoElementInjector, ElementInjector, PreBuiltObjects} from './element_injector';
|
||||
import {BindingPropagationConfig} from './binding_propagation_config';
|
||||
import {ElementBinder} from './element_binder';
|
||||
import {DirectiveMetadata} from './directive_metadata';
|
||||
import {SetterFn} from 'reflection/src/types';
|
||||
import {FIELD, IMPLEMENTS, int, isPresent, isBlank, BaseException} from 'facade/src/lang';
|
||||
import {Injector} from 'di/di';
|
||||
import {NgElement} from 'core/src/dom/element';
|
||||
import {SetterFn} from 'angular2/src/reflection/types';
|
||||
import {FIELD, IMPLEMENTS, int, isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
|
||||
import {Injector} from 'angular2/di';
|
||||
import {NgElement} from 'angular2/src/core/dom/element';
|
||||
import {ViewPort} from './viewport';
|
||||
import {OnChange} from './interfaces';
|
||||
import {Content} from './shadow_dom_emulation/content_tag';
|
||||
|
12
modules/angular2/src/core/compiler/viewport.js
vendored
12
modules/angular2/src/core/compiler/viewport.js
vendored
@ -1,10 +1,10 @@
|
||||
import {View, ProtoView} from './view';
|
||||
import {DOM, Node, Element} from 'facade/src/dom';
|
||||
import {ListWrapper, MapWrapper, List} from 'facade/src/collection';
|
||||
import {BaseException} from 'facade/src/lang';
|
||||
import {Injector} from 'di/di';
|
||||
import {ElementInjector} from 'core/src/compiler/element_injector';
|
||||
import {isPresent, isBlank} from 'facade/src/lang';
|
||||
import {DOM, Node, Element} from 'angular2/src/facade/dom';
|
||||
import {ListWrapper, MapWrapper, List} from 'angular2/src/facade/collection';
|
||||
import {BaseException} from 'angular2/src/facade/lang';
|
||||
import {Injector} from 'angular2/di';
|
||||
import {ElementInjector} from 'angular2/src/core/compiler/element_injector';
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
|
||||
export class ViewPort {
|
||||
parentView: View;
|
||||
|
4
modules/angular2/src/core/dom/element.js
vendored
4
modules/angular2/src/core/dom/element.js
vendored
@ -1,5 +1,5 @@
|
||||
import {DOM, Element} from 'facade/src/dom';
|
||||
import {normalizeBlank} from 'facade/src/lang';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
import {normalizeBlank} from 'angular2/src/facade/lang';
|
||||
|
||||
export class NgElement {
|
||||
domElement:Element;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {FIELD, print} from 'facade/src/lang';
|
||||
import {ChangeDetector} from 'change_detection/change_detection';
|
||||
import {VmTurnZone} from 'core/src/zone/vm_turn_zone';
|
||||
import {ListWrapper} from 'facade/src/collection';
|
||||
import {FIELD, print} from 'angular2/src/facade/lang';
|
||||
import {ChangeDetector} from 'angular2/change_detection';
|
||||
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
export class LifeCycle {
|
||||
_changeDetector:ChangeDetector;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {List, ListWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {normalizeBlank, isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {normalizeBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
export class VmTurnZone {
|
||||
_outerZone;
|
||||
|
2
modules/angular2/src/di/annotations.js
vendored
2
modules/angular2/src/di/annotations.js
vendored
@ -1,4 +1,4 @@
|
||||
import {CONST} from "facade/src/lang";
|
||||
import {CONST} from "angular2/src/facade/lang";
|
||||
|
||||
/**
|
||||
* A parameter annotation that creates a synchronous eager dependency.
|
||||
|
6
modules/angular2/src/di/binding.js
vendored
6
modules/angular2/src/di/binding.js
vendored
@ -1,6 +1,6 @@
|
||||
import {FIELD, Type, isBlank, isPresent} from 'facade/src/lang';
|
||||
import {List, MapWrapper, ListWrapper} from 'facade/src/collection';
|
||||
import {reflector} from 'reflection/src/reflection';
|
||||
import {FIELD, Type, isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {Key} from './key';
|
||||
import {Inject, InjectLazy, InjectPromise, DependencyAnnotation} from './annotations';
|
||||
import {NoAnnotationError} from './exceptions';
|
||||
|
4
modules/angular2/src/di/exceptions.js
vendored
4
modules/angular2/src/di/exceptions.js
vendored
@ -1,5 +1,5 @@
|
||||
import {ListWrapper, List} from 'facade/src/collection';
|
||||
import {stringify} from 'facade/src/lang';
|
||||
import {ListWrapper, List} from 'angular2/src/facade/collection';
|
||||
import {stringify} from 'angular2/src/facade/lang';
|
||||
import {Key} from './key';
|
||||
|
||||
function findFirstClosedCycle(keys:List) {
|
||||
|
6
modules/angular2/src/di/injector.js
vendored
6
modules/angular2/src/di/injector.js
vendored
@ -1,9 +1,9 @@
|
||||
import {Map, List, MapWrapper, ListWrapper} from 'facade/src/collection';
|
||||
import {Map, List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Binding, BindingBuilder, bind} from './binding';
|
||||
import {ProviderError, NoProviderError, InvalidBindingError,
|
||||
AsyncBindingError, CyclicDependencyError, InstantiationError} from './exceptions';
|
||||
import {FunctionWrapper, Type, isPresent, isBlank} from 'facade/src/lang';
|
||||
import {Promise, PromiseWrapper} from 'facade/src/async';
|
||||
import {FunctionWrapper, Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {Key} from './key';
|
||||
|
||||
var _constructing = new Object();
|
||||
|
4
modules/angular2/src/di/key.js
vendored
4
modules/angular2/src/di/key.js
vendored
@ -1,6 +1,6 @@
|
||||
import {KeyMetadataError} from './exceptions';
|
||||
import {MapWrapper, Map} from 'facade/src/collection';
|
||||
import {FIELD, int, isPresent} from 'facade/src/lang';
|
||||
import {MapWrapper, Map} from 'angular2/src/facade/collection';
|
||||
import {FIELD, int, isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
export class Key {
|
||||
token;
|
||||
|
6
modules/angular2/src/directives/ng_if.js
vendored
6
modules/angular2/src/directives/ng_if.js
vendored
@ -1,6 +1,6 @@
|
||||
import {Template} from 'core/src/annotations/annotations';
|
||||
import {ViewPort} from 'core/src/compiler/viewport';
|
||||
import {isBlank} from 'facade/src/lang';
|
||||
import {Template} from 'angular2/src/core/annotations/annotations';
|
||||
import {ViewPort} from 'angular2/src/core/compiler/viewport';
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
|
||||
@Template({
|
||||
selector: '[ng-if]',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Decorator} from 'core/src/annotations/annotations';
|
||||
import {Decorator} from 'angular2/src/core/annotations/annotations';
|
||||
|
||||
@Decorator({
|
||||
selector: '[ng-non-bindable]',
|
||||
|
12
modules/angular2/src/directives/ng_repeat.js
vendored
12
modules/angular2/src/directives/ng_repeat.js
vendored
@ -1,9 +1,9 @@
|
||||
import {Template} from 'core/src/annotations/annotations';
|
||||
import {OnChange} from 'core/src/compiler/interfaces';
|
||||
import {ViewPort} from 'core/src/compiler/viewport';
|
||||
import {View} from 'core/src/compiler/view';
|
||||
import {isPresent, isBlank} from 'facade/src/lang';
|
||||
import {ListWrapper} from 'facade/src/collection';
|
||||
import {Template} from 'angular2/src/core/annotations/annotations';
|
||||
import {OnChange} from 'angular2/src/core/compiler/interfaces';
|
||||
import {ViewPort} from 'angular2/src/core/compiler/viewport';
|
||||
import {View} from 'angular2/src/core/compiler/view';
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
@Template({
|
||||
selector: '[ng-repeat]',
|
||||
|
14
modules/angular2/src/directives/ng_switch.js
vendored
14
modules/angular2/src/directives/ng_switch.js
vendored
@ -1,10 +1,10 @@
|
||||
import {Decorator, Template} from 'core/src/annotations/annotations';
|
||||
import {ViewPort} from 'core/src/compiler/viewport';
|
||||
import {NgElement} from 'core/src/dom/element';
|
||||
import {DOM} from 'facade/src/dom';
|
||||
import {isPresent, isBlank} from 'facade/src/lang';
|
||||
import {ListWrapper, List, MapWrapper, Map} from 'facade/src/collection';
|
||||
import {Parent} from 'core/src/annotations/visibility';
|
||||
import {Decorator, Template} from 'angular2/src/core/annotations/annotations';
|
||||
import {ViewPort} from 'angular2/src/core/compiler/viewport';
|
||||
import {NgElement} from 'angular2/src/core/dom/element';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, List, MapWrapper, Map} from 'angular2/src/facade/collection';
|
||||
import {Parent} from 'angular2/src/core/annotations/visibility';
|
||||
|
||||
/**
|
||||
* The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {int} from 'facade/src/lang';
|
||||
import {List} from 'facade/src/collection';
|
||||
import {int} from 'angular2/src/facade/lang';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
export var Promise = window.Promise;
|
||||
|
||||
export class PromiseWrapper {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {int, isJsObject} from 'facade/src/lang';
|
||||
import {int, isJsObject} from 'angular2/src/facade/lang';
|
||||
|
||||
export var List = window.Array;
|
||||
export var Map = window.Map;
|
||||
|
@ -9,7 +9,7 @@ export var document = window.document;
|
||||
export var location = window.location;
|
||||
export var gc = window.gc ? () => window.gc() : () => null;
|
||||
|
||||
import {List, MapWrapper, ListWrapper} from 'facade/src/collection';
|
||||
import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
export class DOM {
|
||||
static query(selector) {
|
||||
|
@ -3,7 +3,7 @@ library reflection.reflection;
|
||||
import 'reflector.dart';
|
||||
import 'types.dart';
|
||||
export 'reflector.dart';
|
||||
import 'package:facade/src/lang.dart';
|
||||
import 'package:angular2/src/facade/lang.dart';
|
||||
|
||||
class NoReflectionCapabilities {
|
||||
Function factory(Type type){
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Type, isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Reflector} from './reflector';
|
||||
export {Reflector} from './reflector';
|
||||
import {ReflectionCapabilities} from './reflection_capabilities';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Type, isPresent} from 'facade/src/lang';
|
||||
import {List, ListWrapper} from 'facade/src/collection';
|
||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
|
||||
export class ReflectionCapabilities {
|
||||
|
4
modules/angular2/src/reflection/reflector.js
vendored
4
modules/angular2/src/reflection/reflector.js
vendored
@ -1,5 +1,5 @@
|
||||
import {Type, isPresent, stringify, BaseException} from 'facade/src/lang';
|
||||
import {List, ListWrapper, Map, MapWrapper, StringMapWrapper} from 'facade/src/collection';
|
||||
import {Type, isPresent, stringify, BaseException} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {SetterFn, GetterFn, MethodFn} from './types';
|
||||
export {SetterFn, GetterFn, MethodFn} from './types';
|
||||
|
||||
|
33
modules/angular2/src/test_lib/benchmark_util.js
vendored
Normal file
33
modules/angular2/src/test_lib/benchmark_util.js
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import {DOM, document, location} from 'angular2/src/facade/dom';
|
||||
import {NumberWrapper, BaseException, isBlank} from 'angular2/src/facade/lang';
|
||||
|
||||
export function getIntParameter(name:string) {
|
||||
return NumberWrapper.parseInt(getStringParameter(name), 10);
|
||||
}
|
||||
|
||||
export function getStringParameter(name:string) {
|
||||
var els = DOM.querySelectorAll(document, `input[name="${name}"]`)
|
||||
var value;
|
||||
var el;
|
||||
|
||||
for (var i=0; i<els.length; i++) {
|
||||
el = els[i];
|
||||
if ((el.type !== 'radio' && el.type !== 'checkbox') || el.checked) {
|
||||
value = el.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isBlank(value)) {
|
||||
throw new BaseException(`Could not find and input field with name ${name}`);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export function bindAction(selector:string, callback:Function) {
|
||||
var el = DOM.querySelector(document, selector);
|
||||
DOM.on(el, 'click', function(_) {
|
||||
callback();
|
||||
});
|
||||
}
|
72
modules/angular2/src/test_lib/test_lib.dart
Normal file
72
modules/angular2/src/test_lib/test_lib.dart
Normal file
@ -0,0 +1,72 @@
|
||||
library test_lib.test_lib;
|
||||
|
||||
import 'package:guinness/guinness_html.dart' as gns;
|
||||
export 'package:guinness/guinness_html.dart';
|
||||
import 'package:unittest/unittest.dart' hide expect;
|
||||
import 'dart:mirrors';
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/reflection/reflection.dart';
|
||||
import 'package:angular2/src/facade/dom.dart';
|
||||
import 'package:angular2/src/reflection/reflection_capabilities.dart';
|
||||
|
||||
bool IS_DARTIUM = true;
|
||||
|
||||
Expect expect(actual, [matcher]) {
|
||||
final expect = new Expect(actual);
|
||||
if (matcher != null) expect.to(matcher);
|
||||
return expect;
|
||||
}
|
||||
|
||||
class Expect extends gns.Expect {
|
||||
Expect(actual) : super(actual);
|
||||
|
||||
NotExpect get not => new NotExpect(actual);
|
||||
|
||||
void toEqual(expected) => toHaveSameProps(expected);
|
||||
void toThrowError([message=""]) => this.toThrowWith(message: message);
|
||||
void toBePromise() => _expect(actual is Future, equals(true));
|
||||
void toImplement(expected) => toBeA(expected);
|
||||
Function get _expect => gns.guinness.matchers.expect;
|
||||
}
|
||||
|
||||
class NotExpect extends gns.NotExpect {
|
||||
NotExpect(actual) : super(actual);
|
||||
|
||||
void toEqual(expected) => toHaveSameProps(expected);
|
||||
}
|
||||
|
||||
beforeEach(fn) {
|
||||
gns.guinnessEnableHtmlMatchers();
|
||||
gns.beforeEach(_enableReflection(fn));
|
||||
}
|
||||
|
||||
it(name, fn) {
|
||||
gns.it(name, _enableReflection(_handleAsync(fn)));
|
||||
}
|
||||
|
||||
iit(name, fn) {
|
||||
gns.iit(name, _enableReflection(_handleAsync(fn)));
|
||||
}
|
||||
|
||||
_enableReflection(fn) {
|
||||
return () {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
return fn();
|
||||
};
|
||||
}
|
||||
|
||||
_handleAsync(fn) {
|
||||
ClosureMirror cm = reflect(fn);
|
||||
MethodMirror mm = cm.function;
|
||||
|
||||
var completer = new Completer();
|
||||
|
||||
if (mm.parameters.length == 1) {
|
||||
return () {
|
||||
cm.apply([completer.complete]);
|
||||
return completer.future;
|
||||
};
|
||||
}
|
||||
|
||||
return fn;
|
||||
}
|
164
modules/angular2/src/test_lib/test_lib.es6
Normal file
164
modules/angular2/src/test_lib/test_lib.es6
Normal file
@ -0,0 +1,164 @@
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
|
||||
export var describe = window.describe;
|
||||
export var xdescribe = window.xdescribe;
|
||||
export var ddescribe = window.ddescribe;
|
||||
export var it = window.it;
|
||||
export var xit = window.xit;
|
||||
export var iit = window.iit;
|
||||
export var beforeEach = window.beforeEach;
|
||||
export var afterEach = window.afterEach;
|
||||
export var expect = window.expect;
|
||||
export var IS_DARTIUM = false;
|
||||
|
||||
// To make testing consistent between dart and js
|
||||
window.print = function(msg) {
|
||||
if (window.dump) {
|
||||
window.dump(msg);
|
||||
} else {
|
||||
window.console.log(msg);
|
||||
}
|
||||
};
|
||||
|
||||
// Some Map polyfills don't polyfill Map.toString correctly, which
|
||||
// gives us bad error messages in tests.
|
||||
// The only way to do this in Jasmine is to monkey patch a method
|
||||
// to the object :-(
|
||||
window.Map.prototype.jasmineToString = function() {
|
||||
var m = this;
|
||||
if (!m) {
|
||||
return ''+m;
|
||||
}
|
||||
var res = [];
|
||||
m.forEach( (v,k) => {
|
||||
res.push(`${k}:${v}`);
|
||||
});
|
||||
return `{ ${res.join(',')} }`;
|
||||
}
|
||||
|
||||
window.beforeEach(function() {
|
||||
jasmine.addMatchers({
|
||||
// Custom handler for Map as Jasmine does not support it yet
|
||||
toEqual: function(util, customEqualityTesters) {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
return {
|
||||
pass: util.equals(actual, expected, [compareMap])
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
function compareMap(actual, expected) {
|
||||
if (actual instanceof Map) {
|
||||
var pass = actual.size === expected.size;
|
||||
if (pass) {
|
||||
actual.forEach( (v,k) => {
|
||||
pass = pass && util.equals(v, expected.get(k));
|
||||
});
|
||||
}
|
||||
return pass;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
toBePromise: function() {
|
||||
return {
|
||||
compare: function (actual, expectedClass) {
|
||||
var pass = typeof actual === 'object' && typeof actual.then === 'function';
|
||||
return {
|
||||
pass: pass,
|
||||
get message() {
|
||||
return 'Expected ' + actual + ' to be a promise';
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
toBeAnInstanceOf: function() {
|
||||
return {
|
||||
compare: function(actual, expectedClass) {
|
||||
var pass = typeof actual === 'object' && actual instanceof expectedClass;
|
||||
return {
|
||||
pass: pass,
|
||||
get message() {
|
||||
return 'Expected ' + actual + ' to be an instance of ' + expectedClass;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
toHaveText: function() {
|
||||
return {
|
||||
compare: function(actual, expectedText) {
|
||||
var actualText = elementText(actual);
|
||||
return {
|
||||
pass: actualText == expectedText,
|
||||
get message() {
|
||||
return 'Expected ' + actualText + ' to be equal to ' + expectedText;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
toImplement: function() {
|
||||
return {
|
||||
compare: function(actualObject, expectedInterface) {
|
||||
var objProps = Object.keys(actualObject.constructor.prototype);
|
||||
var intProps = Object.keys(expectedInterface.prototype);
|
||||
|
||||
var missedMethods = [];
|
||||
intProps.forEach((k) => {
|
||||
if (!actualObject.constructor.prototype[k]) missedMethods.push(k);
|
||||
});
|
||||
|
||||
return {
|
||||
pass: missedMethods.length == 0,
|
||||
get message() {
|
||||
return 'Expected ' + actualObject + ' to have the following methods: ' + missedMethods.join(", ");
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export class SpyObject {
|
||||
spy(name){
|
||||
if (! this[name]) {
|
||||
this[name] = this._createGuinnessCompatibleSpy();
|
||||
}
|
||||
return this[name];
|
||||
}
|
||||
|
||||
rttsAssert(value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
_createGuinnessCompatibleSpy(){
|
||||
var newSpy = jasmine.createSpy();
|
||||
newSpy.andCallFake = newSpy.and.callFake;
|
||||
return newSpy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function elementText(n) {
|
||||
var hasShadowRoot = (n) => n instanceof Element && n.shadowRoot;
|
||||
var hasNodes = (n) => n.childNodes && n.childNodes.length > 0;
|
||||
|
||||
if (n instanceof Comment) return '';
|
||||
|
||||
if (n instanceof Array) return n.map((nn) => elementText(nn)).join("");
|
||||
if (n instanceof Element && n.tagName == 'CONTENT')
|
||||
return elementText(Array.prototype.slice.apply(n.getDistributedNodes()));
|
||||
if (hasShadowRoot(n)) return elementText(DOM.childNodesAsList(n.shadowRoot));
|
||||
if (hasNodes(n)) return elementText(DOM.childNodesAsList(n));
|
||||
|
||||
return n.textContent;
|
||||
}
|
43
modules/angular2/src/test_lib/utils.js
vendored
Normal file
43
modules/angular2/src/test_lib/utils.js
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
export class Log {
|
||||
_result:List;
|
||||
|
||||
constructor() {
|
||||
this._result = [];
|
||||
}
|
||||
|
||||
add(value) {
|
||||
ListWrapper.push(this._result, value);
|
||||
}
|
||||
|
||||
fn(value) {
|
||||
return () => {
|
||||
ListWrapper.push(this._result, value);
|
||||
}
|
||||
}
|
||||
|
||||
result() {
|
||||
return ListWrapper.join(this._result, "; ");
|
||||
}
|
||||
}
|
||||
|
||||
export function queryView(view, selector) {
|
||||
for (var i = 0; i < view.nodes.length; ++i) {
|
||||
var res = DOM.querySelector(view.nodes[i], selector);
|
||||
if (isPresent(res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function dispatchEvent(element, eventType) {
|
||||
DOM.dispatchEvent(element, DOM.createEvent(eventType));
|
||||
}
|
||||
|
||||
export function el(html) {
|
||||
return DOM.firstChild(DOM.createTemplate(html).content);
|
||||
}
|
Reference in New Issue
Block a user