repackaging: all the repackaging changes squashed
This commit is contained in:
1
modules/@angular/platform-browser/core_private.dart
Normal file
1
modules/@angular/platform-browser/core_private.dart
Normal file
@ -0,0 +1 @@
|
||||
export '../core/private_export.dart';
|
9
modules/@angular/platform-browser/core_private.ts
Normal file
9
modules/@angular/platform-browser/core_private.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
|
||||
|
||||
export type RenderDebugInfo = t.RenderDebugInfo;
|
||||
export var RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo;
|
||||
export var wtfInit: typeof t.wtfInit = r.wtfInit;
|
||||
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities;
|
||||
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES;
|
||||
export type DebugDomRootRenderer = t.DebugDomRootRenderer;
|
||||
export var DebugDomRootRenderer: typeof t.DebugDomRootRenderer = r.DebugDomRootRenderer;
|
1
modules/@angular/platform-browser/index.ts
Normal file
1
modules/@angular/platform-browser/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './src/platform_browser';
|
15
modules/@angular/platform-browser/package.json
Normal file
15
modules/@angular/platform-browser/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@angular/platform-browser",
|
||||
"version": "$$ANGULAR_VERSION$$",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"jsnext:main": "esm/index.js",
|
||||
"typings": "index.d.ts",
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@angular/core": "$$ANGULAR_VERSION$$",
|
||||
"@angular/common": "$$ANGULAR_VERSION$$",
|
||||
"@angular/compiler": "$$ANGULAR_VERSION$$"
|
||||
}
|
||||
}
|
6
modules/@angular/platform-browser/private_export.dart
Normal file
6
modules/@angular/platform-browser/private_export.dart
Normal file
@ -0,0 +1,6 @@
|
||||
export './src/dom/dom_adapter.dart' show DomAdapter, setRootDomAdapter;
|
||||
export '../src/animate/animation_builder' show AnimationBuilder, Animation;
|
||||
export '../src/animate/css_animation_builder' show CssAnimationBuilder;
|
||||
export '../src/animate/browser_details' show BrowserDetails;
|
||||
export './src/animate/css_animation_options' show CssAnimationOptions;
|
||||
export './src/animate/animation' show Animation;
|
41
modules/@angular/platform-browser/private_export.ts
Normal file
41
modules/@angular/platform-browser/private_export.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import * as animation_builder from './src/animate/animation_builder';
|
||||
import * as css_animation_builder from './src/animate/css_animation_builder';
|
||||
import * as browser_details from './src/animate/browser_details';
|
||||
import * as css_animation_options from './src/animate/css_animation_options';
|
||||
import * as animation from './src/animate/animation';
|
||||
import * as dom_adapter from './src/dom/dom_adapter';
|
||||
import * as browser_adapter from './src/browser/browser_adapter';
|
||||
|
||||
|
||||
export namespace __platform_browser_private__ {
|
||||
export type DomAdapter = dom_adapter.DomAdapter;
|
||||
export var DomAdapter = dom_adapter.DomAdapter;
|
||||
|
||||
export function getDOM():DomAdapter{
|
||||
return dom_adapter.getDOM();
|
||||
}
|
||||
|
||||
export function setDOM(adapter:DomAdapter){
|
||||
return dom_adapter.setDOM(adapter);
|
||||
}
|
||||
|
||||
export var setRootDomAdapter = dom_adapter.setRootDomAdapter;
|
||||
|
||||
export type BrowserDomAdapter = browser_adapter.BrowserDomAdapter;
|
||||
export var BrowserDomAdapter = browser_adapter.BrowserDomAdapter;
|
||||
|
||||
export type AnimationBuilder = animation_builder.AnimationBuilder;
|
||||
export var AnimationBuilder = animation_builder.AnimationBuilder;
|
||||
|
||||
export type CssAnimationBuilder = css_animation_builder.CssAnimationBuilder
|
||||
export var CssAnimationBuilder = css_animation_builder.CssAnimationBuilder;
|
||||
|
||||
export type CssAnimationOptions = css_animation_options.CssAnimationOptions;
|
||||
export var CssAnimationOptions = css_animation_options.CssAnimationOptions;
|
||||
|
||||
export type Animation = animation.Animation;
|
||||
export var Animation = animation.Animation;
|
||||
|
||||
export type BrowserDetails = browser_details.BrowserDetails;
|
||||
export var BrowserDetails = browser_details.BrowserDetails;
|
||||
}
|
19
modules/@angular/platform-browser/rollup.config.js
Normal file
19
modules/@angular/platform-browser/rollup.config.js
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/platform-browser/esm/index.js',
|
||||
dest: '../../../dist/packages-dist/platform-browser/esm/platform-browser.umd.js',
|
||||
sourceMap: true,
|
||||
format: 'umd',
|
||||
moduleName: 'ng.platformBrowser',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
'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 }),
|
||||
]
|
||||
}
|
@ -4,11 +4,11 @@ import {
|
||||
RegExpWrapper,
|
||||
NumberWrapper,
|
||||
isPresent
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {Math} from 'angular2/src/facade/math';
|
||||
import {camelCaseToDashCase} from 'angular2/src/platform/dom/util';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
} from '../../src/facade/lang';
|
||||
import {Math} from '../../src/facade/math';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {camelCaseToDashCase} from '../dom/util';
|
||||
import {getDOM} from '../dom/dom_adapter';
|
||||
|
||||
import {BrowserDetails} from './browser_details';
|
||||
import {CssAnimationOptions} from './css_animation_options';
|
||||
@ -50,7 +50,7 @@ export class Animation {
|
||||
constructor(public element: HTMLElement, public data: CssAnimationOptions,
|
||||
public browserDetails: BrowserDetails) {
|
||||
this.startTime = DateWrapper.toMillis(DateWrapper.now());
|
||||
this._stringPrefix = DOM.getAnimationPrefix();
|
||||
this._stringPrefix = getDOM().getAnimationPrefix();
|
||||
this.setup();
|
||||
this.wait((timestamp: any) => this.start());
|
||||
}
|
||||
@ -79,7 +79,7 @@ export class Animation {
|
||||
this.addClasses(this.data.animationClasses);
|
||||
this.removeClasses(this.data.classesToRemove);
|
||||
if (this.data.toStyles != null) this.applyStyles(this.data.toStyles);
|
||||
var computedStyles = DOM.getComputedStyle(this.element);
|
||||
var computedStyles = getDOM().getComputedStyle(this.element);
|
||||
this.computedDelay =
|
||||
Math.max(this.parseDurationString(
|
||||
computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')),
|
||||
@ -99,10 +99,10 @@ export class Animation {
|
||||
applyStyles(styles: {[key: string]: any}): void {
|
||||
StringMapWrapper.forEach(styles, (value: any, key: string) => {
|
||||
var dashCaseKey = camelCaseToDashCase(key);
|
||||
if (isPresent(DOM.getStyle(this.element, dashCaseKey))) {
|
||||
DOM.setStyle(this.element, dashCaseKey, value.toString());
|
||||
if (isPresent(getDOM().getStyle(this.element, dashCaseKey))) {
|
||||
getDOM().setStyle(this.element, dashCaseKey, value.toString());
|
||||
} else {
|
||||
DOM.setStyle(this.element, this._stringPrefix + dashCaseKey, value.toString());
|
||||
getDOM().setStyle(this.element, this._stringPrefix + dashCaseKey, value.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -112,7 +112,7 @@ export class Animation {
|
||||
* @param classes
|
||||
*/
|
||||
addClasses(classes: string[]): void {
|
||||
for (let i = 0, len = classes.length; i < len; i++) DOM.addClass(this.element, classes[i]);
|
||||
for (let i = 0, len = classes.length; i < len; i++) getDOM().addClass(this.element, classes[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,7 +120,7 @@ export class Animation {
|
||||
* @param classes
|
||||
*/
|
||||
removeClasses(classes: string[]): void {
|
||||
for (let i = 0, len = classes.length; i < len; i++) DOM.removeClass(this.element, classes[i]);
|
||||
for (let i = 0, len = classes.length; i < len; i++) getDOM().removeClass(this.element, classes[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,8 +128,8 @@ export class Animation {
|
||||
*/
|
||||
addEvents(): void {
|
||||
if (this.totalTime > 0) {
|
||||
this.eventClearFunctions.push(DOM.onAndCancel(
|
||||
this.element, DOM.getTransitionEnd(), (event: any) => this.handleAnimationEvent(event)));
|
||||
this.eventClearFunctions.push(getDOM().onAndCancel(
|
||||
this.element, getDOM().getTransitionEnd(), (event: any) => this.handleAnimationEvent(event)));
|
||||
} else {
|
||||
this.handleAnimationCompleted();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {CssAnimationBuilder} from './css_animation_builder';
|
||||
import {BrowserDetails} from './browser_details';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {Math} from 'angular2/src/facade/math';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Math} from '../../src/facade/math';
|
||||
import {getDOM} from '../dom/dom_adapter';
|
||||
|
||||
@Injectable()
|
||||
export class BrowserDetails {
|
||||
@ -13,17 +13,17 @@ export class BrowserDetails {
|
||||
* time, Chrome and Opera seem to be the only browsers that include this.
|
||||
*/
|
||||
doesElapsedTimeIncludesDelay(): void {
|
||||
var div = DOM.createElement('div');
|
||||
DOM.setAttribute(div, 'style', `position: absolute; top: -9999px; left: -9999px; width: 1px;
|
||||
var div = getDOM().createElement('div');
|
||||
getDOM().setAttribute(div, 'style', `position: absolute; top: -9999px; left: -9999px; width: 1px;
|
||||
height: 1px; transition: all 1ms linear 1ms;`);
|
||||
// Firefox requires that we wait for 2 frames for some reason
|
||||
this.raf((timestamp: any) => {
|
||||
DOM.on(div, 'transitionend', (event: any) => {
|
||||
getDOM().on(div, 'transitionend', (event: any) => {
|
||||
var elapsed = Math.round(event.elapsedTime * 1000);
|
||||
this.elapsedTimeIncludesDelay = elapsed == 2;
|
||||
DOM.remove(div);
|
||||
getDOM().remove(div);
|
||||
});
|
||||
DOM.setStyle(div, 'width', '2px');
|
||||
getDOM().setStyle(div, 'width', '2px');
|
||||
}, 2);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ class RafQueue {
|
||||
constructor(public callback: Function, public frames: number) { this._raf(); }
|
||||
private _raf() {
|
||||
this.currentFrameId =
|
||||
DOM.requestAnimationFrame((timestamp: number) => this._nextFrame(timestamp));
|
||||
getDOM().requestAnimationFrame((timestamp: number) => this._nextFrame(timestamp));
|
||||
}
|
||||
private _nextFrame(timestamp: number) {
|
||||
this.frames--;
|
||||
@ -49,7 +49,7 @@ class RafQueue {
|
||||
}
|
||||
}
|
||||
cancel() {
|
||||
DOM.cancelAnimationFrame(this.currentFrameId);
|
||||
getDOM().cancelAnimationFrame(this.currentFrameId);
|
||||
this.currentFrameId = null;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {isBlank, isPresent, global, setValueOnPath, DateWrapper} from 'angular2/src/facade/lang';
|
||||
import {setRootDomAdapter} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {isBlank, isPresent, global, setValueOnPath, DateWrapper} from '../../src/facade/lang';
|
||||
|
||||
import {GenericBrowserDomAdapter} from './generic_browser_adapter';
|
||||
import {setRootDomAdapter} from '../dom/dom_adapter';
|
||||
|
||||
var _attrToPropMap = {
|
||||
'class': 'className',
|
||||
|
@ -1,7 +1,6 @@
|
||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {isPresent, isFunction, Type} from 'angular2/src/facade/lang';
|
||||
import {DomAdapter} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {isPresent, isFunction, Type} from '../../src/facade/lang';
|
||||
import {DomAdapter} from '../dom/dom_adapter';
|
||||
|
||||
|
||||
/**
|
||||
@ -42,7 +41,6 @@ export abstract class GenericBrowserDomAdapter extends DomAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
getXHR(): Type { return XHRImpl; }
|
||||
getDistributedNodes(el: HTMLElement): Node[] { return (<any>el).getDistributedNodes(); }
|
||||
resolveAndSetHref(el: HTMLAnchorElement, baseUrl: string, href: string) {
|
||||
el.href = href == null ? baseUrl : baseUrl + '/../' + href;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {Injectable} from 'angular2/src/core/di/decorators';
|
||||
import {UrlChangeListener, PlatformLocation} from './platform_location';
|
||||
import {History, Location} from 'angular2/src/facade/browser';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {History, Location} from '../../../src/facade/browser';
|
||||
import {UrlChangeListener, PlatformLocation} from '@angular/common';
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* `PlatformLocation` encapsulates all of the direct calls to platform APIs.
|
||||
@ -21,21 +23,21 @@ export class BrowserPlatformLocation extends PlatformLocation {
|
||||
// This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
|
||||
/** @internal */
|
||||
_init() {
|
||||
this._location = DOM.getLocation();
|
||||
this._history = DOM.getHistory();
|
||||
this._location = getDOM().getLocation();
|
||||
this._history = getDOM().getHistory();
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
get location(): Location { return this._location; }
|
||||
|
||||
getBaseHrefFromDOM(): string { return DOM.getBaseHref(); }
|
||||
getBaseHrefFromDOM(): string { return getDOM().getBaseHref(); }
|
||||
|
||||
onPopState(fn: UrlChangeListener): void {
|
||||
DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false);
|
||||
getDOM().getGlobalEventTarget('window').addEventListener('popstate', fn, false);
|
||||
}
|
||||
|
||||
onHashChange(fn: UrlChangeListener): void {
|
||||
DOM.getGlobalEventTarget('window').addEventListener('hashchange', fn, false);
|
||||
getDOM().getGlobalEventTarget('window').addEventListener('hashchange', fn, false);
|
||||
}
|
||||
|
||||
get pathname(): string { return this._location.pathname; }
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {DomAdapter} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
||||
import {PromiseWrapper} from '../../src/facade/async';
|
||||
import {DomAdapter} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {ElementRef} from '@angular/core/src/linker/element_ref';
|
||||
|
||||
export class Rectangle {
|
||||
left;
|
||||
|
@ -126,7 +126,7 @@ class BrowserGetTestability implements GetTestability {
|
||||
}
|
||||
return _jsify(result);
|
||||
};
|
||||
js.context['getAllAngularTestabilities'] =
|
||||
js.context['getAllAngularTestabilities'] =
|
||||
_jsify(getAllAngularTestabilities);
|
||||
|
||||
var whenAllStable = _jsify((callback) {
|
||||
@ -162,10 +162,10 @@ class BrowserGetTestability implements GetTestability {
|
||||
} else if (!findInAncestors) {
|
||||
return null;
|
||||
}
|
||||
if (DOM.isShadowRoot(elem)) {
|
||||
return this.findTestabilityInTree(registry, DOM.getHost(elem), true);
|
||||
if (getDOM().isShadowRoot(elem)) {
|
||||
return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
|
||||
}
|
||||
return this.findTestabilityInTree(registry, DOM.parentElement(elem), true);
|
||||
return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
|
||||
}
|
||||
|
||||
js.JsObject _createRegistry(TestabilityRegistry registry) {
|
||||
|
@ -1,17 +1,16 @@
|
||||
import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {global, isPresent} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {PromiseWrapper, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
|
||||
import {
|
||||
Injectable,
|
||||
TestabilityRegistry,
|
||||
Testability,
|
||||
GetTestability,
|
||||
setTestabilityGetter
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {global, isPresent} from '../../src/facade/lang';
|
||||
import {getDOM} from '../dom/dom_adapter';
|
||||
|
||||
|
||||
|
||||
class PublicTestability {
|
||||
/** @internal */
|
||||
@ -82,9 +81,9 @@ export class BrowserGetTestability implements GetTestability {
|
||||
} else if (!findInAncestors) {
|
||||
return null;
|
||||
}
|
||||
if (DOM.isShadowRoot(elem)) {
|
||||
return this.findTestabilityInTree(registry, DOM.getHost(elem), true);
|
||||
if (getDOM().isShadowRoot(elem)) {
|
||||
return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
|
||||
}
|
||||
return this.findTestabilityInTree(registry, DOM.parentElement(elem), true);
|
||||
return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
|
||||
import {getDOM} from '../dom/dom_adapter';
|
||||
/**
|
||||
* A service that can be used to get and set the title of a current HTML document.
|
||||
*
|
||||
@ -13,11 +12,11 @@ export class Title {
|
||||
* Get the title of the current HTML document.
|
||||
* @returns {string}
|
||||
*/
|
||||
getTitle(): string { return DOM.getTitle(); }
|
||||
getTitle(): string { return getDOM().getTitle(); }
|
||||
|
||||
/**
|
||||
* Set the title of the current HTML document.
|
||||
* @param newTitle
|
||||
*/
|
||||
setTitle(newTitle: string) { DOM.setTitle(newTitle); }
|
||||
setTitle(newTitle: string) { getDOM().setTitle(newTitle); }
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
||||
import {isPresent, NumberWrapper} from 'angular2/src/facade/lang';
|
||||
import {window} from 'angular2/src/facade/browser';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {ApplicationRef, ComponentRef} from '@angular/core';
|
||||
import {isPresent, NumberWrapper} from '../../../src/facade/lang';
|
||||
import {window} from '../../../src/facade/browser';
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
|
||||
|
||||
export class ChangeDetectionPerfRecord {
|
||||
constructor(public msPerTick: number, public numTicks: number) {}
|
||||
@ -51,13 +51,13 @@ export class AngularProfiler {
|
||||
if (record && isProfilerAvailable) {
|
||||
window.console.profile(profileName);
|
||||
}
|
||||
var start = DOM.performanceNow();
|
||||
var start = getDOM().performanceNow();
|
||||
var numTicks = 0;
|
||||
while (numTicks < 5 || (DOM.performanceNow() - start) < 500) {
|
||||
while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
|
||||
this.appRef.tick();
|
||||
numTicks++;
|
||||
}
|
||||
var end = DOM.performanceNow();
|
||||
var end = getDOM().performanceNow();
|
||||
if (record && isProfilerAvailable) {
|
||||
// need to cast to <any> because type checker thinks there's no argument
|
||||
// while in fact there is:
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
||||
import {ComponentRef} from '@angular/core';
|
||||
import {global} from '../../../src/facade/lang';
|
||||
|
||||
import {AngularTools} from './common_tools';
|
||||
|
||||
var context = <any>global;
|
||||
|
@ -1,50 +1,42 @@
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {provide, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {
|
||||
Provider,
|
||||
PLATFORM_INITIALIZER,
|
||||
PLATFORM_DIRECTIVES,
|
||||
PLATFORM_PIPES,
|
||||
ComponentRef,
|
||||
ExceptionHandler,
|
||||
Reflector,
|
||||
RootRenderer,
|
||||
reflector,
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
PLATFORM_COMMON_PROVIDERS
|
||||
} from "angular2/core";
|
||||
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from "angular2/common";
|
||||
import {Testability} from 'angular2/src/core/testability/testability';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
|
||||
import {KeyEventsPlugin} from 'angular2/src/platform/dom/events/key_events';
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {DomRootRenderer, DomRootRenderer_} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {DomSharedStylesHost, SharedStylesHost} from 'angular2/src/platform/dom/shared_styles_host';
|
||||
import {BrowserDetails} from "angular2/src/animate/browser_details";
|
||||
import {AnimationBuilder} from "angular2/src/animate/animation_builder";
|
||||
PLATFORM_COMMON_PROVIDERS,
|
||||
OpaqueToken,
|
||||
Testability
|
||||
} from '@angular/core';
|
||||
import {wtfInit} from '../core_private';
|
||||
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from '@angular/common';
|
||||
|
||||
import {IS_DART} from './facade/lang';
|
||||
import {BrowserDomAdapter} from './browser/browser_adapter';
|
||||
import {BrowserGetTestability} from 'angular2/src/platform/browser/testability';
|
||||
import {CachedXHR} from 'angular2/src/platform/browser/xhr_cache';
|
||||
import {wtfInit} from 'angular2/src/core/profile/wtf_init';
|
||||
import {EventManager, EVENT_MANAGER_PLUGINS} from "angular2/src/platform/dom/events/event_manager";
|
||||
import {BrowserGetTestability} from './browser/testability';
|
||||
import {getDOM} from './dom/dom_adapter';
|
||||
import {DOCUMENT} from './dom/dom_tokens';
|
||||
import {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
|
||||
import {DomRootRenderer, DomRootRenderer_} from './dom/dom_renderer';
|
||||
import {SharedStylesHost} from './dom/shared_styles_host';
|
||||
import {KeyEventsPlugin} from './dom/events/key_events';
|
||||
import {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
|
||||
import {DomEventsPlugin} from './dom/events/dom_events';
|
||||
import {
|
||||
HAMMER_GESTURE_CONFIG,
|
||||
HammerGestureConfig,
|
||||
HammerGesturesPlugin
|
||||
} from 'angular2/src/platform/dom/events/hammer_gestures';
|
||||
import {ELEMENT_PROBE_PROVIDERS} from 'angular2/platform/common_dom';
|
||||
export {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
export {Title} from 'angular2/src/platform/browser/title';
|
||||
export {
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
ELEMENT_PROBE_PROVIDERS_PROD_MODE,
|
||||
inspectNativeElement,
|
||||
By
|
||||
} from 'angular2/platform/common_dom';
|
||||
} from './dom/events/hammer_gestures'
|
||||
import {DomSharedStylesHost} from './dom/shared_styles_host';
|
||||
import {AnimationBuilder} from './animate/animation_builder';
|
||||
import {BrowserDetails} from './animate/browser_details';
|
||||
|
||||
export {Title} from './browser/title';
|
||||
export {BrowserDomAdapter} from './browser/browser_adapter';
|
||||
export {enableDebugTools, disableDebugTools} from 'angular2/src/platform/browser/tools/tools';
|
||||
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures';
|
||||
export {enableDebugTools, disableDebugTools} from './browser/tools/tools';
|
||||
export {By} from './dom/debug/by';
|
||||
|
||||
export const BROWSER_PLATFORM_MARKER =
|
||||
/*@ts2dart_const*/ new OpaqueToken('BrowserPlatformMarker');
|
||||
@ -63,11 +55,11 @@ export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2d
|
||||
function _exceptionHandler(): ExceptionHandler {
|
||||
// !IS_DART is required because we must rethrow exceptions in JS,
|
||||
// but must not rethrow exceptions in Dart
|
||||
return new ExceptionHandler(DOM, !IS_DART);
|
||||
return new ExceptionHandler(getDOM(), !IS_DART);
|
||||
}
|
||||
|
||||
function _document(): any {
|
||||
return DOM.defaultDoc();
|
||||
return getDOM().defaultDoc();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,8 +90,12 @@ export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/
|
||||
ELEMENT_PROBE_PROVIDERS
|
||||
];
|
||||
|
||||
export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
|
||||
/*@ts2dart_const*/[/*@ts2dart_Provider*/ {provide: XHR, useClass: CachedXHR}];
|
||||
|
||||
export {
|
||||
HAMMER_GESTURE_CONFIG,
|
||||
HammerGestureConfig
|
||||
} from '../src/dom/events/hammer_gestures'
|
||||
|
||||
|
||||
export function initDomAdapter() {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {Predicate} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DebugElement} from 'angular2/core';
|
||||
import {DebugElement} from '@angular/core';
|
||||
import {Type, isPresent} from '../../../src/facade/lang';
|
||||
import {Predicate} from '../../../src/facade/collection';
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
|
||||
|
||||
/**
|
||||
* Predicates for use with {@link DebugElement}'s query functions.
|
||||
@ -26,7 +27,7 @@ export class By {
|
||||
static css(selector: string): Predicate<DebugElement> {
|
||||
return (debugElement) => {
|
||||
return isPresent(debugElement.nativeElement) ?
|
||||
DOM.elementMatches(debugElement.nativeElement, selector) :
|
||||
getDOM().elementMatches(debugElement.nativeElement, selector) :
|
||||
false;
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {assertionsEnabled} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DebugNode, getDebugNode} from 'angular2/src/core/debug/debug_node';
|
||||
import {DomRootRenderer} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {RootRenderer, NgZone, ApplicationRef} from 'angular2/core';
|
||||
import {DebugDomRootRenderer} from 'angular2/src/core/debug/debug_renderer';
|
||||
import {DebugNode, getDebugNode, Provider, RootRenderer, NgZone, ApplicationRef} from '@angular/core';
|
||||
import {DebugDomRootRenderer} from '../../../core_private';
|
||||
import {assertionsEnabled} from '../../facade/lang';
|
||||
import {getDOM} from '../dom_adapter';
|
||||
import {DomRootRenderer} from '../dom_renderer';
|
||||
|
||||
|
||||
const CORE_TOKENS = /*@ts2dart_const*/ {'ApplicationRef': ApplicationRef, 'NgZone': NgZone};
|
||||
|
||||
@ -27,8 +27,8 @@ function _createConditionalRootRenderer(rootRenderer) {
|
||||
}
|
||||
|
||||
function _createRootRenderer(rootRenderer) {
|
||||
DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
|
||||
DOM.setGlobalVar(CORE_TOKENS_GLOBAL_NAME, CORE_TOKENS);
|
||||
getDOM().setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
|
||||
getDOM().setGlobalVar(CORE_TOKENS_GLOBAL_NAME, CORE_TOKENS);
|
||||
return new DebugDomRootRenderer(rootRenderer);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,18 @@
|
||||
import {isBlank, Type} from 'angular2/src/facade/lang';
|
||||
import {isBlank, Type} from '../../src/facade/lang';
|
||||
|
||||
export var DOM: DomAdapter = null;
|
||||
var _DOM: DomAdapter = null;
|
||||
|
||||
export function getDOM(){
|
||||
return _DOM;
|
||||
}
|
||||
|
||||
export function setDOM(adapter:DomAdapter){
|
||||
_DOM = adapter;
|
||||
}
|
||||
|
||||
export function setRootDomAdapter(adapter: DomAdapter) {
|
||||
if (isBlank(DOM)) {
|
||||
DOM = adapter;
|
||||
if (isBlank(_DOM)) {
|
||||
_DOM = adapter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +21,7 @@ export function setRootDomAdapter(adapter: DomAdapter) {
|
||||
* Provides DOM operations in an environment-agnostic way.
|
||||
*/
|
||||
export abstract class DomAdapter {
|
||||
public xhrType: Type = null;
|
||||
abstract hasProperty(element, name: string): boolean;
|
||||
abstract setProperty(el: Element, name: string, value: any);
|
||||
abstract getProperty(el: Element, name: string): any;
|
||||
@ -24,7 +33,7 @@ export abstract class DomAdapter {
|
||||
abstract logGroupEnd();
|
||||
|
||||
/** @deprecated */
|
||||
abstract getXHR(): Type;
|
||||
getXHR(): Type { return this.xhrType; }
|
||||
|
||||
/**
|
||||
* Maps attribute names to their corresponding property names for cases
|
||||
|
@ -1,5 +1,14 @@
|
||||
import {Inject, Injectable, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
|
||||
import {
|
||||
Inject,
|
||||
Injectable,
|
||||
OpaqueToken,
|
||||
Renderer,
|
||||
RootRenderer,
|
||||
RenderComponentType,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import {RenderDebugInfo} from '../../core_private'
|
||||
import {AnimationBuilder} from '../animate/animation_builder';
|
||||
import {
|
||||
isPresent,
|
||||
isBlank,
|
||||
@ -9,23 +18,13 @@ import {
|
||||
StringWrapper,
|
||||
isArray,
|
||||
isString
|
||||
} from 'angular2/src/facade/lang';
|
||||
} from '../../src/facade/lang';
|
||||
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {DomSharedStylesHost} from './shared_styles_host';
|
||||
|
||||
import {
|
||||
Renderer,
|
||||
RootRenderer,
|
||||
RenderComponentType,
|
||||
RenderDebugInfo
|
||||
} from 'angular2/src/core/render/api';
|
||||
|
||||
import {EventManager} from './events/event_manager';
|
||||
|
||||
import {DOCUMENT} from './dom_tokens';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {getDOM} from './dom_adapter';
|
||||
import {camelCaseToDashCase} from './util';
|
||||
|
||||
const NAMESPACE_URIS =
|
||||
@ -80,27 +79,27 @@ export class DomRenderer implements Renderer {
|
||||
selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): Element {
|
||||
var el;
|
||||
if (isString(selectorOrNode)) {
|
||||
el = DOM.querySelector(this._rootRenderer.document, selectorOrNode);
|
||||
el = getDOM().querySelector(this._rootRenderer.document, selectorOrNode);
|
||||
if (isBlank(el)) {
|
||||
throw new BaseException(`The selector "${selectorOrNode}" did not match any elements`);
|
||||
}
|
||||
} else {
|
||||
el = selectorOrNode;
|
||||
}
|
||||
DOM.clearNodes(el);
|
||||
getDOM().clearNodes(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
createElement(parent: Element, name: string, debugInfo: RenderDebugInfo): Node {
|
||||
var nsAndName = splitNamespace(name);
|
||||
var el = isPresent(nsAndName[0]) ?
|
||||
DOM.createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) :
|
||||
DOM.createElement(nsAndName[1]);
|
||||
getDOM().createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) :
|
||||
getDOM().createElement(nsAndName[1]);
|
||||
if (isPresent(this._contentAttr)) {
|
||||
DOM.setAttribute(el, this._contentAttr, '');
|
||||
getDOM().setAttribute(el, this._contentAttr, '');
|
||||
}
|
||||
if (isPresent(parent)) {
|
||||
DOM.appendChild(parent, el);
|
||||
getDOM().appendChild(parent, el);
|
||||
}
|
||||
return el;
|
||||
}
|
||||
@ -108,14 +107,14 @@ export class DomRenderer implements Renderer {
|
||||
createViewRoot(hostElement: any): any {
|
||||
var nodesParent;
|
||||
if (this.componentProto.encapsulation === ViewEncapsulation.Native) {
|
||||
nodesParent = DOM.createShadowRoot(hostElement);
|
||||
nodesParent = getDOM().createShadowRoot(hostElement);
|
||||
this._rootRenderer.sharedStylesHost.addHost(nodesParent);
|
||||
for (var i = 0; i < this._styles.length; i++) {
|
||||
DOM.appendChild(nodesParent, DOM.createStyleElement(this._styles[i]));
|
||||
getDOM().appendChild(nodesParent, getDOM().createStyleElement(this._styles[i]));
|
||||
}
|
||||
} else {
|
||||
if (isPresent(this._hostAttr)) {
|
||||
DOM.setAttribute(hostElement, this._hostAttr, '');
|
||||
getDOM().setAttribute(hostElement, this._hostAttr, '');
|
||||
}
|
||||
nodesParent = hostElement;
|
||||
}
|
||||
@ -123,17 +122,17 @@ export class DomRenderer implements Renderer {
|
||||
}
|
||||
|
||||
createTemplateAnchor(parentElement: any, debugInfo: RenderDebugInfo): any {
|
||||
var comment = DOM.createComment(TEMPLATE_COMMENT_TEXT);
|
||||
var comment = getDOM().createComment(TEMPLATE_COMMENT_TEXT);
|
||||
if (isPresent(parentElement)) {
|
||||
DOM.appendChild(parentElement, comment);
|
||||
getDOM().appendChild(parentElement, comment);
|
||||
}
|
||||
return comment;
|
||||
}
|
||||
|
||||
createText(parentElement: any, value: string, debugInfo: RenderDebugInfo): any {
|
||||
var node = DOM.createTextNode(value);
|
||||
var node = getDOM().createTextNode(value);
|
||||
if (isPresent(parentElement)) {
|
||||
DOM.appendChild(parentElement, node);
|
||||
getDOM().appendChild(parentElement, node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -151,14 +150,14 @@ export class DomRenderer implements Renderer {
|
||||
detachView(viewRootNodes: any[]) {
|
||||
for (var i = 0; i < viewRootNodes.length; i++) {
|
||||
var node = viewRootNodes[i];
|
||||
DOM.remove(node);
|
||||
getDOM().remove(node);
|
||||
this.animateNodeLeave(node);
|
||||
}
|
||||
}
|
||||
|
||||
destroyView(hostElement: any, viewAllNodes: any[]) {
|
||||
if (this.componentProto.encapsulation === ViewEncapsulation.Native && isPresent(hostElement)) {
|
||||
this._rootRenderer.sharedStylesHost.removeHost(DOM.getShadowRoot(hostElement));
|
||||
this._rootRenderer.sharedStylesHost.removeHost(getDOM().getShadowRoot(hostElement));
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +172,7 @@ export class DomRenderer implements Renderer {
|
||||
}
|
||||
|
||||
setElementProperty(renderElement: any, propertyName: string, propertyValue: any): void {
|
||||
DOM.setProperty(renderElement, propertyName, propertyValue);
|
||||
getDOM().setProperty(renderElement, propertyName, propertyValue);
|
||||
}
|
||||
|
||||
setElementAttribute(renderElement: any, attributeName: string, attributeValue: string): void {
|
||||
@ -185,27 +184,27 @@ export class DomRenderer implements Renderer {
|
||||
}
|
||||
if (isPresent(attributeValue)) {
|
||||
if (isPresent(attrNs)) {
|
||||
DOM.setAttributeNS(renderElement, attrNs, attributeName, attributeValue);
|
||||
getDOM().setAttributeNS(renderElement, attrNs, attributeName, attributeValue);
|
||||
} else {
|
||||
DOM.setAttribute(renderElement, attributeName, attributeValue);
|
||||
getDOM().setAttribute(renderElement, attributeName, attributeValue);
|
||||
}
|
||||
} else {
|
||||
if (isPresent(attrNs)) {
|
||||
DOM.removeAttributeNS(renderElement, attrNs, nsAndName[1]);
|
||||
getDOM().removeAttributeNS(renderElement, attrNs, nsAndName[1]);
|
||||
} else {
|
||||
DOM.removeAttribute(renderElement, attributeName);
|
||||
getDOM().removeAttribute(renderElement, attributeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setBindingDebugInfo(renderElement: any, propertyName: string, propertyValue: string): void {
|
||||
var dashCasedPropertyName = camelCaseToDashCase(propertyName);
|
||||
if (DOM.isCommentNode(renderElement)) {
|
||||
if (getDOM().isCommentNode(renderElement)) {
|
||||
var existingBindings = RegExpWrapper.firstMatch(
|
||||
TEMPLATE_BINDINGS_EXP, StringWrapper.replaceAll(DOM.getText(renderElement), /\n/g, ''));
|
||||
TEMPLATE_BINDINGS_EXP, StringWrapper.replaceAll(getDOM().getText(renderElement), /\n/g, ''));
|
||||
var parsedBindings = Json.parse(existingBindings[1]);
|
||||
parsedBindings[dashCasedPropertyName] = propertyValue;
|
||||
DOM.setText(renderElement, StringWrapper.replace(TEMPLATE_COMMENT_TEXT, '{}',
|
||||
getDOM().setText(renderElement, StringWrapper.replace(TEMPLATE_COMMENT_TEXT, '{}',
|
||||
Json.stringify(parsedBindings)));
|
||||
} else {
|
||||
this.setElementAttribute(renderElement, propertyName, propertyValue);
|
||||
@ -214,37 +213,37 @@ export class DomRenderer implements Renderer {
|
||||
|
||||
setElementClass(renderElement: any, className: string, isAdd: boolean): void {
|
||||
if (isAdd) {
|
||||
DOM.addClass(renderElement, className);
|
||||
getDOM().addClass(renderElement, className);
|
||||
} else {
|
||||
DOM.removeClass(renderElement, className);
|
||||
getDOM().removeClass(renderElement, className);
|
||||
}
|
||||
}
|
||||
|
||||
setElementStyle(renderElement: any, styleName: string, styleValue: string): void {
|
||||
if (isPresent(styleValue)) {
|
||||
DOM.setStyle(renderElement, styleName, stringify(styleValue));
|
||||
getDOM().setStyle(renderElement, styleName, stringify(styleValue));
|
||||
} else {
|
||||
DOM.removeStyle(renderElement, styleName);
|
||||
getDOM().removeStyle(renderElement, styleName);
|
||||
}
|
||||
}
|
||||
|
||||
invokeElementMethod(renderElement: any, methodName: string, args: any[]): void {
|
||||
DOM.invoke(renderElement, methodName, args);
|
||||
getDOM().invoke(renderElement, methodName, args);
|
||||
}
|
||||
|
||||
setText(renderNode: any, text: string): void { DOM.setText(renderNode, text); }
|
||||
setText(renderNode: any, text: string): void { getDOM().setText(renderNode, text); }
|
||||
|
||||
/**
|
||||
* Performs animations if necessary
|
||||
* @param node
|
||||
*/
|
||||
animateNodeEnter(node: Node) {
|
||||
if (DOM.isElementNode(node) && DOM.hasClass(node, 'ng-animate')) {
|
||||
DOM.addClass(node, 'ng-enter');
|
||||
if (getDOM().isElementNode(node) && getDOM().hasClass(node, 'ng-animate')) {
|
||||
getDOM().addClass(node, 'ng-enter');
|
||||
this._rootRenderer.animate.css()
|
||||
.addAnimationClass('ng-enter-active')
|
||||
.start(<HTMLElement>node)
|
||||
.onComplete(() => { DOM.removeClass(node, 'ng-enter'); });
|
||||
.onComplete(() => { getDOM().removeClass(node, 'ng-enter'); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,32 +254,32 @@ export class DomRenderer implements Renderer {
|
||||
* @param node
|
||||
*/
|
||||
animateNodeLeave(node: Node) {
|
||||
if (DOM.isElementNode(node) && DOM.hasClass(node, 'ng-animate')) {
|
||||
DOM.addClass(node, 'ng-leave');
|
||||
if (getDOM().isElementNode(node) && getDOM().hasClass(node, 'ng-animate')) {
|
||||
getDOM().addClass(node, 'ng-leave');
|
||||
this._rootRenderer.animate.css()
|
||||
.addAnimationClass('ng-leave-active')
|
||||
.start(<HTMLElement>node)
|
||||
.onComplete(() => {
|
||||
DOM.removeClass(node, 'ng-leave');
|
||||
DOM.remove(node);
|
||||
getDOM().removeClass(node, 'ng-leave');
|
||||
getDOM().remove(node);
|
||||
});
|
||||
} else {
|
||||
DOM.remove(node);
|
||||
getDOM().remove(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moveNodesAfterSibling(sibling, nodes) {
|
||||
var parent = DOM.parentElement(sibling);
|
||||
var parent = getDOM().parentElement(sibling);
|
||||
if (nodes.length > 0 && isPresent(parent)) {
|
||||
var nextSibling = DOM.nextSibling(sibling);
|
||||
var nextSibling = getDOM().nextSibling(sibling);
|
||||
if (isPresent(nextSibling)) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
DOM.insertBefore(nextSibling, nodes[i]);
|
||||
getDOM().insertBefore(nextSibling, nodes[i]);
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
DOM.appendChild(parent, nodes[i]);
|
||||
getDOM().appendChild(parent, nodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -288,7 +287,7 @@ function moveNodesAfterSibling(sibling, nodes) {
|
||||
|
||||
function appendNodes(parent, nodes) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
DOM.appendChild(parent, nodes[i]);
|
||||
getDOM().appendChild(parent, nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +296,7 @@ function decoratePreventDefault(eventHandler: Function): Function {
|
||||
var allowDefaultBehavior = eventHandler(event);
|
||||
if (allowDefaultBehavior === false) {
|
||||
// TODO(tbosch): move preventDefault into event plugins...
|
||||
DOM.preventDefault(event);
|
||||
getDOM().preventDefault(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {OpaqueToken} from 'angular2/src/core/di';
|
||||
import {OpaqueToken} from '@angular/core';
|
||||
|
||||
/**
|
||||
* A DI Token representing the main rendering context. In a browser this is the DOM Document.
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Injectable} from 'angular2/core';
|
||||
import {EventManagerPlugin, EventManager} from './event_manager';
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {getDOM} from '../dom_adapter';
|
||||
import {EventManagerPlugin} from './event_manager';
|
||||
|
||||
@Injectable()
|
||||
export class DomEventsPlugin extends EventManagerPlugin {
|
||||
@ -12,14 +13,14 @@ export class DomEventsPlugin extends EventManagerPlugin {
|
||||
var zone = this.manager.getZone();
|
||||
var outsideHandler = (event) => zone.runGuarded(() => handler(event));
|
||||
return this.manager.getZone().runOutsideAngular(
|
||||
() => DOM.onAndCancel(element, eventName, outsideHandler));
|
||||
() => getDOM().onAndCancel(element, eventName, outsideHandler));
|
||||
}
|
||||
|
||||
addGlobalEventListener(target: string, eventName: string, handler: Function): Function {
|
||||
var element = DOM.getGlobalEventTarget(target);
|
||||
var element = getDOM().getGlobalEventTarget(target);
|
||||
var zone = this.manager.getZone();
|
||||
var outsideHandler = (event) => zone.runGuarded(() => handler(event));
|
||||
return this.manager.getZone().runOutsideAngular(
|
||||
() => DOM.onAndCancel(element, eventName, outsideHandler));
|
||||
() => getDOM().onAndCancel(element, eventName, outsideHandler));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {Injectable, Inject, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injectable, Inject, OpaqueToken, NgZone} from '@angular/core';
|
||||
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {ListWrapper} from '../../../src/facade/collection';
|
||||
|
||||
|
||||
export const EVENT_MANAGER_PLUGINS: OpaqueToken =
|
||||
/*@ts2dart_const*/ new OpaqueToken("EventManagerPlugins");
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {EventManagerPlugin} from './event_manager';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {StringMapWrapper} from '../../../src/facade/collection';
|
||||
|
||||
var _eventNames = {
|
||||
// pan
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {Injectable, Inject, OpaqueToken} from '@angular/core';
|
||||
import {isPresent} from '../../../src/facade/lang';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {HammerGesturesPluginCommon} from './hammer_common';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {Injectable, Inject, OpaqueToken} from 'angular2/core';
|
||||
|
||||
export const HAMMER_GESTURE_CONFIG: OpaqueToken =
|
||||
/*@ts2dart_const*/ new OpaqueToken("HammerGestureConfig");
|
||||
|
@ -1,15 +1,13 @@
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {NgZone, Injectable} from '@angular/core';
|
||||
import {
|
||||
isPresent,
|
||||
isBlank,
|
||||
StringWrapper,
|
||||
RegExpWrapper,
|
||||
NumberWrapper
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
} from '../../../src/facade/lang';
|
||||
import {StringMapWrapper, ListWrapper} from '../../../src/facade/collection';
|
||||
|
||||
import {getDOM} from '../dom_adapter';
|
||||
import {EventManagerPlugin} from './event_manager';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
|
||||
|
||||
var modifierKeys = ['alt', 'control', 'meta', 'shift'];
|
||||
var modifierKeyGetters: {[key: string]: (event: KeyboardEvent) => boolean} = {
|
||||
@ -34,7 +32,7 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||
element, StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone());
|
||||
|
||||
return this.manager.getZone().runOutsideAngular(() => {
|
||||
return DOM.onAndCancel(element, StringMapWrapper.get(parsedEvent, 'domEventName'),
|
||||
return getDOM().onAndCancel(element, StringMapWrapper.get(parsedEvent, 'domEventName'),
|
||||
outsideHandler);
|
||||
});
|
||||
}
|
||||
@ -72,7 +70,7 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||
|
||||
static getEventFullKey(event: KeyboardEvent): string {
|
||||
var fullKey = '';
|
||||
var key = DOM.getEventKey(event);
|
||||
var key = getDOM().getEventKey(event);
|
||||
key = key.toLowerCase();
|
||||
if (StringWrapper.equals(key, ' ')) {
|
||||
key = 'space'; // for readability
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Inject, Injectable} from 'angular2/src/core/di';
|
||||
import {SetWrapper} from 'angular2/src/facade/collection';
|
||||
import {Inject, Injectable} from '@angular/core';
|
||||
import {SetWrapper} from '../../src/facade/collection';
|
||||
|
||||
import {getDOM} from './dom_adapter';
|
||||
import {DOCUMENT} from './dom_tokens';
|
||||
|
||||
@Injectable()
|
||||
@ -40,7 +41,7 @@ export class DomSharedStylesHost extends SharedStylesHost {
|
||||
_addStylesToHost(styles: string[], host: Node) {
|
||||
for (var i = 0; i < styles.length; i++) {
|
||||
var style = styles[i];
|
||||
DOM.appendChild(host, DOM.createStyleElement(style));
|
||||
getDOM().appendChild(host, getDOM().createStyleElement(style));
|
||||
}
|
||||
}
|
||||
addHost(hostNode: Node) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {StringWrapper} from 'angular2/src/facade/lang';
|
||||
import {StringWrapper} from '../../src/facade/lang';
|
||||
|
||||
var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
||||
var DASH_CASE_REGEXP = /-([a-z])/g;
|
||||
|
1
modules/@angular/platform-browser/src/facade
Symbolic link
1
modules/@angular/platform-browser/src/facade
Symbolic link
@ -0,0 +1 @@
|
||||
../../facade/src
|
@ -1,48 +1,39 @@
|
||||
export * from 'angular2/src/core/angular_entrypoint';
|
||||
export {
|
||||
BROWSER_PROVIDERS,
|
||||
CACHED_TEMPLATE_PROVIDER,
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
ELEMENT_PROBE_PROVIDERS_PROD_MODE,
|
||||
inspectNativeElement,
|
||||
BrowserDomAdapter,
|
||||
By,
|
||||
Title,
|
||||
DOCUMENT,
|
||||
enableDebugTools,
|
||||
disableDebugTools
|
||||
} from 'angular2/src/platform/browser_common';
|
||||
|
||||
import {Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {
|
||||
BROWSER_PROVIDERS,
|
||||
BROWSER_APP_COMMON_PROVIDERS,
|
||||
BROWSER_PLATFORM_MARKER
|
||||
} from 'angular2/src/platform/browser_common';
|
||||
import {COMPILER_PROVIDERS} from 'angular2/compiler';
|
||||
import {
|
||||
ComponentRef,
|
||||
coreLoadAndBootstrap,
|
||||
reflector,
|
||||
ReflectiveInjector,
|
||||
PlatformRef,
|
||||
OpaqueToken,
|
||||
getPlatform,
|
||||
createPlatform,
|
||||
assertPlatform
|
||||
} from 'angular2/core';
|
||||
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
||||
import {XHRImpl} from "angular2/src/platform/browser/xhr_impl";
|
||||
import {XHR} from 'angular2/compiler';
|
||||
} from '@angular/core';
|
||||
import {isBlank} from './facade/lang';
|
||||
import {BROWSER_PROVIDERS, BROWSER_PLATFORM_MARKER} from './browser_common';
|
||||
export {DomEventsPlugin} from './dom/events/dom_events';
|
||||
|
||||
/**
|
||||
* An array of providers that should be passed into `application()` when bootstrapping a component.
|
||||
*/
|
||||
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
|
||||
export {EventManager, EVENT_MANAGER_PLUGINS} from './dom/events/event_manager';
|
||||
export {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
|
||||
export {
|
||||
BROWSER_APP_COMMON_PROVIDERS,
|
||||
COMPILER_PROVIDERS,
|
||||
/*@ts2dart_Provider*/ {provide: XHR, useClass: XHRImpl},
|
||||
];
|
||||
BROWSER_PROVIDERS,
|
||||
By,
|
||||
Title,
|
||||
enableDebugTools,
|
||||
disableDebugTools,
|
||||
HAMMER_GESTURE_CONFIG,
|
||||
HammerGestureConfig
|
||||
} from './browser_common';
|
||||
|
||||
export * from '../private_export';
|
||||
export {DOCUMENT} from './dom/dom_tokens';
|
||||
|
||||
|
||||
export {
|
||||
bootstrapStatic,
|
||||
browserStaticPlatform,
|
||||
BROWSER_APP_STATIC_PROVIDERS,
|
||||
BrowserPlatformLocation
|
||||
} from './platform_browser_static';
|
||||
|
||||
|
||||
|
||||
export function browserPlatform(): PlatformRef {
|
||||
if (isBlank(getPlatform())) {
|
||||
@ -50,81 +41,3 @@ export function browserPlatform(): PlatformRef {
|
||||
}
|
||||
return assertPlatform(BROWSER_PLATFORM_MARKER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrapping for Angular applications.
|
||||
*
|
||||
* You instantiate an Angular application by explicitly specifying a component to use
|
||||
* as the root component for your application via the `bootstrap()` method.
|
||||
*
|
||||
* ## Simple Example
|
||||
*
|
||||
* Assuming this `index.html`:
|
||||
*
|
||||
* ```html
|
||||
* <html>
|
||||
* <!-- load Angular script tags here. -->
|
||||
* <body>
|
||||
* <my-app>loading...</my-app>
|
||||
* </body>
|
||||
* </html>
|
||||
* ```
|
||||
*
|
||||
* An application is bootstrapped inside an existing browser DOM, typically `index.html`.
|
||||
* Unlike Angular 1, Angular 2 does not compile/process providers in `index.html`. This is
|
||||
* mainly for security reasons, as well as architectural changes in Angular 2. This means
|
||||
* that `index.html` can safely be processed using server-side technologies such as
|
||||
* providers. Bindings can thus use double-curly `{{ syntax }}` without collision from
|
||||
* Angular 2 component double-curly `{{ syntax }}`.
|
||||
*
|
||||
* We can use this script code:
|
||||
*
|
||||
* {@example core/ts/bootstrap/bootstrap.ts region='bootstrap'}
|
||||
*
|
||||
* When the app developer invokes `bootstrap()` with the root component `MyApp` as its
|
||||
* argument, Angular performs the following tasks:
|
||||
*
|
||||
* 1. It uses the component's `selector` property to locate the DOM element which needs
|
||||
* to be upgraded into the angular component.
|
||||
* 2. It creates a new child injector (from the platform injector). Optionally, you can
|
||||
* also override the injector configuration for an app by invoking `bootstrap` with the
|
||||
* `componentInjectableBindings` argument.
|
||||
* 3. It creates a new `Zone` and connects it to the angular application's change detection
|
||||
* domain instance.
|
||||
* 4. It creates an emulated or shadow DOM on the selected component's host element and loads the
|
||||
* template into it.
|
||||
* 5. It instantiates the specified component.
|
||||
* 6. Finally, Angular performs change detection to apply the initial data providers for the
|
||||
* application.
|
||||
*
|
||||
*
|
||||
* ## Bootstrapping Multiple Applications
|
||||
*
|
||||
* When working within a browser window, there are many singleton resources: cookies, title,
|
||||
* location, and others. Angular services that represent these resources must likewise be
|
||||
* shared across all Angular applications that occupy the same browser window. For this
|
||||
* reason, Angular creates exactly one global platform object which stores all shared
|
||||
* services, and each angular application injector has the platform injector as its parent.
|
||||
*
|
||||
* Each application has its own private injector as well. When there are multiple
|
||||
* applications on a page, Angular treats each application injector's services as private
|
||||
* to that application.
|
||||
*
|
||||
* ## API
|
||||
*
|
||||
* - `appComponentType`: The root component which should act as the application. This is
|
||||
* a reference to a `Type` which is annotated with `@Component(...)`.
|
||||
* - `customProviders`: An additional set of providers that can be added to the
|
||||
* app injector to override default injection behavior.
|
||||
*
|
||||
* Returns a `Promise` of {@link ComponentRef}.
|
||||
*/
|
||||
export function bootstrap(
|
||||
appComponentType: Type,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
var appInjector = ReflectiveInjector.resolveAndCreate(
|
||||
[BROWSER_APP_PROVIDERS, isPresent(customProviders) ? customProviders : []],
|
||||
browserPlatform().injector);
|
||||
return coreLoadAndBootstrap(appInjector, appComponentType);
|
||||
}
|
||||
|
@ -1,22 +1,3 @@
|
||||
export * from 'angular2/src/core/angular_entrypoint';
|
||||
export {
|
||||
BROWSER_PROVIDERS,
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
ELEMENT_PROBE_PROVIDERS_PROD_MODE,
|
||||
inspectNativeElement,
|
||||
BrowserDomAdapter,
|
||||
By,
|
||||
Title,
|
||||
enableDebugTools,
|
||||
disableDebugTools
|
||||
} from 'angular2/src/platform/browser_common';
|
||||
|
||||
import {Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {
|
||||
BROWSER_PROVIDERS,
|
||||
BROWSER_APP_COMMON_PROVIDERS,
|
||||
BROWSER_PLATFORM_MARKER
|
||||
} from 'angular2/src/platform/browser_common';
|
||||
import {
|
||||
ComponentRef,
|
||||
coreLoadAndBootstrap,
|
||||
@ -25,14 +6,26 @@ import {
|
||||
getPlatform,
|
||||
createPlatform,
|
||||
assertPlatform
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
|
||||
import {Type, isPresent, isBlank} from './facade/lang';
|
||||
import {BROWSER_APP_COMMON_PROVIDERS, BROWSER_PROVIDERS, BROWSER_PLATFORM_MARKER} from './browser_common';
|
||||
export {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
|
||||
export {BrowserPlatformLocation} from './browser/location/browser_platform_location';
|
||||
export {
|
||||
BROWSER_PROVIDERS,
|
||||
By,
|
||||
Title,
|
||||
enableDebugTools,
|
||||
disableDebugTools,
|
||||
} from './browser_common';
|
||||
|
||||
/**
|
||||
* An array of providers that should be passed into `application()` when bootstrapping a component
|
||||
* when all templates
|
||||
* have been precompiled offline.
|
||||
*/
|
||||
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
export const BROWSER_APP_STATIC_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
/*@ts2dart_const*/ BROWSER_APP_COMMON_PROVIDERS;
|
||||
|
||||
export function browserStaticPlatform(): PlatformRef {
|
||||
@ -53,7 +46,7 @@ export function bootstrapStatic(appComponentType: Type,
|
||||
}
|
||||
|
||||
let appProviders =
|
||||
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
|
||||
isPresent(customProviders) ? [BROWSER_APP_STATIC_PROVIDERS, customProviders] : BROWSER_APP_STATIC_PROVIDERS;
|
||||
var appInjector =
|
||||
ReflectiveInjector.resolveAndCreate(appProviders, browserStaticPlatform().injector);
|
||||
return coreLoadAndBootstrap(appInjector, appComponentType);
|
||||
|
@ -1,3 +1,3 @@
|
||||
import {OpaqueToken} from "angular2/src/core/di";
|
||||
import {OpaqueToken} from '@angular/core/src/di';
|
||||
|
||||
export const ON_WEB_WORKER = /*@ts2dart_const*/ new OpaqueToken('WebWorker.onWebWorker');
|
||||
|
@ -1,22 +1,14 @@
|
||||
import {MessageBus} from "angular2/src/web_workers/shared/message_bus";
|
||||
import {
|
||||
print,
|
||||
isPresent,
|
||||
DateWrapper,
|
||||
stringify,
|
||||
Type,
|
||||
StringWrapper
|
||||
} from "angular2/src/facade/lang";
|
||||
import {MessageBus} from './message_bus';
|
||||
import {print, isPresent, DateWrapper, stringify, StringWrapper} from '../../../src/facade/lang';
|
||||
import {
|
||||
PromiseCompleter,
|
||||
PromiseWrapper,
|
||||
ObservableWrapper,
|
||||
EventEmitter
|
||||
} from "angular2/src/facade/async";
|
||||
import {StringMapWrapper, MapWrapper} from "angular2/src/facade/collection";
|
||||
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
||||
import {Injectable} from "angular2/src/core/di";
|
||||
export {Type} from "angular2/src/facade/lang";
|
||||
} from '../../../src/facade/async';
|
||||
import {StringMapWrapper} from '../../../src/facade/collection';
|
||||
import {Serializer} from './serializer';
|
||||
import {Injectable, Type} from '@angular/core';
|
||||
|
||||
export abstract class ClientMessageBrokerFactory {
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {EventEmitter} from 'angular2/src/facade/async';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
export {EventEmitter, Observable} from 'angular2/src/facade/async';
|
||||
import {EventEmitter} from '../../../src/facade/async';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
export {EventEmitter, Observable} from '../../../src/facade/async';
|
||||
|
||||
/**
|
||||
* Message Bus is a low level API used to communicate between the UI and the background.
|
||||
|
@ -1,13 +1,9 @@
|
||||
import {
|
||||
MessageBus,
|
||||
MessageBusSource,
|
||||
MessageBusSink
|
||||
} from "angular2/src/web_workers/shared/message_bus";
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injectable} from "angular2/src/core/di";
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {MessageBus, MessageBusSource, MessageBusSink} from './message_bus';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {EventEmitter, ObservableWrapper} from '../../../src/facade/async';
|
||||
import {StringMapWrapper} from '../../../src/facade/collection';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
|
||||
// TODO(jteplitz602) Replace this with the definition in lib.webworker.d.ts(#3492)
|
||||
export interface PostMessageTarget { postMessage: (message: any, transfer?:[ArrayBuffer]) => void; }
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Injectable} from "angular2/src/core/di";
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
|
||||
@Injectable()
|
||||
export class RenderStore {
|
||||
|
@ -1,11 +1,9 @@
|
||||
import {Type, isArray, isPresent, serializeEnum, deserializeEnum} from "angular2/src/facade/lang";
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
|
||||
import {Map, StringMapWrapper, MapWrapper} from "angular2/src/facade/collection";
|
||||
import {RenderComponentType} from "angular2/src/core/render/api";
|
||||
import {Injectable} from "angular2/src/core/di";
|
||||
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
|
||||
import {ViewEncapsulation, VIEW_ENCAPSULATION_VALUES} from 'angular2/src/core/metadata/view';
|
||||
import {Type, isArray, isPresent, serializeEnum} from '../../../src/facade/lang';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {Map, StringMapWrapper, MapWrapper} from '../../../src/facade/collection';
|
||||
import {RenderComponentType, Injectable, ViewEncapsulation} from '@angular/core';
|
||||
import {VIEW_ENCAPSULATION_VALUES} from '../../../core_private';
|
||||
import {RenderStore} from './render_store';
|
||||
import {LocationType} from './serialized_types';
|
||||
|
||||
// PRIMITIVE is any type that does not need to be serialized (string, number, boolean)
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
||||
import {isPresent, Type, FunctionWrapper} from "angular2/src/facade/lang";
|
||||
import {MessageBus} from "angular2/src/web_workers/shared/message_bus";
|
||||
import {EventEmitter, PromiseWrapper, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {ListWrapper, Map} from '../../../src/facade/collection';
|
||||
import {Serializer} from '../shared/serializer';
|
||||
import {isPresent, Type, FunctionWrapper} from '../../../src/facade/lang';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {EventEmitter, PromiseWrapper, ObservableWrapper} from '../../../src/facade/async';
|
||||
|
||||
export abstract class ServiceMessageBrokerFactory {
|
||||
/**
|
||||
|
@ -1,14 +1,13 @@
|
||||
import {Serializer, RenderStoreObject} from 'angular2/src/web_workers/shared/serializer';
|
||||
import {Serializer, RenderStoreObject} from '../shared/serializer';
|
||||
import {
|
||||
serializeMouseEvent,
|
||||
serializeKeyboardEvent,
|
||||
serializeGenericEvent,
|
||||
serializeEventWithTarget,
|
||||
serializeTransitionEvent
|
||||
} from 'angular2/src/web_workers/ui/event_serializer';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
} from './event_serializer';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {EventEmitter, ObservableWrapper} from '../../../src/facade/async';
|
||||
|
||||
export class EventDispatcher {
|
||||
constructor(private _sink: EventEmitter<any>, private _serializer: Serializer) {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Set} from 'angular2/src/facade/collection';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {Set} from '../../../src/facade/collection';
|
||||
import {isPresent} from '../../../src/facade/lang';
|
||||
|
||||
const MOUSE_EVENT_PROPERTIES = [
|
||||
"altKey",
|
||||
|
@ -1,18 +1,18 @@
|
||||
import {
|
||||
BrowserPlatformLocation
|
||||
} from 'angular2/src/platform/browser/location/browser_platform_location';
|
||||
import {UrlChangeListener} from 'angular2/platform/common';
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {ROUTER_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
} from '@angular/platform-browser/src/browser/location/browser_platform_location';
|
||||
import {UrlChangeListener} from '@angular/common';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {ROUTER_CHANNEL} from '../shared/messaging_api';
|
||||
import {
|
||||
ServiceMessageBrokerFactory,
|
||||
ServiceMessageBroker
|
||||
} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
import {PRIMITIVE, Serializer} from 'angular2/src/web_workers/shared/serializer';
|
||||
} from '../shared/service_message_broker';
|
||||
import {PRIMITIVE, Serializer} from '../shared/serializer';
|
||||
import {bind} from './bind';
|
||||
import {LocationType} from 'angular2/src/web_workers/shared/serialized_types';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {EventEmitter, ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {LocationType} from '../shared/serialized_types';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {EventEmitter, ObservableWrapper, PromiseWrapper} from '../../../src/facade/async';
|
||||
|
||||
@Injectable()
|
||||
export class MessageBasedPlatformLocation {
|
||||
|
@ -1,13 +1,12 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {Serializer, PRIMITIVE, RenderStoreObject} from 'angular2/src/web_workers/shared/serializer';
|
||||
import {RootRenderer, Renderer, RenderComponentType} from 'angular2/src/core/render/api';
|
||||
import {EVENT_CHANNEL, RENDERER_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {Serializer, PRIMITIVE, RenderStoreObject} from '../shared/serializer';
|
||||
import {RootRenderer, Renderer, RenderComponentType} from '@angular/core/src/render/api';
|
||||
import {EVENT_CHANNEL, RENDERER_CHANNEL} from '../shared/messaging_api';
|
||||
import {bind} from './bind';
|
||||
import {EventDispatcher} from 'angular2/src/web_workers/ui/event_dispatcher';
|
||||
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
|
||||
import {ServiceMessageBrokerFactory} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
import {EventDispatcher} from '../ui/event_dispatcher';
|
||||
import {RenderStore} from '../shared/render_store';
|
||||
import {ServiceMessageBrokerFactory} from '../shared/service_message_broker';
|
||||
|
||||
@Injectable()
|
||||
export class MessageBasedRenderer {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {MessageBasedPlatformLocation} from './platform_location';
|
||||
import {
|
||||
BrowserPlatformLocation
|
||||
} from 'angular2/src/platform/browser/location/browser_platform_location';
|
||||
import {APP_INITIALIZER, Provider, Injector, NgZone} from 'angular2/core';
|
||||
} from '@angular/platform-browser/src/browser/location/browser_platform_location';
|
||||
import {APP_INITIALIZER, Provider, Injector, NgZone} from '@angular/core';
|
||||
|
||||
export const WORKER_RENDER_ROUTER = /*@ts2dart_const*/[
|
||||
MessageBasedPlatformLocation,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {PRIMITIVE} from 'angular2/src/web_workers/shared/serializer';
|
||||
import {XHR_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {ServiceMessageBrokerFactory} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {PRIMITIVE} from '../shared/serializer';
|
||||
import {XHR_CHANNEL} from '../shared/messaging_api';
|
||||
import {XHR} from '@angular/compiler';
|
||||
import {ServiceMessageBrokerFactory} from '../shared/service_message_broker';
|
||||
import {bind} from './bind';
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,19 +1,19 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {
|
||||
FnArg,
|
||||
UiArguments,
|
||||
ClientMessageBroker,
|
||||
ClientMessageBrokerFactory
|
||||
} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
import {PlatformLocation, UrlChangeEvent, UrlChangeListener} from 'angular2/platform/common';
|
||||
import {ROUTER_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
import {LocationType} from 'angular2/src/web_workers/shared/serialized_types';
|
||||
import {PromiseWrapper, EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {PRIMITIVE, Serializer} from 'angular2/src/web_workers/shared/serializer';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {StringWrapper} from 'angular2/src/facade/lang';
|
||||
} from '../shared/client_message_broker';
|
||||
import {PlatformLocation, UrlChangeEvent, UrlChangeListener} from '@angular/common';
|
||||
import {ROUTER_CHANNEL} from '../shared/messaging_api';
|
||||
import {LocationType} from '../shared/serialized_types';
|
||||
import {PromiseWrapper, EventEmitter, ObservableWrapper} from '../../../src/facade/async';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {PRIMITIVE, Serializer} from '../shared/serializer';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {StringMapWrapper} from '../../../src/facade/collection';
|
||||
import {StringWrapper} from '../../../src/facade/lang';
|
||||
import {deserializeGenericEvent} from './event_deserializer';
|
||||
|
||||
@Injectable()
|
||||
|
@ -3,23 +3,23 @@ import {
|
||||
RootRenderer,
|
||||
RenderComponentType,
|
||||
RenderDebugInfo
|
||||
} from 'angular2/src/core/render/api';
|
||||
} from '@angular/core/src/render/api';
|
||||
import {
|
||||
ClientMessageBroker,
|
||||
ClientMessageBrokerFactory,
|
||||
FnArg,
|
||||
UiArguments
|
||||
} from "angular2/src/web_workers/shared/client_message_broker";
|
||||
import {isPresent, isBlank, print} from "angular2/src/facade/lang";
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injectable} from "angular2/src/core/di";
|
||||
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
|
||||
import {RENDERER_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
import {Serializer, RenderStoreObject} from 'angular2/src/web_workers/shared/serializer';
|
||||
import {EVENT_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||
} from '../shared/client_message_broker';
|
||||
import {isPresent, isBlank, print} from '../../../src/facade/lang';
|
||||
import {ListWrapper} from '../../../src/facade/collection';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {RenderStore} from '../shared/render_store';
|
||||
import {RENDERER_CHANNEL} from '../shared/messaging_api';
|
||||
import {Serializer, RenderStoreObject} from '../shared/serializer';
|
||||
import {EVENT_CHANNEL} from '../shared/messaging_api';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {ObservableWrapper} from '../../../src/facade/async';
|
||||
import {ViewEncapsulation} from '@angular/core';
|
||||
import {deserializeGenericEvent} from './event_deserializer';
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {ApplicationRef, Provider, NgZone, APP_INITIALIZER} from 'angular2/core';
|
||||
import {PlatformLocation} from 'angular2/platform/common';
|
||||
import {Provider, NgZone, APP_INITIALIZER} from '@angular/core';
|
||||
import {PlatformLocation} from '@angular/common';
|
||||
import {WebWorkerPlatformLocation} from './platform_location';
|
||||
import {ROUTER_PROVIDERS_COMMON} from 'angular2/src/router/router_providers_common';
|
||||
import {ROUTER_PROVIDERS_COMMON} from '@angular/router';
|
||||
|
||||
export var WORKER_APP_ROUTER = [
|
||||
ROUTER_PROVIDERS_COMMON,
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {Injectable} from '@angular/core/src/di';
|
||||
import {XHR} from '@angular/compiler/src/xhr';
|
||||
import {
|
||||
FnArg,
|
||||
UiArguments,
|
||||
ClientMessageBroker,
|
||||
ClientMessageBrokerFactory
|
||||
} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
import {XHR_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
||||
} from '../shared/client_message_broker';
|
||||
import {XHR_CHANNEL} from '../shared/messaging_api';
|
||||
|
||||
/**
|
||||
* Implementation of compiler/xhr that relays XHR requests to the UI side where they are sent
|
||||
|
@ -1,16 +1,15 @@
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||
import {Provider} from 'angular2/src/core/di';
|
||||
import {Parse5DomAdapter} from 'angular2/src/platform/server/parse5_adapter';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
import {Provider} from '@angular/core/src/di';
|
||||
import {Parse5DomAdapter} from '@angular/platform-server';
|
||||
import {
|
||||
PostMessageBus,
|
||||
PostMessageBusSink,
|
||||
PostMessageBusSource
|
||||
} from 'angular2/src/web_workers/shared/post_message_bus';
|
||||
} from '../web_workers/shared/post_message_bus';
|
||||
import {WORKER_APP_APPLICATION_COMMON} from './worker_app_common';
|
||||
import {APP_INITIALIZER} from 'angular2/core';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
|
||||
import {APP_INITIALIZER} from '@angular/core';
|
||||
import {MessageBus} from '../web_workers/shared/message_bus';
|
||||
import {COMPILER_PROVIDERS} from '@angular/compiler/src/compiler';
|
||||
|
||||
// TODO(jteplitz602) remove this and compile with lib.webworker.d.ts (#3492)
|
||||
let _postMessage = {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {WebWorkerXHRImpl} from 'angular2/src/web_workers/worker/xhr_impl';
|
||||
import {WebWorkerRootRenderer} from 'angular2/src/web_workers/worker/renderer';
|
||||
import {print} from 'angular2/src/facade/lang';
|
||||
import {RootRenderer} from 'angular2/src/core/render/api';
|
||||
import {XHR} from '@angular/compiler';
|
||||
import {WebWorkerXHRImpl} from '../web_workers/worker/xhr_impl';
|
||||
import {WebWorkerRootRenderer} from '../web_workers/worker/renderer';
|
||||
import {print} from '../../src/facade/lang';
|
||||
import {RootRenderer} from '@angular/core/src/render/api';
|
||||
import {
|
||||
PLATFORM_DIRECTIVES,
|
||||
PLATFORM_PIPES,
|
||||
@ -10,19 +10,20 @@ import {
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
PLATFORM_COMMON_PROVIDERS,
|
||||
OpaqueToken
|
||||
} from 'angular2/core';
|
||||
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from "angular2/common";
|
||||
} from '@angular/core';
|
||||
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from '@angular/common';
|
||||
import {
|
||||
ClientMessageBrokerFactory,
|
||||
ClientMessageBrokerFactory_
|
||||
} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
} from '../web_workers/shared/client_message_broker';
|
||||
import {
|
||||
ServiceMessageBrokerFactory,
|
||||
ServiceMessageBrokerFactory_
|
||||
} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
||||
import {ON_WEB_WORKER} from "angular2/src/web_workers/shared/api";
|
||||
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
|
||||
} from '../web_workers/shared/service_message_broker';
|
||||
import {Serializer} from '../web_workers/shared/serializer';
|
||||
import {ON_WEB_WORKER} from '../web_workers/shared/api';
|
||||
import {Provider} from '@angular/core/src/di';
|
||||
import {RenderStore} from '../web_workers/shared/render_store';
|
||||
|
||||
class PrintLogger {
|
||||
log = print;
|
||||
|
@ -2,19 +2,16 @@ import {
|
||||
PostMessageBus,
|
||||
PostMessageBusSink,
|
||||
PostMessageBusSource
|
||||
} from 'angular2/src/web_workers/shared/post_message_bus';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {APP_INITIALIZER} from 'angular2/core';
|
||||
import {Injector, Injectable, Provider} from 'angular2/src/core/di';
|
||||
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
|
||||
import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl';
|
||||
} from '../web_workers/shared/post_message_bus';
|
||||
import {MessageBus} from '../web_workers/shared/message_bus';
|
||||
import {APP_INITIALIZER} from '@angular/core';
|
||||
import {Injector, Injectable, Provider} from '@angular/core/src/di';
|
||||
import {
|
||||
WORKER_RENDER_APPLICATION_COMMON,
|
||||
WORKER_RENDER_MESSAGING_PROVIDERS,
|
||||
WORKER_SCRIPT,
|
||||
initializeGenericWorkerRenderer
|
||||
} from 'angular2/src/platform/worker_render_common';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
} from './worker_render_common';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
|
||||
/**
|
||||
* Wrapper class that exposes the Worker
|
||||
|
@ -1,57 +1,49 @@
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {IS_DART} from '../../src/facade/lang';
|
||||
import {MessageBus} from '../web_workers/shared/message_bus';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
import {
|
||||
PLATFORM_DIRECTIVES,
|
||||
PLATFORM_PIPES,
|
||||
ComponentRef,
|
||||
ExceptionHandler,
|
||||
Reflector,
|
||||
reflector,
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
PLATFORM_COMMON_PROVIDERS,
|
||||
RootRenderer,
|
||||
PLATFORM_INITIALIZER,
|
||||
APP_INITIALIZER
|
||||
} from 'angular2/core';
|
||||
import {EVENT_MANAGER_PLUGINS, EventManager} from 'angular2/platform/common_dom';
|
||||
import {provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
// TODO change these imports once dom_adapter is moved out of core
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
|
||||
import {KeyEventsPlugin} from 'angular2/src/platform/dom/events/key_events';
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {DomRootRenderer, DomRootRenderer_} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {DomSharedStylesHost, SharedStylesHost} from 'angular2/src/platform/dom/shared_styles_host';
|
||||
import {BrowserDetails} from 'angular2/src/animate/browser_details';
|
||||
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
|
||||
import {XHR} from 'angular2/compiler';
|
||||
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
|
||||
import {Testability} from 'angular2/src/core/testability/testability';
|
||||
import {BrowserGetTestability} from 'angular2/src/platform/browser/testability';
|
||||
import {BrowserDomAdapter} from './browser/browser_adapter';
|
||||
import {wtfInit} from 'angular2/src/core/profile/wtf_init';
|
||||
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
|
||||
import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl';
|
||||
PLATFORM_INITIALIZER
|
||||
} from '@angular/core';
|
||||
import {Provider, Injector, OpaqueToken} from '@angular/core/src/di';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {DomEventsPlugin} from '@angular/platform-browser/src/dom/events/dom_events';
|
||||
import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_events';
|
||||
import {HammerGesturesPlugin} from '@angular/platform-browser/src/dom/events/hammer_gestures';
|
||||
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
||||
import {DomRootRenderer, DomRootRenderer_} from '@angular/platform-browser/src/dom/dom_renderer';
|
||||
import {
|
||||
DomSharedStylesHost,
|
||||
SharedStylesHost
|
||||
} from '@angular/platform-browser/src/dom/shared_styles_host';
|
||||
import {BrowserDetails} from '../animate/browser_details';
|
||||
import {AnimationBuilder} from '../animate/animation_builder';
|
||||
import {Testability} from '@angular/core/src/testability/testability';
|
||||
import {BrowserGetTestability} from '@angular/platform-browser/src/browser/testability';
|
||||
import {BrowserDomAdapter} from '../browser/browser_adapter';
|
||||
import {wtfInit} from '@angular/core/src/profile/wtf_init';
|
||||
import {MessageBasedRenderer} from '../web_workers/ui/renderer';
|
||||
import {
|
||||
ServiceMessageBrokerFactory,
|
||||
ServiceMessageBrokerFactory_
|
||||
} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
} from '../web_workers/shared/service_message_broker';
|
||||
import {
|
||||
ClientMessageBrokerFactory,
|
||||
ClientMessageBrokerFactory_
|
||||
} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
import {
|
||||
BrowserPlatformLocation
|
||||
} from 'angular2/src/platform/browser/location/browser_platform_location';
|
||||
import {Serializer} from 'angular2/src/web_workers/shared/serializer';
|
||||
import {ON_WEB_WORKER} from 'angular2/src/web_workers/shared/api';
|
||||
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
|
||||
import {
|
||||
HAMMER_GESTURE_CONFIG,
|
||||
HammerGestureConfig,
|
||||
HammerGesturesPlugin
|
||||
} from 'angular2/src/platform/dom/events/hammer_gestures';
|
||||
} from '../web_workers/shared/client_message_broker';
|
||||
import {BrowserPlatformLocation} from '@angular/platform-browser/src/browser/location/browser_platform_location';
|
||||
import {Serializer} from '../web_workers/shared/serializer';
|
||||
import {ON_WEB_WORKER} from '../web_workers/shared/api';
|
||||
import {RenderStore} from '../web_workers/shared/render_store';
|
||||
import {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from '../dom/events/hammer_gestures';
|
||||
import {EventManager, EVENT_MANAGER_PLUGINS} from '../dom/events/event_manager';
|
||||
import {XHR} from "../../../compiler/src/xhr";
|
||||
import {XHRImpl} from "../../../platform-browser-dynamic/src/xhr/xhr_impl";
|
||||
import {MessageBasedXHRImpl} from "../web_workers/ui/xhr_impl";
|
||||
// TODO change these imports once dom_adapter is moved out of core
|
||||
|
||||
export const WORKER_SCRIPT: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken("WebWorkerScript");
|
||||
|
||||
@ -121,9 +113,9 @@ export function initWebWorkerRenderPlatform(): void {
|
||||
}
|
||||
|
||||
function _exceptionHandler(): ExceptionHandler {
|
||||
return new ExceptionHandler(DOM, !IS_DART);
|
||||
return new ExceptionHandler(getDOM(), !IS_DART);
|
||||
}
|
||||
|
||||
function _document(): any {
|
||||
return DOM.defaultDoc();
|
||||
return getDOM().defaultDoc();
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {
|
||||
WORKER_APP_PLATFORM,
|
||||
WORKER_APP_PLATFORM_MARKER
|
||||
} from 'angular2/src/platform/worker_app_common';
|
||||
import {WORKER_APP_APPLICATION} from 'angular2/src/platform/worker_app';
|
||||
import {isPresent, isBlank} from './facade/lang';
|
||||
import {WORKER_APP_PLATFORM, WORKER_APP_PLATFORM_MARKER} from './webworker/worker_app_common';
|
||||
import {WORKER_APP_APPLICATION} from './webworker/worker_app';
|
||||
import {
|
||||
PlatformRef,
|
||||
Type,
|
||||
@ -13,27 +10,27 @@ import {
|
||||
getPlatform,
|
||||
createPlatform,
|
||||
assertPlatform
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
|
||||
export {
|
||||
WORKER_APP_PLATFORM,
|
||||
WORKER_APP_APPLICATION_COMMON
|
||||
} from 'angular2/src/platform/worker_app_common';
|
||||
export {WORKER_APP_APPLICATION} from 'angular2/src/platform/worker_app';
|
||||
} from './webworker/worker_app_common';
|
||||
export {WORKER_APP_APPLICATION} from './webworker/worker_app';
|
||||
export {
|
||||
ClientMessageBroker,
|
||||
ClientMessageBrokerFactory,
|
||||
FnArg,
|
||||
UiArguments
|
||||
} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
} from './web_workers/shared/client_message_broker';
|
||||
export {
|
||||
ReceivedMessage,
|
||||
ServiceMessageBroker,
|
||||
ServiceMessageBrokerFactory
|
||||
} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
export {PRIMITIVE} from 'angular2/src/web_workers/shared/serializer';
|
||||
export * from 'angular2/src/web_workers/shared/message_bus';
|
||||
export {WORKER_APP_ROUTER} from 'angular2/src/web_workers/worker/router_providers';
|
||||
} from './web_workers/shared/service_message_broker';
|
||||
export {PRIMITIVE} from './web_workers/shared/serializer';
|
||||
export * from './web_workers/shared/message_bus';
|
||||
export {WORKER_APP_ROUTER} from './web_workers/worker/router_providers';
|
||||
|
||||
export function workerAppPlatform(): PlatformRef {
|
||||
if (isBlank(getPlatform())) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {isPresent, isBlank} from './facade/lang';
|
||||
import {PromiseWrapper} from './facade/async';
|
||||
import {
|
||||
ApplicationRef,
|
||||
PlatformRef,
|
||||
@ -8,40 +8,40 @@ import {
|
||||
getPlatform,
|
||||
createPlatform,
|
||||
assertPlatform
|
||||
} from 'angular2/core';
|
||||
import {WORKER_RENDER_APPLICATION} from 'angular2/src/platform/worker_render';
|
||||
} from '@angular/core';
|
||||
import {WORKER_RENDER_APPLICATION} from './webworker/worker_render';
|
||||
import {
|
||||
WORKER_SCRIPT,
|
||||
WORKER_RENDER_PLATFORM,
|
||||
WORKER_RENDER_PLATFORM_MARKER
|
||||
} from 'angular2/src/platform/worker_render_common';
|
||||
} from './webworker/worker_render_common';
|
||||
|
||||
export {
|
||||
WORKER_SCRIPT,
|
||||
WORKER_RENDER_PLATFORM,
|
||||
initializeGenericWorkerRenderer,
|
||||
WORKER_RENDER_APPLICATION_COMMON
|
||||
} from 'angular2/src/platform/worker_render_common';
|
||||
export {WORKER_RENDER_APPLICATION, WebWorkerInstance} from 'angular2/src/platform/worker_render';
|
||||
} from './webworker/worker_render_common';
|
||||
export {WORKER_RENDER_APPLICATION, WebWorkerInstance} from './webworker/worker_render';
|
||||
export {
|
||||
ClientMessageBroker,
|
||||
ClientMessageBrokerFactory,
|
||||
FnArg,
|
||||
UiArguments
|
||||
} from '../src/web_workers/shared/client_message_broker';
|
||||
} from './web_workers/shared/client_message_broker';
|
||||
export {
|
||||
ReceivedMessage,
|
||||
ServiceMessageBroker,
|
||||
ServiceMessageBrokerFactory
|
||||
} from '../src/web_workers/shared/service_message_broker';
|
||||
export {PRIMITIVE} from '../src/web_workers/shared/serializer';
|
||||
export * from '../src/web_workers/shared/message_bus';
|
||||
} from './web_workers/shared/service_message_broker';
|
||||
export {PRIMITIVE} from './web_workers/shared/serializer';
|
||||
export * from './web_workers/shared/message_bus';
|
||||
|
||||
/**
|
||||
* @deprecated Use WORKER_RENDER_APPLICATION
|
||||
*/
|
||||
export const WORKER_RENDER_APP = WORKER_RENDER_APPLICATION;
|
||||
export {WORKER_RENDER_ROUTER} from 'angular2/src/web_workers/ui/router_providers';
|
||||
export {WORKER_RENDER_ROUTER} from '../src/web_workers/ui/router_providers';
|
||||
|
||||
export function workerRenderPlatform(): PlatformRef {
|
||||
if (isBlank(getPlatform())) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import {el, describe, it, iit, expect, inject, SpyObject} from 'angular2/testing_internal';
|
||||
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {describe, it, iit, expect, inject} from '@angular/core/testing';
|
||||
import {AnimationBuilder} from '../../src/animate/animation_builder';
|
||||
import {getDOM} from '../../src/dom/dom_adapter';
|
||||
import {el} from '../../testing/browser_util';
|
||||
import {SpyObject} from '@angular/core/testing/testing_internal';
|
||||
|
||||
export function main() {
|
||||
describe("AnimationBuilder", () => {
|
||||
@ -55,7 +57,7 @@ export function main() {
|
||||
var runner = animateCss.start(element);
|
||||
runner.flush();
|
||||
|
||||
if (DOM.supportsAnimation()) {
|
||||
if (getDOM().supportsAnimation()) {
|
||||
expect(runner.computedDelay).toBe(100);
|
||||
expect(runner.computedDuration).toBe(200);
|
||||
} else {
|
||||
@ -78,11 +80,11 @@ export function main() {
|
||||
it('should support duration and delay defined in CSS', inject([AnimationBuilder], (animate) => {
|
||||
var animateCss = animate.css();
|
||||
var element =
|
||||
el(`<div style="${DOM.getAnimationPrefix()}transition: 0.5s ease 250ms;"></div>`);
|
||||
el(`<div style="${getDOM().getAnimationPrefix()}transition: 0.5s ease 250ms;"></div>`);
|
||||
var runner = animateCss.start(element);
|
||||
runner.flush();
|
||||
|
||||
if (DOM.supportsAnimation()) {
|
||||
if (getDOM().supportsAnimation()) {
|
||||
expect(runner.computedDelay).toBe(250);
|
||||
expect(runner.computedDuration).toBe(500);
|
||||
} else {
|
||||
@ -120,7 +122,7 @@ export function main() {
|
||||
|
||||
runner.flush();
|
||||
|
||||
if (DOM.supportsAnimation()) {
|
||||
if (getDOM().supportsAnimation()) {
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
|
||||
runner.handleAnimationCompleted();
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
ddescribe,
|
||||
@ -9,17 +8,25 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xdescribe,
|
||||
Log,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
import {IS_DART, isPresent, stringify} from 'angular2/src/facade/lang';
|
||||
import {bootstrap, BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
|
||||
import {ApplicationRef, PlatformRef, disposePlatform} from 'angular2/src/core/application_ref';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {Component, Directive, OnDestroy} from 'angular2/core';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {PromiseWrapper, TimerWrapper} from 'angular2/src/facade/async';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
fakeAsync,
|
||||
flushMicrotasks,
|
||||
Log,
|
||||
tick,
|
||||
} from '@angular/core/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {IS_DART, isPresent, stringify} from '../../src/facade/lang';
|
||||
import {BROWSER_PROVIDERS} from '@angular/platform-browser';
|
||||
import {BROWSER_APP_DYNAMIC_PROVIDERS} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {ApplicationRef, PlatformRef} from '@angular/core/src/application_ref';
|
||||
import {Console} from '@angular/core/src/console';
|
||||
import {Component, Directive, OnDestroy} from '@angular/core';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
||||
import {PromiseWrapper, TimerWrapper} from '../../src/facade/async';
|
||||
import {
|
||||
provide,
|
||||
Inject,
|
||||
@ -29,10 +36,11 @@ import {
|
||||
coreLoadAndBootstrap,
|
||||
createPlatform,
|
||||
ReflectiveInjector
|
||||
} from 'angular2/core';
|
||||
import {ExceptionHandler, BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||
import {ComponentRef} from "angular2/src/core/linker/component_factory";
|
||||
} from '@angular/core';
|
||||
import {disposePlatform} from '@angular/core/src/application_ref';
|
||||
import {ExceptionHandler, BaseException} from '@angular/core';
|
||||
import {Testability, TestabilityRegistry} from '@angular/core/src/testability/testability';
|
||||
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
||||
|
||||
@Component({selector: 'hello-app', template: '{{greeting}} world!'})
|
||||
class HelloRootCmp {
|
||||
@ -102,14 +110,14 @@ export function main() {
|
||||
beforeEach(() => {
|
||||
disposePlatform();
|
||||
|
||||
fakeDoc = DOM.createHtmlDocument();
|
||||
el = DOM.createElement('hello-app', fakeDoc);
|
||||
el2 = DOM.createElement('hello-app-2', fakeDoc);
|
||||
lightDom = DOM.createElement('light-dom-el', fakeDoc);
|
||||
DOM.appendChild(fakeDoc.body, el);
|
||||
DOM.appendChild(fakeDoc.body, el2);
|
||||
DOM.appendChild(el, lightDom);
|
||||
DOM.setText(lightDom, 'loading');
|
||||
fakeDoc = getDOM().createHtmlDocument();
|
||||
el = getDOM().createElement('hello-app', fakeDoc);
|
||||
el2 = getDOM().createElement('hello-app-2', fakeDoc);
|
||||
lightDom = getDOM().createElement('light-dom-el', fakeDoc);
|
||||
getDOM().appendChild(fakeDoc.body, el);
|
||||
getDOM().appendChild(fakeDoc.body, el2);
|
||||
getDOM().appendChild(el, lightDom);
|
||||
getDOM().setText(lightDom, 'loading');
|
||||
testProviders =
|
||||
[provide(DOCUMENT, {useValue: fakeDoc}), provide(Console, {useClass: DummyConsole})];
|
||||
});
|
||||
@ -140,7 +148,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should forward the error to promise when bootstrap fails',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
// Skip for dart since it causes a confusing error message in console when test passes.
|
||||
@ -208,7 +216,7 @@ export function main() {
|
||||
it('should unregister change detectors when components are disposed',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
|
||||
var app = ReflectiveInjector.resolveAndCreate([BROWSER_APP_PROVIDERS, testProviders],
|
||||
var app = ReflectiveInjector.resolveAndCreate([BROWSER_APP_DYNAMIC_PROVIDERS, testProviders],
|
||||
platform.injector)
|
||||
.get(ApplicationRef);
|
||||
coreLoadAndBootstrap(app.injector, HelloRootCmp)
|
||||
@ -250,7 +258,7 @@ export function main() {
|
||||
log.clear();
|
||||
var a = ReflectiveInjector.resolveAndCreate(
|
||||
[
|
||||
BROWSER_APP_PROVIDERS,
|
||||
BROWSER_APP_DYNAMIC_PROVIDERS,
|
||||
provide(APP_INITIALIZER, {useValue: log.fn("app_init1"), multi: true}),
|
||||
provide(APP_INITIALIZER, {useValue: log.fn("app_init2"), multi: true})
|
||||
],
|
||||
|
@ -1,20 +1,14 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
ddescribe,
|
||||
describe,
|
||||
it,
|
||||
iit,
|
||||
xit,
|
||||
expect,
|
||||
SpyObject
|
||||
} from 'angular2/testing_internal';
|
||||
import {SpyElementRef, SpyDomAdapter} from '../../core/spies';
|
||||
|
||||
import {DOM, DomAdapter} from 'angular2/src/platform/dom/dom_adapter';
|
||||
|
||||
import {Ruler, Rectangle} from 'angular2/src/platform/browser/ruler';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter, SpyObject} from '@angular/core/testing/testing_internal';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {Ruler, Rectangle} from '@angular/platform-browser/src/browser/ruler';
|
||||
import {createRectangle} from './rectangle_mock';
|
||||
import {SpyDomAdapter, SpyElementRef} from '@angular/core/test/spies';
|
||||
|
||||
function assertDimensions(rect: Rectangle, left, right, top, bottom, width, height) {
|
||||
expect(rect.left).toEqual(left);
|
||||
@ -41,9 +35,9 @@ export function main() {
|
||||
|
||||
it('should return 0 for all rectangle values while measuring elements in a document fragment',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
var ruler = new Ruler(DOM);
|
||||
var ruler = new Ruler(getDOM());
|
||||
var elRef = <any>new SpyElementRef();
|
||||
elRef.prop("nativeElement", DOM.createElement('div'));
|
||||
elRef.prop("nativeElement", getDOM().createElement('div'));
|
||||
ruler.measure(elRef).then((rect) => {
|
||||
// here we are using an element created in a doc fragment so all the measures will come
|
||||
// back as 0
|
||||
@ -53,4 +47,4 @@ export function main() {
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
import {ddescribe, describe, it, iit, xit, expect, afterEach} from 'angular2/testing_internal';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Title} from 'angular2/platform/browser';
|
||||
import {ddescribe, describe, it, iit, xit, expect, afterEach} from '@angular/core/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
|
||||
export function main() {
|
||||
describe('title service', () => {
|
||||
var initialTitle = DOM.getTitle();
|
||||
var initialTitle = getDOM().getTitle();
|
||||
var titleService = new Title();
|
||||
|
||||
afterEach(() => { DOM.setTitle(initialTitle); });
|
||||
afterEach(() => { getDOM().setTitle(initialTitle); });
|
||||
|
||||
it('should allow reading initial title',
|
||||
() => { expect(titleService.getTitle()).toEqual(initialTitle); });
|
||||
|
||||
it('should set a title on the injected document', () => {
|
||||
titleService.setTitle('test title');
|
||||
expect(DOM.getTitle()).toEqual('test title');
|
||||
expect(getDOM().getTitle()).toEqual('test title');
|
||||
expect(titleService.getTitle()).toEqual('test title');
|
||||
});
|
||||
|
||||
it('should reset title to empty string if title not provided', () => {
|
||||
titleService.setTitle(null);
|
||||
expect(DOM.getTitle()).toEqual('');
|
||||
expect(getDOM().getTitle()).toEqual('');
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {SpyObject} from 'angular2/testing_internal';
|
||||
import {ReflectiveInjector, provide} from 'angular2/core';
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
import {ApplicationRef, ApplicationRef_} from 'angular2/src/core/application_ref';
|
||||
import {SpyObject} from '@angular/core/testing/testing_internal';
|
||||
import {ReflectiveInjector, provide} from '@angular/core';
|
||||
import {global} from '../../../src/facade/lang';
|
||||
import {ApplicationRef, ApplicationRef_} from '@angular/core/src/application_ref';
|
||||
|
||||
export class SpyApplicationRef extends SpyObject {
|
||||
constructor() { super(ApplicationRef_); }
|
||||
|
@ -8,9 +8,9 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {enableDebugTools, disableDebugTools} from 'angular2/platform/browser';
|
||||
import {enableDebugTools, disableDebugTools} from '@angular/platform-browser';
|
||||
import {SpyComponentRef, callNgProfilerTimeChangeDetection} from './spies';
|
||||
|
||||
export function main() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {describe, it, iit, ddescribe, expect, BrowserDetection} from 'angular2/testing_internal';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {describe, it, iit, ddescribe, expect} from '@angular/core/testing';
|
||||
import {BrowserDetection} from '@angular/platform-browser/testing';
|
||||
import {StringMapWrapper} from '../src/facade/collection';
|
||||
|
||||
export function main() {
|
||||
describe('BrowserDetection', () => {
|
||||
|
@ -1,20 +1,16 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
beforeEachProviders,
|
||||
SpyObject,
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
// import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
// import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
// import {MapWrapper} from '../../src/facade/src/collection';
|
||||
// import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
// import {DomTestbed, TestRootView, elRef} from './dom_testbed';
|
||||
|
||||
@ -23,7 +19,7 @@ import {
|
||||
// RenderDirectiveMetadata,
|
||||
// RenderViewRef,
|
||||
// ViewEncapsulation
|
||||
// } from 'angular2/src/core/render/api';
|
||||
// } from '@angular/core/src/render/api';
|
||||
|
||||
export function main() {
|
||||
describe('DomRenderer integration', () => {
|
||||
|
@ -7,13 +7,13 @@ import {
|
||||
xdescribe,
|
||||
expect,
|
||||
beforeEach,
|
||||
el
|
||||
} from 'angular2/testing_internal';
|
||||
import {EventManager, EventManagerPlugin} from 'angular2/platform/common_dom';
|
||||
import {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {DomEventsPlugin} from '@angular/platform-browser/src/dom/events/dom_events';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
import {ListWrapper, Map} from '../../../src/facade/collection';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {EventManager, EventManagerPlugin} from '@angular/platform-browser/src/dom/events/event_manager';
|
||||
import {el} from '../../../testing/browser_util';
|
||||
|
||||
export function main() {
|
||||
var domEventPlugin;
|
||||
@ -58,34 +58,34 @@ export function main() {
|
||||
it('events are caught when fired from a child', () => {
|
||||
var element = el('<div><div></div></div>');
|
||||
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=122755
|
||||
DOM.appendChild(DOM.defaultDoc().body, element);
|
||||
getDOM().appendChild(getDOM().defaultDoc().body, element);
|
||||
|
||||
var child = DOM.firstChild(element);
|
||||
var dispatchedEvent = DOM.createMouseEvent('click');
|
||||
var child = getDOM().firstChild(element);
|
||||
var dispatchedEvent = getDOM().createMouseEvent('click');
|
||||
var receivedEvent = null;
|
||||
var handler = (e) => { receivedEvent = e; };
|
||||
var manager = new EventManager([domEventPlugin], new FakeNgZone());
|
||||
manager.addEventListener(element, 'click', handler);
|
||||
DOM.dispatchEvent(child, dispatchedEvent);
|
||||
getDOM().dispatchEvent(child, dispatchedEvent);
|
||||
|
||||
expect(receivedEvent).toBe(dispatchedEvent);
|
||||
});
|
||||
|
||||
it('should add and remove global event listeners', () => {
|
||||
var element = el('<div><div></div></div>');
|
||||
DOM.appendChild(DOM.defaultDoc().body, element);
|
||||
var dispatchedEvent = DOM.createMouseEvent('click');
|
||||
getDOM().appendChild(getDOM().defaultDoc().body, element);
|
||||
var dispatchedEvent = getDOM().createMouseEvent('click');
|
||||
var receivedEvent = null;
|
||||
var handler = (e) => { receivedEvent = e; };
|
||||
var manager = new EventManager([domEventPlugin], new FakeNgZone());
|
||||
|
||||
var remover = manager.addGlobalEventListener("document", 'click', handler);
|
||||
DOM.dispatchEvent(element, dispatchedEvent);
|
||||
getDOM().dispatchEvent(element, dispatchedEvent);
|
||||
expect(receivedEvent).toBe(dispatchedEvent);
|
||||
|
||||
receivedEvent = null;
|
||||
remover();
|
||||
DOM.dispatchEvent(element, dispatchedEvent);
|
||||
getDOM().dispatchEvent(element, dispatchedEvent);
|
||||
expect(receivedEvent).toBe(null);
|
||||
});
|
||||
});
|
||||
|
@ -7,9 +7,8 @@ import {
|
||||
xdescribe,
|
||||
expect,
|
||||
beforeEach,
|
||||
el
|
||||
} from 'angular2/testing_internal';
|
||||
import {KeyEventsPlugin} from 'angular2/src/platform/dom/events/key_events';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_events';
|
||||
|
||||
export function main() {
|
||||
describe('KeyEvents', () => {
|
||||
|
@ -1,22 +1,17 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
SpyObject
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DomSharedStylesHost} from 'angular2/src/platform/dom/shared_styles_host';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {DomSharedStylesHost} from '@angular/platform-browser/src/dom/shared_styles_host';
|
||||
|
||||
export function main() {
|
||||
describe('DomSharedStylesHost', () => {
|
||||
@ -24,29 +19,29 @@ export function main() {
|
||||
var ssh: DomSharedStylesHost;
|
||||
var someHost: Element;
|
||||
beforeEach(() => {
|
||||
doc = DOM.createHtmlDocument();
|
||||
doc = getDOM().createHtmlDocument();
|
||||
doc.title = '';
|
||||
ssh = new DomSharedStylesHost(doc);
|
||||
someHost = DOM.createElement('div');
|
||||
someHost = getDOM().createElement('div');
|
||||
});
|
||||
|
||||
it('should add existing styles to new hosts', () => {
|
||||
ssh.addStyles(['a {};']);
|
||||
ssh.addHost(someHost);
|
||||
expect(DOM.getInnerHTML(someHost)).toEqual('<style>a {};</style>');
|
||||
expect(getDOM().getInnerHTML(someHost)).toEqual('<style>a {};</style>');
|
||||
});
|
||||
|
||||
it('should add new styles to hosts', () => {
|
||||
ssh.addHost(someHost);
|
||||
ssh.addStyles(['a {};']);
|
||||
expect(DOM.getInnerHTML(someHost)).toEqual('<style>a {};</style>');
|
||||
expect(getDOM().getInnerHTML(someHost)).toEqual('<style>a {};</style>');
|
||||
});
|
||||
|
||||
it('should add styles only once to hosts', () => {
|
||||
ssh.addStyles(['a {};']);
|
||||
ssh.addHost(someHost);
|
||||
ssh.addStyles(['a {};']);
|
||||
expect(DOM.getInnerHTML(someHost)).toEqual('<style>a {};</style>');
|
||||
expect(getDOM().getInnerHTML(someHost)).toEqual('<style>a {};</style>');
|
||||
});
|
||||
|
||||
it('should use the document head as default host', () => {
|
||||
|
@ -9,20 +9,24 @@ import {
|
||||
beforeEach,
|
||||
beforeEachProviders,
|
||||
inject,
|
||||
} from '@angular/core/testing';
|
||||
import {
|
||||
async,
|
||||
TestComponentBuilder,
|
||||
fakeAsync,
|
||||
tick
|
||||
} from 'angular2/testing';
|
||||
flushMicrotasks,
|
||||
Log,
|
||||
tick,
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import {ROUTER_FAKE_PROVIDERS} from 'angular2/src/alt_router/router_testing_providers';
|
||||
import {ROUTER_DIRECTIVES, Routes, Route} from 'angular2/alt_router';
|
||||
|
||||
|
||||
import {Injectable, bind, Directive, Component, ViewMetadata} from 'angular2/core';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
|
||||
import {Component, bind} from '@angular/core';
|
||||
import {PromiseWrapper} from '../src/facade/promise';
|
||||
import {XHR} from '@angular/compiler';
|
||||
import {XHRImpl} from '../../platform-browser-dynamic/src/xhr/xhr_impl';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
|
||||
// Components for the tests.
|
||||
class FancyService {
|
||||
@ -35,7 +39,7 @@ class FancyService {
|
||||
|
||||
@Component({
|
||||
selector: 'external-template-comp',
|
||||
templateUrl: '/base/modules/angular2/test/testing/static_assets/test.html'
|
||||
templateUrl: '/base/modules/@angular/platform-browser/test/static_assets/test.html'
|
||||
})
|
||||
class ExternalTemplateComp {
|
||||
}
|
||||
@ -62,7 +66,7 @@ export function main() {
|
||||
describe('test APIs for the browser', () => {
|
||||
describe('angular2 jasmine matchers', () => {
|
||||
describe('toHaveCssClass', () => {
|
||||
it('should assert that the CSS class is present', () => {
|
||||
it('should assert that the CSS class is present', () => {
|
||||
var el = document.createElement('div');
|
||||
el.classList.add('matias');
|
||||
expect(el).toHaveCssClass('matias');
|
||||
@ -108,7 +112,7 @@ export function main() {
|
||||
|
||||
it('should run async tests with XHRs', async(() => {
|
||||
var xhr = new XHRImpl();
|
||||
xhr.get('/base/modules/angular2/test/testing/static_assets/test.html')
|
||||
xhr.get('/base/modules/@angular/platform-browser/test/static_assets/test.html')
|
||||
.then(() => { actuallyDone = true; });
|
||||
}),
|
||||
10000); // Long timeout here because this test makes an actual XHR.
|
||||
|
@ -8,17 +8,20 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
inject,
|
||||
async,
|
||||
beforeEachProviders
|
||||
} from '@angular/core/testing';
|
||||
import {
|
||||
fakeAsync,
|
||||
tick,
|
||||
async,
|
||||
flushMicrotasks,
|
||||
withProviders,
|
||||
beforeEachProviders,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing';
|
||||
|
||||
import {Injectable, bind, Directive, Component, ViewMetadata} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
Log,
|
||||
tick,
|
||||
} from '@angular/core/testing';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
import {Injectable, bind, Component, ViewMetadata} from '@angular/core';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {PromiseWrapper} from '../../http/src/facade/promise';
|
||||
|
||||
// Services, and components for the tests.
|
||||
|
||||
|
@ -1,20 +1,18 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
withProviders,
|
||||
inject,
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
beforeEach,
|
||||
beforeEachProviders,
|
||||
SpyObject
|
||||
} from 'angular2/testing_internal';
|
||||
import {provide} from 'angular2/src/core/di';
|
||||
import {ObservableWrapper, TimerWrapper} from 'angular2/src/facade/async';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {ObservableWrapper, TimerWrapper} from '../../../src/facade/async';
|
||||
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||
import {createConnectedMessageBus} from './message_bus_util';
|
||||
import {MockNgZone} from 'angular2/src/mock/ng_zone_mock';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {MockNgZone} from '@angular/core/testing';
|
||||
import {provide, NgZone} from '@angular/core';
|
||||
import {withProviders} from '@angular/core/testing/test_injector';
|
||||
|
||||
export function main() {
|
||||
/**
|
||||
|
@ -2,8 +2,8 @@ import {
|
||||
PostMessageBusSource,
|
||||
PostMessageBusSink,
|
||||
PostMessageBus
|
||||
} from 'angular2/src/web_workers/shared/post_message_bus';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
} from '@angular/platform-browser/src/web_workers/shared/post_message_bus';
|
||||
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||
|
||||
/*
|
||||
* Returns a PostMessageBus thats sink is connected to its own source.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {EventEmitter} from 'angular2/src/facade/async';
|
||||
import {EventEmitter} from '../../../src/facade/async';
|
||||
|
||||
export class MockEventEmitter<T> extends EventEmitter<T> {
|
||||
private _nextFns: Function[] = [];
|
||||
|
@ -1,13 +1,12 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
describe,
|
||||
ddescribe,
|
||||
beforeEach,
|
||||
it,
|
||||
expect
|
||||
} from "angular2/testing_internal";
|
||||
import {RenderStore} from "angular2/src/web_workers/shared/render_store";
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {RenderStore} from '@angular/platform-browser/src/web_workers/shared/render_store';
|
||||
|
||||
export function main() {
|
||||
describe("RenderStoreSpec", () => {
|
||||
@ -34,4 +33,4 @@ export function main() {
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
describe,
|
||||
it,
|
||||
@ -7,19 +6,18 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
beforeEachProviders,
|
||||
SpyObject,
|
||||
browserDetection
|
||||
} from 'angular2/testing_internal';
|
||||
import {createPairedMessageBuses} from '../shared/web_worker_test_util';
|
||||
import {Serializer, PRIMITIVE} from 'angular2/src/web_workers/shared/serializer';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {browserDetection} from '@angular/platform-browser/testing';
|
||||
import {createPairedMessageBuses} from './web_worker_test_util';
|
||||
import {Serializer, PRIMITIVE} from '@angular/platform-browser/src/web_workers/shared/serializer';
|
||||
import {
|
||||
ServiceMessageBroker,
|
||||
ServiceMessageBroker_
|
||||
} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {provide} from 'angular2/core';
|
||||
import {ON_WEB_WORKER} from 'angular2/src/web_workers/shared/api';
|
||||
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
|
||||
} from '@angular/platform-browser/src/web_workers/shared/service_message_broker';
|
||||
import {ObservableWrapper, PromiseWrapper} from '../../../src/facade/async';
|
||||
import {provide} from '@angular/core';
|
||||
import {ON_WEB_WORKER} from '@angular/platform-browser/src/web_workers/shared/api';
|
||||
import {RenderStore} from '@angular/platform-browser/src/web_workers/shared/render_store';
|
||||
|
||||
export function main() {
|
||||
const CHANNEL = "UIMessageBroker Test Channel";
|
||||
|
@ -1,21 +1,21 @@
|
||||
import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {UiArguments} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||
import {StringMapWrapper, ListWrapper} from '../../../src/facade/collection';
|
||||
import {PromiseWrapper} from '../../../src/facade/async';
|
||||
import {UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
import {Type, isPresent} from '../../../src/facade/lang';
|
||||
import {SpyMessageBroker} from '../worker/spies';
|
||||
import {expect} from 'angular2/src/testing/matchers';
|
||||
import {expect} from '@angular/core/testing';
|
||||
import {
|
||||
MessageBusSink,
|
||||
MessageBusSource,
|
||||
MessageBus
|
||||
} from 'angular2/src/web_workers/shared/message_bus';
|
||||
} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||
import {
|
||||
ClientMessageBroker,
|
||||
ClientMessageBrokerFactory_
|
||||
} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
import {MockEventEmitter} from './mock_event_emitter';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {BaseException, WrappedException} from '../../../src/facade/exceptions';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
|
||||
var __unused: Promise<any>; // avoid unused import when Promise union types are erased
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
beforeEach,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {SpyMessageBroker} from './spies';
|
||||
import {WebWorkerPlatformLocation} from 'angular2/src/web_workers/worker/platform_location';
|
||||
import {LocationType} from 'angular2/src/web_workers/shared/serialized_types';
|
||||
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
|
||||
import {WebWorkerPlatformLocation} from '@angular/platform-browser/src/web_workers/worker/platform_location';
|
||||
import {LocationType} from '@angular/platform-browser/src/web_workers/shared/serialized_types';
|
||||
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||
import {
|
||||
createPairedMessageBuses,
|
||||
MockMessageBrokerFactory,
|
||||
expectBrokerCall
|
||||
} from '../shared/web_worker_test_util';
|
||||
import {UiArguments} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from "angular2/src/facade/async";
|
||||
import {UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
import {Type} from '../../../src/facade/lang';
|
||||
import {PromiseWrapper} from '../../../src/facade/async';
|
||||
|
||||
export function main() {
|
||||
describe("WebWorkerPlatformLocation", () => {
|
||||
|
@ -1,18 +1,17 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
ddescribe,
|
||||
describe,
|
||||
dispatchEvent,
|
||||
it,
|
||||
iit,
|
||||
expect,
|
||||
beforeEach,
|
||||
beforeEachProviders,
|
||||
TestInjector,
|
||||
TestComponentBuilder
|
||||
} from "angular2/testing_internal";
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import { TestInjector } from '@angular/core/testing';
|
||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {
|
||||
bind,
|
||||
provide,
|
||||
@ -23,31 +22,32 @@ import {
|
||||
Injectable,
|
||||
ElementRef,
|
||||
ComponentRef
|
||||
} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {WebWorkerRootRenderer} from "angular2/src/web_workers/worker/renderer";
|
||||
} from '@angular/core';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {WebWorkerRootRenderer} from '@angular/platform-browser/src/web_workers/worker/renderer';
|
||||
import {
|
||||
ClientMessageBrokerFactory,
|
||||
ClientMessageBrokerFactory_,
|
||||
UiArguments,
|
||||
FnArg
|
||||
} from "angular2/src/web_workers/shared/client_message_broker";
|
||||
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
||||
import {RootRenderer} from "angular2/src/core/render/api";
|
||||
import {DomRootRenderer, DomRootRenderer_} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {DebugDomRootRenderer} from 'angular2/src/core/debug/debug_renderer';
|
||||
import {RenderStore} from "angular2/src/web_workers/shared/render_store";
|
||||
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
|
||||
} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
import {Serializer} from '@angular/platform-browser/src/web_workers/shared/serializer';
|
||||
import {RootRenderer} from '@angular/core/src/render/api';
|
||||
import {DomRootRenderer, DomRootRenderer_} from '@angular/platform-browser/src/dom/dom_renderer';
|
||||
import {DebugDomRootRenderer} from '@angular/core/src/debug/debug_renderer';
|
||||
import {RenderStore} from '@angular/platform-browser/src/web_workers/shared/render_store';
|
||||
import {MessageBasedRenderer} from '@angular/platform-browser/src/web_workers/ui/renderer';
|
||||
import {createPairedMessageBuses, PairedMessageBuses} from '../shared/web_worker_test_util';
|
||||
import {
|
||||
ServiceMessageBrokerFactory,
|
||||
ServiceMessageBrokerFactory_
|
||||
} from 'angular2/src/web_workers/shared/service_message_broker';
|
||||
import {CompilerConfig} from 'angular2/compiler';
|
||||
} from '@angular/platform-browser/src/web_workers/shared/service_message_broker';
|
||||
import {CompilerConfig} from '@angular/compiler';
|
||||
import {dispatchEvent} from '../../../../platform-browser/testing/browser_util';
|
||||
import {
|
||||
TEST_BROWSER_PLATFORM_PROVIDERS,
|
||||
TEST_BROWSER_APPLICATION_PROVIDERS
|
||||
} from 'angular2/platform/testing/browser';
|
||||
TEST_BROWSER_STATIC_PLATFORM_PROVIDERS,
|
||||
TEST_BROWSER_STATIC_APPLICATION_PROVIDERS
|
||||
} from '@angular/platform-browser/testing';
|
||||
|
||||
export function main() {
|
||||
function createWebWorkerBrokerFactory(
|
||||
@ -88,8 +88,9 @@ export function main() {
|
||||
beforeEachProviders(() => {
|
||||
uiRenderStore = new RenderStore();
|
||||
var testUiInjector = new TestInjector();
|
||||
testUiInjector.platformProviders = TEST_BROWSER_PLATFORM_PROVIDERS;
|
||||
testUiInjector.applicationProviders = TEST_BROWSER_APPLICATION_PROVIDERS;
|
||||
testUiInjector.platformProviders = TEST_BROWSER_STATIC_PLATFORM_PROVIDERS;
|
||||
testUiInjector.applicationProviders = TEST_BROWSER_STATIC_APPLICATION_PROVIDERS
|
||||
;
|
||||
testUiInjector.addProviders([
|
||||
Serializer,
|
||||
provide(RenderStore, {useValue: uiRenderStore}),
|
||||
@ -126,8 +127,8 @@ export function main() {
|
||||
|
||||
it('should update text nodes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{ctxProp}}</div>'}))
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideView(MyComp2, new ViewMetadata({template: '<div>{{ctxProp}}</div>'}))
|
||||
.createAsync(MyComp2)
|
||||
.then((fixture) => {
|
||||
var renderEl = getRenderElement(fixture.debugElement.nativeElement);
|
||||
expect(renderEl).toHaveText('');
|
||||
@ -142,9 +143,9 @@ export function main() {
|
||||
|
||||
it('should update any element property/attributes/class/style independent of the compilation on the root element and other elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata(
|
||||
tcb.overrideView(MyComp2, new ViewMetadata(
|
||||
{template: '<input [title]="y" style="position:absolute">'}))
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp2)
|
||||
.then((fixture) => {
|
||||
var checkSetters = (componentRef, workerEl) => {
|
||||
var renderer = getRenderer(componentRef);
|
||||
@ -153,17 +154,17 @@ export function main() {
|
||||
expect((<HTMLInputElement>el).tabIndex).toEqual(1);
|
||||
|
||||
renderer.setElementClass(workerEl, 'a', true);
|
||||
expect(DOM.hasClass(el, 'a')).toBe(true);
|
||||
expect(getDOM().hasClass(el, 'a')).toBe(true);
|
||||
renderer.setElementClass(workerEl, 'a', false);
|
||||
expect(DOM.hasClass(el, 'a')).toBe(false);
|
||||
expect(getDOM().hasClass(el, 'a')).toBe(false);
|
||||
|
||||
renderer.setElementStyle(workerEl, 'width', '10px');
|
||||
expect(DOM.getStyle(el, 'width')).toEqual('10px');
|
||||
expect(getDOM().getStyle(el, 'width')).toEqual('10px');
|
||||
renderer.setElementStyle(workerEl, 'width', null);
|
||||
expect(DOM.getStyle(el, 'width')).toEqual('');
|
||||
expect(getDOM().getStyle(el, 'width')).toEqual('');
|
||||
|
||||
renderer.setElementAttribute(workerEl, 'someattr', 'someValue');
|
||||
expect(DOM.getAttribute(el, 'someattr')).toEqual('someValue');
|
||||
expect(getDOM().getAttribute(el, 'someattr')).toEqual('someValue');
|
||||
};
|
||||
|
||||
// root element
|
||||
@ -178,25 +179,25 @@ export function main() {
|
||||
it('should update any template comment property/attributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var tpl = '<template [ngIf]="ctxBoolProp"></template>';
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [NgIf]}))
|
||||
tcb.overrideView(MyComp2, new ViewMetadata({template: tpl, directives: [NgIf]}))
|
||||
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp2)
|
||||
.then((fixture) => {
|
||||
(<MyComp>fixture.debugElement.componentInstance).ctxBoolProp = true;
|
||||
(<MyComp2>fixture.debugElement.componentInstance).ctxBoolProp = true;
|
||||
fixture.detectChanges();
|
||||
var el = getRenderElement(fixture.debugElement.nativeElement);
|
||||
expect(DOM.getInnerHTML(el)).toContain('"ng-reflect-ng-if": "true"');
|
||||
expect(getDOM().getInnerHTML(el)).toContain('"ng-reflect-ng-if": "true"');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should add and remove fragments',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
tcb.overrideView(MyComp2, new ViewMetadata({
|
||||
template: '<template [ngIf]="ctxBoolProp">hello</template>',
|
||||
directives: [NgIf]
|
||||
}))
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp2)
|
||||
.then((fixture) => {
|
||||
|
||||
var rootEl = getRenderElement(fixture.debugElement.nativeElement);
|
||||
@ -214,26 +215,26 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should call actions on the element',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<input [title]="y">'}))
|
||||
.createAsync(MyComp)
|
||||
tcb.overrideView(MyComp2, new ViewMetadata({template: '<input [title]="y">'}))
|
||||
.createAsync(MyComp2)
|
||||
.then((fixture) => {
|
||||
var el = fixture.debugElement.children[0];
|
||||
getRenderer(fixture.componentRef)
|
||||
.invokeElementMethod(el.nativeElement, 'setAttribute', ['a', 'b']);
|
||||
|
||||
expect(DOM.getAttribute(getRenderElement(el.nativeElement), 'a')).toEqual('b');
|
||||
expect(getDOM().getAttribute(getRenderElement(el.nativeElement), 'a')).toEqual('b');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should listen to events',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MyComp,
|
||||
tcb.overrideView(MyComp2,
|
||||
new ViewMetadata({template: '<input (change)="ctxNumProp = 1">'}))
|
||||
.createAsync(MyComp)
|
||||
.createAsync(MyComp2)
|
||||
.then((fixture) => {
|
||||
var el = fixture.debugElement.children[0];
|
||||
dispatchEvent(getRenderElement(el.nativeElement), 'change');
|
||||
@ -251,7 +252,7 @@ export function main() {
|
||||
|
||||
@Component({selector: 'my-comp', directives: []})
|
||||
@Injectable()
|
||||
class MyComp {
|
||||
class MyComp2 {
|
||||
ctxProp: string;
|
||||
ctxNumProp;
|
||||
ctxBoolProp: boolean;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {ClientMessageBroker} from 'angular2/src/web_workers/shared/client_message_broker';
|
||||
import {ClientMessageBroker} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
|
||||
import {SpyObject, proxy} from 'angular2/testing_internal';
|
||||
import {SpyObject, proxy} from '@angular/core/testing/testing_internal';
|
||||
|
||||
export class SpyMessageBroker extends SpyObject {
|
||||
constructor() { super(ClientMessageBroker); }
|
||||
|
@ -1,16 +1,16 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
beforeEach,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {SpyMessageBroker} from './spies';
|
||||
import {WebWorkerXHRImpl} from "angular2/src/web_workers/worker/xhr_impl";
|
||||
import {PromiseWrapper} from "angular2/src/facade/async";
|
||||
import {MockMessageBrokerFactory, expectBrokerCall} from "../shared/web_worker_test_util";
|
||||
import {WebWorkerXHRImpl} from '@angular/platform-browser/src/web_workers/worker/xhr_impl';
|
||||
import {PromiseWrapper} from '../../../src/facade/async';
|
||||
import {MockMessageBrokerFactory, expectBrokerCall} from '../shared/web_worker_test_util';
|
||||
|
||||
export function main() {
|
||||
describe("WebWorkerXHRImpl", () => {
|
||||
|
4
modules/@angular/platform-browser/testing.ts
Normal file
4
modules/@angular/platform-browser/testing.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from './testing/browser_util';
|
||||
export * from './testing/browser_static';
|
||||
export * from './testing/matchers';
|
||||
export * from './testing/dom_test_component_renderer';
|
@ -1,9 +1,9 @@
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
|
||||
import {CssAnimationBuilder} from 'angular2/src/animate/css_animation_builder';
|
||||
import {CssAnimationOptions} from 'angular2/src/animate/css_animation_options';
|
||||
import {Animation} from 'angular2/src/animate/animation';
|
||||
import {BrowserDetails} from 'angular2/src/animate/browser_details';
|
||||
import {Injectable} from '@angular/core';
|
||||
import { Animation } from '../src/animate/animation';
|
||||
import { CssAnimationOptions } from '../src/animate/css_animation_options';
|
||||
import { BrowserDetails } from '../src/animate/browser_details';
|
||||
import { AnimationBuilder } from '../src/animate/animation_builder';
|
||||
import { CssAnimationBuilder } from '../src/animate/css_animation_builder';
|
||||
|
||||
@Injectable()
|
||||
export class MockAnimationBuilder extends AnimationBuilder {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter';
|
||||
import {document, window} from 'angular2/src/facade/browser';
|
||||
import {NumberWrapper, isBlank} from 'angular2/src/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
|
||||
import {document, window} from '../src/facade/browser';
|
||||
import {NumberWrapper, isBlank} from '../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../src/facade/exceptions';
|
||||
|
||||
var DOM = new BrowserDomAdapter();
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
import {
|
||||
TEST_BROWSER_STATIC_PLATFORM_PROVIDERS,
|
||||
ADDITIONAL_TEST_BROWSER_PROVIDERS
|
||||
} from 'angular2/platform/testing/browser_static';
|
||||
import {BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
|
||||
|
||||
/**
|
||||
* Providers for using template cache to avoid actual XHR.
|
||||
* Re-exported here so that tests import from a single place.
|
||||
*/
|
||||
export {CACHED_TEMPLATE_PROVIDER} from 'angular2/platform/browser';
|
||||
|
||||
/**
|
||||
* Default platform providers for testing.
|
||||
*/
|
||||
export const TEST_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
/*@ts2dart_const*/[TEST_BROWSER_STATIC_PLATFORM_PROVIDERS];
|
||||
|
||||
/**
|
||||
* Default application providers for testing.
|
||||
*/
|
||||
export const TEST_BROWSER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
/*@ts2dart_const*/[BROWSER_APP_PROVIDERS, ADDITIONAL_TEST_BROWSER_PROVIDERS];
|
@ -4,35 +4,24 @@ import {
|
||||
Provider,
|
||||
PLATFORM_COMMON_PROVIDERS,
|
||||
PLATFORM_INITIALIZER
|
||||
} from 'angular2/core';
|
||||
import {DirectiveResolver, ViewResolver} from 'angular2/compiler';
|
||||
import {BROWSER_APP_COMMON_PROVIDERS} from 'angular2/src/platform/browser_common';
|
||||
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter';
|
||||
|
||||
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
|
||||
import {MockAnimationBuilder} from 'angular2/src/mock/animation_builder_mock';
|
||||
import {MockDirectiveResolver} from 'angular2/src/mock/directive_resolver_mock';
|
||||
import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
import {LocationStrategy} from 'angular2/platform/common';
|
||||
import {MockNgZone} from 'angular2/src/mock/ng_zone_mock';
|
||||
|
||||
import {XHRImpl} from "angular2/src/platform/browser/xhr_impl";
|
||||
import {XHR} from 'angular2/compiler';
|
||||
|
||||
import {
|
||||
TestComponentBuilder,
|
||||
ComponentFixtureAutoDetect,
|
||||
ComponentFixtureNoNgZone
|
||||
} from 'angular2/src/testing/test_component_builder';
|
||||
|
||||
import {BrowserDetection} from 'angular2/src/testing/utils';
|
||||
|
||||
import {ELEMENT_PROBE_PROVIDERS} from 'angular2/platform/common_dom';
|
||||
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
|
||||
import {Log} from 'angular2/src/testing/utils';
|
||||
} from '@angular/core';
|
||||
import {DirectiveResolver, ViewResolver, XHR} from '@angular/compiler';
|
||||
import {BROWSER_APP_COMMON_PROVIDERS} from '../src/browser_common';
|
||||
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
|
||||
import {AnimationBuilder} from '../src/animate/animation_builder';
|
||||
import {MockAnimationBuilder} from './animation_builder_mock';
|
||||
import {MockDirectiveResolver} from '@angular/compiler/testing';
|
||||
import {MockViewResolver} from '@angular/compiler/testing';
|
||||
import {MockLocationStrategy} from '@angular/common/testing';
|
||||
import {LocationStrategy} from '@angular/common';
|
||||
import {MockNgZone} from '@angular/core/testing';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
import {BrowserDetection} from './browser_util';
|
||||
import {Log} from '@angular/core/testing';
|
||||
import {ELEMENT_PROBE_PROVIDERS} from '../src/dom/debug/ng_probe';
|
||||
import {TestComponentRenderer} from '@angular/compiler/testing';
|
||||
import {DOMTestComponentRenderer} from './dom_test_component_renderer';
|
||||
import {IS_DART} from '../src/facade/lang';
|
||||
|
||||
function initBrowserTests() {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
@ -43,6 +32,8 @@ function createNgZone(): NgZone {
|
||||
return IS_DART ? new MockNgZone() : new NgZone({enableLongStackTrace: true});
|
||||
}
|
||||
|
||||
export {TestComponentRenderer} from '@angular/compiler/testing';
|
||||
|
||||
/**
|
||||
* Default platform providers for testing without a compiler.
|
||||
*/
|
||||
@ -63,6 +54,7 @@ export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | an
|
||||
/*@ts2dart_Provider*/ {provide: NgZone, useFactory: createNgZone},
|
||||
/*@ts2dart_Provider*/ {provide: LocationStrategy, useClass: MockLocationStrategy},
|
||||
/*@ts2dart_Provider*/ {provide: AnimationBuilder, useClass: MockAnimationBuilder},
|
||||
/*@ts2dart_Provider*/ {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer}
|
||||
];
|
||||
|
||||
/**
|
||||
@ -71,6 +63,5 @@ export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | an
|
||||
export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
/*@ts2dart_const*/[
|
||||
BROWSER_APP_COMMON_PROVIDERS,
|
||||
/*@ts2dart_Provider*/ {provide: XHR, useClass: XHRImpl},
|
||||
ADDITIONAL_TEST_BROWSER_PROVIDERS
|
||||
];
|
||||
|
@ -1,28 +1,6 @@
|
||||
import {Injectable} from 'angular2/core';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {isPresent, isString, RegExpWrapper, StringWrapper, RegExp} from 'angular2/src/facade/lang';
|
||||
|
||||
@Injectable()
|
||||
export class Log {
|
||||
logItems: any[];
|
||||
|
||||
constructor() { this.logItems = []; }
|
||||
|
||||
add(value): void { this.logItems.push(value); }
|
||||
|
||||
fn(value) {
|
||||
return (a1: any = null, a2: any = null, a3: any = null, a4: any = null, a5: any = null) => {
|
||||
this.logItems.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
clear(): void { this.logItems = []; }
|
||||
|
||||
result(): string { return this.logItems.join("; "); }
|
||||
}
|
||||
|
||||
export var browserDetection: BrowserDetection = null;
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {getDOM} from '../src/dom/dom_adapter';
|
||||
import {isPresent, isString, RegExpWrapper, StringWrapper, RegExp} from '../src/facade/lang';
|
||||
|
||||
export class BrowserDetection {
|
||||
private _ua: string;
|
||||
@ -33,7 +11,7 @@ export class BrowserDetection {
|
||||
if (isPresent(ua)) {
|
||||
this._ua = ua;
|
||||
} else {
|
||||
this._ua = isPresent(DOM) ? DOM.getUserAgent() : '';
|
||||
this._ua = isPresent(getDOM()) ? getDOM().getUserAgent() : '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,19 +45,11 @@ export class BrowserDetection {
|
||||
}
|
||||
|
||||
export function dispatchEvent(element, eventType): void {
|
||||
DOM.dispatchEvent(element, DOM.createEvent(eventType));
|
||||
getDOM().dispatchEvent(element, getDOM().createEvent(eventType));
|
||||
}
|
||||
|
||||
export function el(html: string): HTMLElement {
|
||||
return <HTMLElement>DOM.firstChild(DOM.content(DOM.createTemplate(html)));
|
||||
}
|
||||
|
||||
var _RE_SPECIAL_CHARS =
|
||||
['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|'];
|
||||
var _ESCAPE_RE = RegExpWrapper.create(`[\\${_RE_SPECIAL_CHARS.join('\\')}]`);
|
||||
export function containsRegexp(input: string): RegExp {
|
||||
return RegExpWrapper.create(
|
||||
StringWrapper.replaceAllMapped(input, _ESCAPE_RE, (match) => `\\${match[0]}`));
|
||||
return <HTMLElement>getDOM().firstChild(getDOM().content(getDOM().createTemplate(html)));
|
||||
}
|
||||
|
||||
export function normalizeCSS(css: string): string {
|
||||
@ -97,14 +67,14 @@ export function normalizeCSS(css: string): string {
|
||||
var _singleTagWhitelist = ['br', 'hr', 'input'];
|
||||
export function stringifyElement(el): string {
|
||||
var result = '';
|
||||
if (DOM.isElementNode(el)) {
|
||||
var tagName = DOM.tagName(el).toLowerCase();
|
||||
if (getDOM().isElementNode(el)) {
|
||||
var tagName = getDOM().tagName(el).toLowerCase();
|
||||
|
||||
// Opening tag
|
||||
result += `<${tagName}`;
|
||||
|
||||
// Attributes in an ordered way
|
||||
var attributeMap = DOM.attributeMap(el);
|
||||
var attributeMap = getDOM().attributeMap(el);
|
||||
var keys = [];
|
||||
attributeMap.forEach((v, k) => keys.push(k));
|
||||
ListWrapper.sort(keys);
|
||||
@ -120,8 +90,8 @@ export function stringifyElement(el): string {
|
||||
result += '>';
|
||||
|
||||
// Children
|
||||
var childrenRoot = DOM.templateAwareRoot(el);
|
||||
var children = isPresent(childrenRoot) ? DOM.childNodes(childrenRoot) : [];
|
||||
var childrenRoot = getDOM().templateAwareRoot(el);
|
||||
var children = isPresent(childrenRoot) ? getDOM().childNodes(childrenRoot) : [];
|
||||
for (let j = 0; j < children.length; j++) {
|
||||
result += stringifyElement(children[j]);
|
||||
}
|
||||
@ -130,11 +100,13 @@ export function stringifyElement(el): string {
|
||||
if (!ListWrapper.contains(_singleTagWhitelist, tagName)) {
|
||||
result += `</${tagName}>`;
|
||||
}
|
||||
} else if (DOM.isCommentNode(el)) {
|
||||
result += `<!--${DOM.nodeValue(el)}-->`;
|
||||
} else if (getDOM().isCommentNode(el)) {
|
||||
result += `<!--${getDOM().nodeValue(el)}-->`;
|
||||
} else {
|
||||
result += DOM.getText(el);
|
||||
result += getDOM().getText(el);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export var browserDetection: BrowserDetection = new BrowserDetection(null);
|
||||
|
@ -0,0 +1,24 @@
|
||||
import {Inject, Injectable} from '@angular/core';
|
||||
import {DOCUMENT} from '../src/dom/dom_tokens';
|
||||
import {getDOM} from '../src/dom/dom_adapter';
|
||||
import {TestComponentRenderer} from '@angular/compiler/testing';
|
||||
import {el} from './browser_util';
|
||||
|
||||
/**
|
||||
* A DOM based implementation of the TestComponentRenderer.
|
||||
*/
|
||||
@Injectable()
|
||||
export class DOMTestComponentRenderer extends TestComponentRenderer {
|
||||
constructor(@Inject(DOCUMENT) private _doc) { super(); }
|
||||
|
||||
insertRootElement(rootElId: string) {
|
||||
let rootEl = el(`<div id="${rootElId}"></div>`);
|
||||
|
||||
// TODO(juliemr): can/should this be optional?
|
||||
let oldRoots = getDOM().querySelectorAll(this._doc, '[id^=root]');
|
||||
for (let i = 0; i < oldRoots.length; i++) {
|
||||
getDOM().remove(oldRoots[i]);
|
||||
}
|
||||
getDOM().appendChild(this._doc.body, rootEl);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
import * as webdriver from 'selenium-webdriver';
|
||||
|
||||
declare var global;
|
||||
declare var expect: Function;
|
||||
export var browser: protractor.IBrowser = global['browser'];
|
||||
export var $: cssSelectorHelper = global['$'];
|
||||
|
||||
|
@ -19,10 +19,10 @@ const _u = const Object();
|
||||
bool elementContainsStyle(element, styles) {
|
||||
var allPassed = true;
|
||||
if (isString(styles)) {
|
||||
allPassed = DOM.hasStyle(element, styles);
|
||||
allPassed = getDOM().hasStyle(element, styles);
|
||||
} else {
|
||||
styles.forEach((prop, style) {
|
||||
allPassed = allPassed && DOM.hasStyle(element, prop, style);
|
||||
allPassed = allPassed && getDOM().hasStyle(element, prop, style);
|
||||
});
|
||||
}
|
||||
return allPassed;
|
||||
@ -51,7 +51,7 @@ class Expect extends gns.Expect {
|
||||
void toThrowErrorWith(message) => expectException(this.actual, message);
|
||||
void toBePromise() => gns.guinness.matchers.toBeTrue(actual is Future);
|
||||
void toHaveCssClass(className) =>
|
||||
gns.guinness.matchers.toBeTrue(DOM.hasClass(actual, className));
|
||||
gns.guinness.matchers.toBeTrue(getDOM().hasClass(actual, className));
|
||||
void toHaveCssStyle(styles) {
|
||||
gns.guinness.matchers.toBeTrue(elementContainsStyle(actual, styles));
|
||||
}
|
||||
@ -96,7 +96,7 @@ class NotExpect extends gns.NotExpect {
|
||||
void toEqual(expected) => toHaveSameProps(expected);
|
||||
void toBePromise() => gns.guinness.matchers.toBeFalse(actual is Future);
|
||||
void toHaveCssClass(className) =>
|
||||
gns.guinness.matchers.toBeFalse(DOM.hasClass(actual, className));
|
||||
gns.guinness.matchers.toBeFalse(getDOM().hasClass(actual, className));
|
||||
void toHaveCssStyle(styles) {
|
||||
gns.guinness.matchers.toBeFalse(elementContainsStyle(actual, styles));
|
||||
}
|
||||
@ -108,7 +108,7 @@ class NotExpect extends gns.NotExpect {
|
||||
|
||||
String elementText(n) {
|
||||
hasNodes(n) {
|
||||
var children = DOM.childNodes(n);
|
||||
var children = getDOM().childNodes(n);
|
||||
return children != null && children.length > 0;
|
||||
}
|
||||
|
||||
@ -116,21 +116,21 @@ String elementText(n) {
|
||||
return n.map(elementText).join("");
|
||||
}
|
||||
|
||||
if (DOM.isCommentNode(n)) {
|
||||
if (getDOM().isCommentNode(n)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (DOM.isElementNode(n) && DOM.tagName(n) == 'CONTENT') {
|
||||
return elementText(DOM.getDistributedNodes(n));
|
||||
if (getDOM().isElementNode(n) && getDOM().tagName(n) == 'CONTENT') {
|
||||
return elementText(getDOM().getDistributedNodes(n));
|
||||
}
|
||||
|
||||
if (DOM.hasShadowRoot(n)) {
|
||||
return elementText(DOM.childNodesAsList(DOM.getShadowRoot(n)));
|
||||
if (getDOM().hasShadowRoot(n)) {
|
||||
return elementText(getDOM().childNodesAsList(getDOM().getShadowRoot(n)));
|
||||
}
|
||||
|
||||
if (hasNodes(n)) {
|
||||
return elementText(DOM.childNodesAsList(n));
|
||||
return elementText(getDOM().childNodesAsList(n));
|
||||
}
|
||||
|
||||
return DOM.getText(n);
|
||||
return getDOM().getText(n);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {global, isString} from 'angular2/src/facade/lang';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {getDOM} from '../src/dom/dom_adapter';
|
||||
import {global, isString} from '../src/facade/lang';
|
||||
import {StringMapWrapper} from '../src/facade/collection';
|
||||
|
||||
/**
|
||||
* Jasmine matchers that check Angular specific conditions.
|
||||
@ -183,7 +183,7 @@ _global.beforeEach(function() {
|
||||
function buildError(isNot) {
|
||||
return function(actual, className) {
|
||||
return {
|
||||
pass: DOM.hasClass(actual, className) == !isNot,
|
||||
pass: getDOM().hasClass(actual, className) == !isNot,
|
||||
get message() {
|
||||
return `Expected ${actual.outerHTML} ${isNot ? 'not ' : ''}to contain the CSS class "${className}"`;
|
||||
}
|
||||
@ -197,11 +197,11 @@ _global.beforeEach(function() {
|
||||
compare: function(actual, styles) {
|
||||
var allPassed;
|
||||
if (isString(styles)) {
|
||||
allPassed = DOM.hasStyle(actual, styles);
|
||||
allPassed = getDOM().hasStyle(actual, styles);
|
||||
} else {
|
||||
allPassed = !StringMapWrapper.isEmpty(styles);
|
||||
StringMapWrapper.forEach(styles, (style, prop) => {
|
||||
allPassed = allPassed && DOM.hasStyle(actual, prop, style);
|
||||
allPassed = allPassed && getDOM().hasStyle(actual, prop, style);
|
||||
});
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ _global.beforeEach(function() {
|
||||
|
||||
function elementText(n) {
|
||||
var hasNodes = (n) => {
|
||||
var children = DOM.childNodes(n);
|
||||
var children = getDOM().childNodes(n);
|
||||
return children && children.length > 0;
|
||||
};
|
||||
|
||||
@ -298,21 +298,21 @@ function elementText(n) {
|
||||
return n.map(elementText).join("");
|
||||
}
|
||||
|
||||
if (DOM.isCommentNode(n)) {
|
||||
if (getDOM().isCommentNode(n)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (DOM.isElementNode(n) && DOM.tagName(n) == 'CONTENT') {
|
||||
return elementText(Array.prototype.slice.apply(DOM.getDistributedNodes(n)));
|
||||
if (getDOM().isElementNode(n) && getDOM().tagName(n) == 'CONTENT') {
|
||||
return elementText(Array.prototype.slice.apply(getDOM().getDistributedNodes(n)));
|
||||
}
|
||||
|
||||
if (DOM.hasShadowRoot(n)) {
|
||||
return elementText(DOM.childNodesAsList(DOM.getShadowRoot(n)));
|
||||
if (getDOM().hasShadowRoot(n)) {
|
||||
return elementText(getDOM().childNodesAsList(getDOM().getShadowRoot(n)));
|
||||
}
|
||||
|
||||
if (hasNodes(n)) {
|
||||
return elementText(DOM.childNodesAsList(n));
|
||||
return elementText(getDOM().childNodesAsList(n));
|
||||
}
|
||||
|
||||
return DOM.getText(n);
|
||||
return getDOM().getText(n);
|
||||
}
|
||||
|
@ -1,130 +0,0 @@
|
||||
// function.name (all IE)
|
||||
/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
|
||||
if (!Object.hasOwnProperty('name')) {
|
||||
Object.defineProperty(Function.prototype, 'name', {
|
||||
get: function() {
|
||||
var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/);
|
||||
var name = matches && matches.length > 1 ? matches[1] : "";
|
||||
// For better performance only parse once, and then cache the
|
||||
// result through a new accessor for repeated access.
|
||||
Object.defineProperty(this, 'name', {value: name});
|
||||
return name;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// URL polyfill for SystemJS (all IE)
|
||||
/*! @source https://github.com/ModuleLoader/es6-module-loader/blob/master/src/url-polyfill.js*/
|
||||
// from https://gist.github.com/Yaffle/1088850
|
||||
(function(global) {
|
||||
function URLPolyfill(url, baseURL) {
|
||||
if (typeof url != 'string') {
|
||||
throw new TypeError('URL must be a string');
|
||||
}
|
||||
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
|
||||
if (!m) {
|
||||
throw new RangeError();
|
||||
}
|
||||
var protocol = m[1] || "";
|
||||
var username = m[2] || "";
|
||||
var password = m[3] || "";
|
||||
var host = m[4] || "";
|
||||
var hostname = m[5] || "";
|
||||
var port = m[6] || "";
|
||||
var pathname = m[7] || "";
|
||||
var search = m[8] || "";
|
||||
var hash = m[9] || "";
|
||||
if (baseURL !== undefined) {
|
||||
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
|
||||
var flag = protocol === "" && host === "" && username === "";
|
||||
if (flag && pathname === "" && search === "") {
|
||||
search = base.search;
|
||||
}
|
||||
if (flag && pathname.charAt(0) !== "/") {
|
||||
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
|
||||
}
|
||||
// dot segments removal
|
||||
var output = [];
|
||||
pathname.replace(/^(\.\.?(\/|$))+/, "")
|
||||
.replace(/\/(\.(\/|$))+/g, "/")
|
||||
.replace(/\/\.\.$/, "/../")
|
||||
.replace(/\/?[^\/]*/g, function (p) {
|
||||
if (p === "/..") {
|
||||
output.pop();
|
||||
} else {
|
||||
output.push(p);
|
||||
}
|
||||
});
|
||||
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
|
||||
if (flag) {
|
||||
port = base.port;
|
||||
hostname = base.hostname;
|
||||
host = base.host;
|
||||
password = base.password;
|
||||
username = base.username;
|
||||
}
|
||||
if (protocol === "") {
|
||||
protocol = base.protocol;
|
||||
}
|
||||
}
|
||||
|
||||
// convert windows file URLs to use /
|
||||
if (protocol == 'file:')
|
||||
pathname = pathname.replace(/\\/g, '/');
|
||||
|
||||
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
|
||||
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
|
||||
this.protocol = protocol;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.host = host;
|
||||
this.hostname = hostname;
|
||||
this.port = port;
|
||||
this.pathname = pathname;
|
||||
this.search = search;
|
||||
this.hash = hash;
|
||||
}
|
||||
global.URLPolyfill = URLPolyfill;
|
||||
})(typeof self != 'undefined' ? self : global);
|
||||
|
||||
//classList (IE9)
|
||||
/*! @license please refer to http://unlicense.org/ */
|
||||
/*! @author Eli Grey */
|
||||
/*! @source https://github.com/eligrey/classList.js */
|
||||
;if("document" in self&&!("classList" in document.createElement("_"))){(function(j){"use strict";if(!("Element" in j)){return}var a="classList",f="prototype",m=j.Element[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=function(s){var r=k.call(s.getAttribute("class")||""),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){this.push(q[p])}this._updateClassName=function(){s.setAttribute("class",this.toString())}},e=d[f]=[],i=function(){return new d(this)};n[f]=Error[f];e.item=function(o){return this[o]||null};e.contains=function(o){o+="";return g(this,o)!==-1};e.add=function(){var s=arguments,r=0,p=s.length,q,o=false;do{q=s[r]+"";if(g(this,q)===-1){this.push(q);o=true}}while(++r<p);if(o){this._updateClassName()}};e.remove=function(){var t=arguments,s=0,p=t.length,r,o=false;do{r=t[s]+"";var q=g(this,r);if(q!==-1){this.splice(q,1);o=true}}while(++s<p);if(o){this._updateClassName()}};e.toggle=function(p,q){p+="";var o=this.contains(p),r=o?q!==true&&"remove":q!==false&&"add";if(r){this[r](p)}return !o};e.toString=function(){return this.join(" ")};if(b.defineProperty){var l={get:i,enumerable:true,configurable:true};try{b.defineProperty(m,a,l)}catch(h){if(h.number===-2146823252){l.enumerable=false;b.defineProperty(m,a,l)}}}else{if(b[f].__defineGetter__){m.__defineGetter__(a,i)}}}(self))};
|
||||
|
||||
//console mock (IE9)
|
||||
if (!window.console) window.console = {};
|
||||
if (!window.console.log) window.console.log = function () { };
|
||||
if (!window.console.error) window.console.error = function () { };
|
||||
if (!window.console.warn) window.console.warn = function () { };
|
||||
if (!window.console.assert) window.console.assert = function () { };
|
||||
|
||||
//RequestAnimationFrame (IE9, Android 4.1, 4.2, 4.3)
|
||||
/*! @author Paul Irish */
|
||||
/*! @source https://gist.github.com/paulirish/1579671 */
|
||||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
||||
|
||||
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
||||
|
||||
// MIT license
|
||||
|
||||
(function() {
|
||||
var lastTime = 0;
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = Date.now();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
|
||||
timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
|
||||
if (!window.cancelAnimationFrame)
|
||||
window.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
}());
|
1
modules/@angular/platform-browser/testing_e2e.ts
Normal file
1
modules/@angular/platform-browser/testing_e2e.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './testing/e2e_util';
|
32
modules/@angular/platform-browser/tsconfig-es2015.json
Normal file
32
modules/@angular/platform-browser/tsconfig-es2015.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/platform-browser/esm",
|
||||
"paths": {
|
||||
"selenium-webdriver": ["./typings/selenium-webdriver/selenium-webdriver.d.ts"],
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/core/testing": ["../../../dist/packages-dist/core/testing"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
"@angular/common/testing": ["../../../dist/packages-dist/common/testing"],
|
||||
"@angular/compiler": ["../../../dist/packages-dist/compiler"],
|
||||
"@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": ".",
|
||||
"target": "es2015"
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"testing.ts",
|
||||
"../typings/jasmine/jasmine.d.ts",
|
||||
"../typings/hammerjs/hammerjs.d.ts",
|
||||
"../typings/angular-protractor/angular-protractor.d.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
]
|
||||
}
|
35
modules/@angular/platform-browser/tsconfig.json
Normal file
35
modules/@angular/platform-browser/tsconfig.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/platform-browser/",
|
||||
"paths": {
|
||||
"selenium-webdriver": ["./typings/selenium-webdriver/selenium-webdriver.d.ts"],
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/core/testing": ["../../../dist/packages-dist/core/testing"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
"@angular/common/testing": ["../../../dist/packages-dist/common/testing"],
|
||||
"@angular/compiler": ["../../../dist/packages-dist/compiler"],
|
||||
"@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": ".",
|
||||
"target": "es5"
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"testing.ts",
|
||||
"../typings/es6-collections/es6-collections.d.ts",
|
||||
"../typings/es6-promise/es6-promise.d.ts",
|
||||
"../manual_typings/globals.d.ts",
|
||||
"../typings/hammerjs/hammerjs.d.ts",
|
||||
"../typings/angular-protractor/angular-protractor.d.ts",
|
||||
"../typings/jasmine/jasmine.d.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user