refactor(dart): Format Dart code
Use the dart formatter to clean up all pure Dart code. Closes #4832
This commit is contained in:
parent
6be95ae88a
commit
fd0ba37734
|
@ -5,8 +5,10 @@ library angular2;
|
|||
*
|
||||
* This library does not include `bootstrap`. Import `bootstrap.dart` instead.
|
||||
*/
|
||||
export 'package:angular2/core.dart' hide forwardRef, resolveForwardRef, ForwardRefFn;
|
||||
export 'package:angular2/core.dart'
|
||||
hide forwardRef, resolveForwardRef, ForwardRefFn;
|
||||
export 'package:angular2/profile.dart';
|
||||
export 'package:angular2/lifecycle_hooks.dart';
|
||||
export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
|
||||
export 'package:angular2/src/core/application_tokens.dart'
|
||||
hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
|
||||
export 'package:angular2/src/core/render/dom/dom_tokens.dart';
|
||||
|
|
|
@ -8,7 +8,8 @@ export 'package:angular2/src/core/pipes.dart';
|
|||
export 'package:angular2/src/core/facade.dart';
|
||||
// Do not export application for dart. Must import from angular2/bootstrap
|
||||
//export 'package:angular2/src/core/application.dart';
|
||||
export 'package:angular2/src/core/application_ref.dart' hide ApplicationRef_, PlatformRef_;
|
||||
export 'package:angular2/src/core/application_ref.dart'
|
||||
hide ApplicationRef_, PlatformRef_;
|
||||
export 'package:angular2/src/core/services.dart';
|
||||
export 'package:angular2/src/core/linker.dart';
|
||||
export 'package:angular2/src/core/lifecycle.dart';
|
||||
|
|
|
@ -9,7 +9,8 @@ import 'application_common.dart';
|
|||
|
||||
import 'package:angular2/src/core/compiler/compiler.dart';
|
||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart';
|
||||
export 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef;
|
||||
export 'package:angular2/src/core/linker/dynamic_component_loader.dart'
|
||||
show ComponentRef;
|
||||
|
||||
/// Starts an application from a root component. This implementation uses
|
||||
/// mirrors. Angular 2 transformer automatically replaces this method with a
|
||||
|
|
|
@ -2,7 +2,8 @@ library angular2.src.core.application_static;
|
|||
|
||||
import 'dart:async';
|
||||
import 'application_common.dart';
|
||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef;
|
||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
|
||||
show ComponentRef;
|
||||
|
||||
/// Starts an application from a root component.
|
||||
///
|
||||
|
|
|
@ -8,7 +8,8 @@ library change_detection.change_detection_jit_generator;
|
|||
/// `src/transform/template_compiler/change_detector_codegen.dart` for details.
|
||||
class ChangeDetectorJITGenerator {
|
||||
String typeName;
|
||||
ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) {}
|
||||
ChangeDetectorJITGenerator(
|
||||
definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) {}
|
||||
|
||||
generate() {
|
||||
throw "Jit Change Detection is not supported in Dart";
|
||||
|
|
|
@ -16,4 +16,4 @@ String combineGeneratedStrings(List<String> vals) {
|
|||
|
||||
String rawString(String str) {
|
||||
return "r'$str'";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,4 +2,4 @@ library change_detection.observable_facade;
|
|||
|
||||
import 'package:observe/observe.dart';
|
||||
|
||||
bool isObservable(value) => value is Observable;
|
||||
bool isObservable(value) => value is Observable;
|
||||
|
|
|
@ -340,13 +340,13 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {
|
|||
throw 'not implemented';
|
||||
}
|
||||
|
||||
bool isPageRule(rule) => (rule.type == 6);
|
||||
bool isPageRule(rule) => (rule.type == 6);
|
||||
|
||||
bool isStyleRule(rule) => (rule.type == 1);
|
||||
|
||||
bool isMediaRule(rule) => (rule.type == 4);
|
||||
|
||||
bool isKeyframesRule(rule) => (rule.type == 7);
|
||||
bool isKeyframesRule(rule) => (rule.type == 7);
|
||||
|
||||
String getHref(element) {
|
||||
throw 'not implemented';
|
||||
|
|
|
@ -98,7 +98,7 @@ final _keyCodeToKeyMap = const {
|
|||
final bool _supportsTemplateElement = () {
|
||||
try {
|
||||
return new TemplateElement().content != null;
|
||||
} catch(_) {
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}();
|
||||
|
@ -216,7 +216,8 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
|||
String nodeName(Node el) => el.nodeName;
|
||||
String nodeValue(Node el) => el.nodeValue;
|
||||
String type(InputElement el) => el.type;
|
||||
Node content(TemplateElement el) => _supportsTemplateElement ? el.content : el;
|
||||
Node content(TemplateElement el) =>
|
||||
_supportsTemplateElement ? el.content : el;
|
||||
Node firstChild(el) => el.firstChild;
|
||||
Node nextSibling(Node el) => el.nextNode;
|
||||
Element parentElement(Node el) => el.parent;
|
||||
|
@ -456,7 +457,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
|||
setGlobalVar(String path, value) {
|
||||
var parts = path.split('.');
|
||||
var obj = js.context;
|
||||
while(parts.length > 1) {
|
||||
while (parts.length > 1) {
|
||||
var name = parts.removeAt(0);
|
||||
if (obj.hasProperty(name)) {
|
||||
obj = obj[name];
|
||||
|
|
|
@ -18,22 +18,19 @@ List<EmulatedCssRule> parseAndEmulateCssRules(String css) {
|
|||
|
||||
/// Converts `csslib` [rules] to their emulated counterparts.
|
||||
List<EmulatedCssRule> emulateRules(Iterable<cssv.TreeNode> rules) {
|
||||
return rules
|
||||
.map((cssv.TreeNode node) {
|
||||
if (node is cssv.RuleSet) {
|
||||
if (node.declarationGroup.span.text.isEmpty) {
|
||||
// Skip CSS matchers with no bodies
|
||||
return null;
|
||||
}
|
||||
return new EmulatedCssStyleRule(node);
|
||||
} else if (node is cssv.MediaDirective) {
|
||||
return new EmulatedCssMedialRule(node);
|
||||
} else if (node is cssv.ImportDirective) {
|
||||
return new EmulatedCssImportRule(node);
|
||||
return rules.map((cssv.TreeNode node) {
|
||||
if (node is cssv.RuleSet) {
|
||||
if (node.declarationGroup.span.text.isEmpty) {
|
||||
// Skip CSS matchers with no bodies
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.where((r) => r != null)
|
||||
.toList();
|
||||
return new EmulatedCssStyleRule(node);
|
||||
} else if (node is cssv.MediaDirective) {
|
||||
return new EmulatedCssMedialRule(node);
|
||||
} else if (node is cssv.ImportDirective) {
|
||||
return new EmulatedCssImportRule(node);
|
||||
}
|
||||
}).where((r) => r != null).toList();
|
||||
}
|
||||
|
||||
/// Emulates [CSSRule](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule)
|
||||
|
@ -98,8 +95,8 @@ class EmulatedMediaList {
|
|||
String mediaText;
|
||||
|
||||
EmulatedMediaList(cssv.MediaDirective directive) {
|
||||
this.mediaText = directive.mediaQueries
|
||||
.map((q) => q.span.text).join(' and ');
|
||||
this.mediaText =
|
||||
directive.mediaQueries.map((q) => q.span.text).join(' and ');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class ListWrapper {
|
|||
from = _startOffset(l, from);
|
||||
to = _endOffset(l, to);
|
||||
//in JS if from > to an empty array is returned
|
||||
if(to != null && from > to) {
|
||||
if (to != null && from > to) {
|
||||
return [];
|
||||
}
|
||||
return l.sublist(from, to);
|
||||
|
@ -211,7 +211,6 @@ class ListWrapper {
|
|||
return end < 0 ? max(len + end, 0) : min(end, len);
|
||||
}
|
||||
|
||||
|
||||
static maximum(List l, fn(item)) {
|
||||
if (l.length == 0) {
|
||||
return null;
|
||||
|
|
|
@ -20,11 +20,18 @@ class WrappedException extends Error {
|
|||
final originalStack;
|
||||
|
||||
WrappedException(
|
||||
[this.wrapperMessage, this.originalException, this.originalStack, this.context]);
|
||||
[this.wrapperMessage,
|
||||
this.originalException,
|
||||
this.originalStack,
|
||||
this.context]);
|
||||
|
||||
get message { return ExceptionHandler.exceptionToString(this); }
|
||||
get message {
|
||||
return ExceptionHandler.exceptionToString(this);
|
||||
}
|
||||
|
||||
String toString() { return this.message; }
|
||||
String toString() {
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
|
||||
Error makeTypeError([String message = ""]) {
|
||||
|
|
|
@ -94,7 +94,7 @@ class StringWrapper {
|
|||
start = _startOffset(s, start);
|
||||
end = _endOffset(s, end);
|
||||
//in JS if start > end an empty string is returned
|
||||
if(end != null && start > end) {
|
||||
if (end != null && start > end) {
|
||||
return "";
|
||||
}
|
||||
return s.substring(start, end);
|
||||
|
|
|
@ -6,8 +6,7 @@ import 'package:angular2/src/core/facade/async.dart';
|
|||
/**
|
||||
* See query_list.ts
|
||||
*/
|
||||
class QueryList<T> extends Object
|
||||
with IterableMixin<T> {
|
||||
class QueryList<T> extends Object with IterableMixin<T> {
|
||||
List<T> _results = [];
|
||||
EventEmitter _emitter = new EventEmitter();
|
||||
|
||||
|
|
|
@ -14,85 +14,102 @@ export './metadata/view.dart' hide VIEW_ENCAPSULATION_VALUES;
|
|||
* See: [DirectiveMetadata] for docs.
|
||||
*/
|
||||
class Directive extends DirectiveMetadata {
|
||||
const Directive({String selector, List<String> inputs,
|
||||
List<String> outputs,
|
||||
@deprecated List<String> properties,
|
||||
@deprecated List<String> events,
|
||||
Map<String, String> host,
|
||||
@deprecated List bindings,
|
||||
List providers, String exportAs, String moduleId,
|
||||
Map<String, dynamic> queries})
|
||||
: super(
|
||||
selector: selector,
|
||||
inputs: inputs,
|
||||
outputs: outputs,
|
||||
properties: properties,
|
||||
events: events,
|
||||
host: host,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
exportAs: exportAs,
|
||||
moduleId: moduleId,
|
||||
queries: queries);
|
||||
const Directive(
|
||||
{String selector,
|
||||
List<String> inputs,
|
||||
List<String> outputs,
|
||||
@deprecated List<String> properties,
|
||||
@deprecated List<String> events,
|
||||
Map<String, String> host,
|
||||
@deprecated List bindings,
|
||||
List providers,
|
||||
String exportAs,
|
||||
String moduleId,
|
||||
Map<String, dynamic> queries})
|
||||
: super(
|
||||
selector: selector,
|
||||
inputs: inputs,
|
||||
outputs: outputs,
|
||||
properties: properties,
|
||||
events: events,
|
||||
host: host,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
exportAs: exportAs,
|
||||
moduleId: moduleId,
|
||||
queries: queries);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [ComponentMetadata] for docs.
|
||||
*/
|
||||
class Component extends ComponentMetadata {
|
||||
const Component({String selector, List<String> inputs,
|
||||
List<String> outputs,
|
||||
@deprecated List<String> properties,
|
||||
@deprecated List<String> events,
|
||||
Map<String, String> host,
|
||||
@deprecated List bindings, List providers, String exportAs, String moduleId,
|
||||
Map<String, dynamic> queries,
|
||||
@deprecated List viewBindings,
|
||||
List viewProviders, ChangeDetectionStrategy changeDetection,
|
||||
String templateUrl, String template, dynamic directives,
|
||||
dynamic pipes, ViewEncapsulation encapsulation, List<String> styles,
|
||||
List<String> styleUrls
|
||||
})
|
||||
: super(
|
||||
selector: selector,
|
||||
inputs: inputs,
|
||||
outputs: outputs,
|
||||
properties: properties,
|
||||
events: events,
|
||||
host: host,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
exportAs: exportAs,
|
||||
moduleId: moduleId,
|
||||
viewBindings: viewBindings,
|
||||
viewProviders: viewProviders,
|
||||
queries: queries,
|
||||
changeDetection: changeDetection,
|
||||
templateUrl: templateUrl,
|
||||
template: template,
|
||||
directives: directives,
|
||||
pipes: pipes,
|
||||
encapsulation: encapsulation,
|
||||
styles: styles,
|
||||
styleUrls: styleUrls
|
||||
);
|
||||
const Component(
|
||||
{String selector,
|
||||
List<String> inputs,
|
||||
List<String> outputs,
|
||||
@deprecated List<String> properties,
|
||||
@deprecated List<String> events,
|
||||
Map<String, String> host,
|
||||
@deprecated List bindings,
|
||||
List providers,
|
||||
String exportAs,
|
||||
String moduleId,
|
||||
Map<String, dynamic> queries,
|
||||
@deprecated List viewBindings,
|
||||
List viewProviders,
|
||||
ChangeDetectionStrategy changeDetection,
|
||||
String templateUrl,
|
||||
String template,
|
||||
dynamic directives,
|
||||
dynamic pipes,
|
||||
ViewEncapsulation encapsulation,
|
||||
List<String> styles,
|
||||
List<String> styleUrls})
|
||||
: super(
|
||||
selector: selector,
|
||||
inputs: inputs,
|
||||
outputs: outputs,
|
||||
properties: properties,
|
||||
events: events,
|
||||
host: host,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
exportAs: exportAs,
|
||||
moduleId: moduleId,
|
||||
viewBindings: viewBindings,
|
||||
viewProviders: viewProviders,
|
||||
queries: queries,
|
||||
changeDetection: changeDetection,
|
||||
templateUrl: templateUrl,
|
||||
template: template,
|
||||
directives: directives,
|
||||
pipes: pipes,
|
||||
encapsulation: encapsulation,
|
||||
styles: styles,
|
||||
styleUrls: styleUrls);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [ViewMetadata] for docs.
|
||||
*/
|
||||
class View extends ViewMetadata {
|
||||
const View({String templateUrl, String template, dynamic directives,
|
||||
dynamic pipes, ViewEncapsulation encapsulation, List<String> styles,
|
||||
List<String> styleUrls})
|
||||
: super(
|
||||
templateUrl: templateUrl,
|
||||
template: template,
|
||||
directives: directives,
|
||||
pipes: pipes,
|
||||
encapsulation: encapsulation,
|
||||
styles: styles,
|
||||
styleUrls: styleUrls);
|
||||
const View(
|
||||
{String templateUrl,
|
||||
String template,
|
||||
dynamic directives,
|
||||
dynamic pipes,
|
||||
ViewEncapsulation encapsulation,
|
||||
List<String> styles,
|
||||
List<String> styleUrls})
|
||||
: super(
|
||||
templateUrl: templateUrl,
|
||||
template: template,
|
||||
directives: directives,
|
||||
pipes: pipes,
|
||||
encapsulation: encapsulation,
|
||||
styles: styles,
|
||||
styleUrls: styleUrls);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,23 +131,23 @@ class Attribute extends AttributeMetadata {
|
|||
*/
|
||||
class Query extends QueryMetadata {
|
||||
const Query(dynamic /*Type | string*/ selector, {bool descendants: false})
|
||||
: super(selector, descendants: descendants);
|
||||
: super(selector, descendants: descendants);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [ContentChildrenMetadata] for docs.
|
||||
*/
|
||||
class ContentChildren extends ContentChildrenMetadata {
|
||||
const ContentChildren(dynamic /*Type | string*/ selector, {bool descendants: false})
|
||||
: super(selector, descendants: descendants);
|
||||
const ContentChildren(dynamic /*Type | string*/ selector,
|
||||
{bool descendants: false})
|
||||
: super(selector, descendants: descendants);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [ContentChildMetadata] for docs.
|
||||
*/
|
||||
class ContentChild extends ContentChildMetadata {
|
||||
const ContentChild(dynamic /*Type | string*/ selector)
|
||||
: super(selector);
|
||||
const ContentChild(dynamic /*Type | string*/ selector) : super(selector);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,47 +155,42 @@ class ContentChild extends ContentChildMetadata {
|
|||
*/
|
||||
class ViewQuery extends ViewQueryMetadata {
|
||||
const ViewQuery(dynamic /*Type | string*/ selector)
|
||||
: super(selector, descendants: true);
|
||||
: super(selector, descendants: true);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [ViewChildrenMetadata] for docs.
|
||||
*/
|
||||
class ViewChildren extends ViewChildrenMetadata {
|
||||
const ViewChildren(dynamic /*Type | string*/ selector)
|
||||
: super(selector);
|
||||
const ViewChildren(dynamic /*Type | string*/ selector) : super(selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [ViewChildMetadata] for docs.
|
||||
*/
|
||||
class ViewChild extends ViewChildMetadata {
|
||||
const ViewChild(dynamic /*Type | string*/ selector)
|
||||
: super(selector);
|
||||
const ViewChild(dynamic /*Type | string*/ selector) : super(selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [InputMetadata] for docs.
|
||||
*/
|
||||
class Input extends InputMetadata {
|
||||
const Input([String bindingPropertyName])
|
||||
: super(bindingPropertyName);
|
||||
const Input([String bindingPropertyName]) : super(bindingPropertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [OutputMetadata] for docs.
|
||||
*/
|
||||
class Output extends OutputMetadata {
|
||||
const Output([String bindingPropertyName])
|
||||
: super(bindingPropertyName);
|
||||
const Output([String bindingPropertyName]) : super(bindingPropertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* See: [HostBindingMetadata] for docs.
|
||||
*/
|
||||
class HostBinding extends HostBindingMetadata {
|
||||
const HostBinding([String hostPropertyName])
|
||||
: super(hostPropertyName);
|
||||
const HostBinding([String hostPropertyName]) : super(hostPropertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,5 +198,5 @@ class HostBinding extends HostBindingMetadata {
|
|||
*/
|
||||
class HostListener extends HostListenerMetadata {
|
||||
const HostListener(String eventName, [List<String> args])
|
||||
: super(eventName, args);
|
||||
}
|
||||
: super(eventName, args);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
library angular2.src.core.platform_bindings;
|
||||
|
||||
|
||||
import 'package:angular2/core.dart';
|
||||
import 'package:angular2/src/core/facade/exceptions.dart';
|
||||
import 'package:angular2/src/core/dom/dom_adapter.dart';
|
||||
|
||||
exceptionFactory() => new ExceptionHandler(DOM, true);
|
||||
|
||||
const EXCEPTION_PROVIDER = const Binding(ExceptionHandler, toFactory: exceptionFactory, deps: const []);
|
||||
const EXCEPTION_PROVIDER = const Binding(ExceptionHandler,
|
||||
toFactory: exceptionFactory, deps: const []);
|
||||
|
||||
const EXCEPTION_BINDING = EXCEPTION_PROVIDER;
|
||||
|
|
|
@ -259,7 +259,7 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
|
||||
Map propMetadata(typeOrFunc) {
|
||||
final res = {};
|
||||
reflectClass(typeOrFunc).declarations.forEach((k,v) {
|
||||
reflectClass(typeOrFunc).declarations.forEach((k, v) {
|
||||
var name = _normalizeName(MirrorSystem.getName(k));
|
||||
if (res[name] == null) res[name] = [];
|
||||
res[name].addAll(v.metadata.map((fm) => fm.reflectee));
|
||||
|
@ -277,8 +277,9 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
|
||||
List _interfacesFromMirror(classMirror) {
|
||||
return classMirror.superinterfaces.map((si) => si.reflectedType).toList()
|
||||
..addAll(classMirror.superclass == null ? []
|
||||
: _interfacesFromMirror(classMirror.superclass));
|
||||
..addAll(classMirror.superclass == null
|
||||
? []
|
||||
: _interfacesFromMirror(classMirror.superclass));
|
||||
}
|
||||
|
||||
GetterFn getter(String name) {
|
||||
|
|
|
@ -10,8 +10,17 @@ import 'dart:js' as js;
|
|||
// Proxies a Dart function that accepts up to 10 parameters.
|
||||
js.JsFunction _jsFunction(Function fn) {
|
||||
const Object X = __varargSentinel;
|
||||
return new js.JsFunction.withThis((thisArg, [o1 = X, o2 = X, o3 = X, o4 = X,
|
||||
o5 = X, o6 = X, o7 = X, o8 = X, o9 = X, o10 = X]) {
|
||||
return new js.JsFunction.withThis((thisArg,
|
||||
[o1 = X,
|
||||
o2 = X,
|
||||
o3 = X,
|
||||
o4 = X,
|
||||
o5 = X,
|
||||
o6 = X,
|
||||
o7 = X,
|
||||
o8 = X,
|
||||
o9 = X,
|
||||
o10 = X]) {
|
||||
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
|
||||
});
|
||||
}
|
||||
|
@ -91,17 +100,17 @@ class BrowserGetTestability implements GetTestability {
|
|||
static init() {
|
||||
setTestabilityGetter(const BrowserGetTestability());
|
||||
}
|
||||
|
||||
|
||||
void addToWindow(TestabilityRegistry registry) {
|
||||
var jsRegistry = js.context['ngTestabilityRegistries'];
|
||||
if (jsRegistry == null) {
|
||||
js.context['ngTestabilityRegistries'] = jsRegistry = new js.JsArray();
|
||||
js.context['getAngularTestability'] = _jsify((Element elem,
|
||||
[bool findInAncestors = true]) {
|
||||
js.context['getAngularTestability'] =
|
||||
_jsify((Element elem, [bool findInAncestors = true]) {
|
||||
var registry = js.context['ngTestabilityRegistries'];
|
||||
for (int i = 0; i < registry.length; i++) {
|
||||
var result = registry[i].callMethod(
|
||||
'getAngularTestability', [elem, findInAncestors]);
|
||||
var result = registry[i]
|
||||
.callMethod('getAngularTestability', [elem, findInAncestors]);
|
||||
if (result != null) return result;
|
||||
}
|
||||
throw 'Could not find testability for element.';
|
||||
|
@ -122,8 +131,8 @@ class BrowserGetTestability implements GetTestability {
|
|||
|
||||
js.JsObject _createRegistry(TestabilityRegistry registry) {
|
||||
var object = new js.JsObject(js.context['Object']);
|
||||
object['getAngularTestability'] = _jsify((Element elem,
|
||||
bool findInAncestors) {
|
||||
object['getAngularTestability'] =
|
||||
_jsify((Element elem, bool findInAncestors) {
|
||||
var testability = registry.findTestabilityInTree(elem, findInAncestors);
|
||||
return testability == null
|
||||
? null
|
||||
|
|
|
@ -214,7 +214,6 @@ class NgZone {
|
|||
try {
|
||||
_inVmTurnDone = true;
|
||||
parent.run(_innerZone, _onTurnDone);
|
||||
|
||||
} finally {
|
||||
_inVmTurnDone = false;
|
||||
_hasExecutedCodeInInnerZone = false;
|
||||
|
|
|
@ -9,6 +9,7 @@ RouteDefinition normalizeRouteConfig(RouteDefinition config) {
|
|||
|
||||
void assertComponentExists(Type component, String path) {
|
||||
if (component == null) {
|
||||
throw new BaseException('Component for route "${path}" is not defined, or is not a class.');
|
||||
throw new BaseException(
|
||||
'Component for route "${path}" is not defined, or is not a class.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ void testSetup() {
|
|||
}, priority: 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allows overriding default bindings defined in test_injector.js.
|
||||
*
|
||||
|
@ -93,14 +92,16 @@ void beforeEachBindings(Function fn) {
|
|||
}
|
||||
|
||||
void beforeEach(fn) {
|
||||
if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn, false);
|
||||
if (fn is! FunctionWithParamTokens) fn =
|
||||
new FunctionWithParamTokens([], fn, false);
|
||||
gns.beforeEach(() {
|
||||
fn.execute(_injector);
|
||||
});
|
||||
}
|
||||
|
||||
void _it(gnsFn, name, fn) {
|
||||
if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn, false);
|
||||
if (fn is! FunctionWithParamTokens) fn =
|
||||
new FunctionWithParamTokens([], fn, false);
|
||||
gnsFn(name, () {
|
||||
_inIt = true;
|
||||
fn.execute(_injector);
|
||||
|
@ -139,7 +140,9 @@ class SpyObject extends gns.SpyObject {
|
|||
_spyFuncs.putIfAbsent(funcName, () => new SpyFunction(funcName));
|
||||
|
||||
void prop(String funcName, value) {
|
||||
_spyFuncs.putIfAbsent("get:${funcName}", () => new SpyFunction(funcName)).andReturn(value);
|
||||
_spyFuncs
|
||||
.putIfAbsent("get:${funcName}", () => new SpyFunction(funcName))
|
||||
.andReturn(value);
|
||||
}
|
||||
|
||||
static stub([object = null, config = null, overrides = null]) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
library angular2.src.tools.tools;
|
||||
|
||||
import 'dart:js';
|
||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef;
|
||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
|
||||
show ComponentRef;
|
||||
import 'common_tools.dart' show AngularTools;
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,8 @@ import "package:angular2/src/web_workers/worker/application_common.dart"
|
|||
show bootstrapWebWorkerCommon;
|
||||
import "package:angular2/src/core/facade/async.dart" show Future;
|
||||
import "package:angular2/src/core/facade/lang.dart" show Type, BaseException;
|
||||
import "package:angular2/src/core/linker/dynamic_component_loader.dart" show ComponentRef;
|
||||
import "package:angular2/src/core/linker/dynamic_component_loader.dart"
|
||||
show ComponentRef;
|
||||
import "dart:isolate";
|
||||
import "dart:async";
|
||||
import 'dart:core';
|
||||
|
@ -22,8 +23,7 @@ import 'package:angular2/src/core/dom/webworker_adapter.dart';
|
|||
* bootstrap() in a regular Angular application
|
||||
* See the bootstrap() docs for more details.
|
||||
*/
|
||||
Future<ComponentRef> bootstrapWebWorker(
|
||||
SendPort replyTo, Type appComponentType,
|
||||
Future<ComponentRef> bootstrapWebWorker(SendPort replyTo, Type appComponentType,
|
||||
[List<dynamic> componentInjectableBindings = null]) {
|
||||
WebWorkerDomAdapter.makeCurrent();
|
||||
ReceivePort rPort = new ReceivePort();
|
||||
|
|
|
@ -24,4 +24,4 @@ class Entity implements Observable {
|
|||
bool deliverChanges() => null;
|
||||
notifyPropertyChange(Symbol field, Object oldValue, Object newValue) => null;
|
||||
void notifyChange(record) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import "dart:async";
|
|||
|
||||
Uri toDartDataUri(String source) {
|
||||
return Uri.parse("data:application/dart;charset=utf-8,"
|
||||
"${Uri.encodeComponent(source)}");
|
||||
"${Uri.encodeComponent(source)}");
|
||||
}
|
||||
|
||||
createIsolateSource(String moduleSource, List<List<String>> moduleImports) {
|
||||
|
@ -24,27 +24,32 @@ main(List args, SendPort replyPort) {
|
|||
|
||||
var timeStamp = new DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
dynamic callModule(dynamic data) { return data.map( (a) => a+1); }
|
||||
dynamic callModule(dynamic data) {
|
||||
return data.map((a) => a + 1);
|
||||
}
|
||||
|
||||
evalModule(String moduleSource, List<List<String>> imports, List args) {
|
||||
String source = createIsolateSource(moduleSource, imports);
|
||||
Completer completer = new Completer();
|
||||
RawReceivePort receivePort;
|
||||
receivePort = new RawReceivePort( (message) {
|
||||
receivePort.close();
|
||||
completer.complete(message);
|
||||
});
|
||||
// Note: we have a special karma plugin that sends files under
|
||||
// urls like /package_1234 as permanently cached.
|
||||
// With this, spawning multiple isolates gets faster as Darts does not
|
||||
// reload the files from the server.
|
||||
var packageRoot = Uri.parse('/packages_${timeStamp}');
|
||||
return Isolate.spawnUri(toDartDataUri(source), args, receivePort.sendPort, packageRoot: packageRoot).then( (isolate) {
|
||||
RawReceivePort errorPort;
|
||||
errorPort = new RawReceivePort( (message) {
|
||||
completer.completeError(message);
|
||||
});
|
||||
isolate.addErrorListener(errorPort.sendPort);
|
||||
return completer.future;
|
||||
String source = createIsolateSource(moduleSource, imports);
|
||||
Completer completer = new Completer();
|
||||
RawReceivePort receivePort;
|
||||
receivePort = new RawReceivePort((message) {
|
||||
receivePort.close();
|
||||
completer.complete(message);
|
||||
});
|
||||
// Note: we have a special karma plugin that sends files under
|
||||
// urls like /package_1234 as permanently cached.
|
||||
// With this, spawning multiple isolates gets faster as Darts does not
|
||||
// reload the files from the server.
|
||||
var packageRoot = Uri.parse('/packages_${timeStamp}');
|
||||
return Isolate
|
||||
.spawnUri(toDartDataUri(source), args, receivePort.sendPort,
|
||||
packageRoot: packageRoot)
|
||||
.then((isolate) {
|
||||
RawReceivePort errorPort;
|
||||
errorPort = new RawReceivePort((message) {
|
||||
completer.completeError(message);
|
||||
});
|
||||
isolate.addErrorListener(errorPort.sendPort);
|
||||
return completer.future;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ library angular2.test.directives.observable_list_iterable_diff_spec;
|
|||
|
||||
import 'package:angular2/testing_internal.dart';
|
||||
import 'package:observe/observe.dart' show ObservableList;
|
||||
import 'package:angular2/core.dart' show ObservableListDiffFactory, ChangeDetectorRef;
|
||||
import 'package:angular2/core.dart'
|
||||
show ObservableListDiffFactory, ChangeDetectorRef;
|
||||
|
||||
@proxy
|
||||
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
|
||||
|
|
|
@ -7,96 +7,106 @@ import 'package:angular2/src/core/linker/interfaces.dart';
|
|||
main() {
|
||||
describe('Create DirectiveMetadata', () {
|
||||
describe('lifecycle', () {
|
||||
|
||||
describe("onChanges", () {
|
||||
it("should be true when the directive has the onChanges method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveImplementingOnChanges))
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.OnChanges, DirectiveImplementingOnChanges))
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveNoHooks)).toBe(false);
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("onDestroy", () {
|
||||
it("should be true when the directive has the onDestroy method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveImplementingOnDestroy))
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.OnDestroy, DirectiveImplementingOnDestroy))
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveNoHooks)).toBe(false);
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("onInit", () {
|
||||
it("should be true when the directive has the onInit method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveImplementingOnInit))
|
||||
.toBe(true);
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.OnInit, DirectiveImplementingOnInit)).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveNoHooks)).toBe(false);
|
||||
expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("doCheck", () {
|
||||
it("should be true when the directive has the doCheck method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveImplementingOnCheck))
|
||||
.toBe(true);
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.DoCheck, DirectiveImplementingOnCheck)).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveNoHooks)).toBe(false);
|
||||
expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("afterContentInit", () {
|
||||
it("should be true when the directive has the afterContentInit method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterContentInit, DirectiveImplementingAfterContentInit))
|
||||
.toBe(true);
|
||||
it("should be true when the directive has the afterContentInit method",
|
||||
() {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterContentInit,
|
||||
DirectiveImplementingAfterContentInit)).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterContentInit, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.AfterContentInit, DirectiveNoHooks)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("afterContentChecked", () {
|
||||
it("should be true when the directive has the afterContentChecked method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked, DirectiveImplementingAfterContentChecked))
|
||||
.toBe(true);
|
||||
it("should be true when the directive has the afterContentChecked method",
|
||||
() {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked,
|
||||
DirectiveImplementingAfterContentChecked)).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked, DirectiveNoHooks))
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.AfterContentChecked, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("afterViewInit", () {
|
||||
it("should be true when the directive has the afterViewInit method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, DirectiveImplementingAfterViewInit))
|
||||
.toBe(true);
|
||||
it("should be true when the directive has the afterViewInit method",
|
||||
() {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterViewInit,
|
||||
DirectiveImplementingAfterViewInit)).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, DirectiveNoHooks)).toBe(false);
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.AfterViewInit, DirectiveNoHooks)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("afterViewChecked", () {
|
||||
it("should be true when the directive has the afterViewChecked method", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked, DirectiveImplementingAfterViewChecked))
|
||||
.toBe(true);
|
||||
it("should be true when the directive has the afterViewChecked method",
|
||||
() {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked,
|
||||
DirectiveImplementingAfterViewChecked)).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false otherwise", () {
|
||||
expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked, DirectiveNoHooks))
|
||||
.toBe(false);
|
||||
expect(hasLifecycleHook(
|
||||
LifecycleHooks.AfterViewChecked, DirectiveNoHooks)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -149,7 +149,8 @@ main() {
|
|||
.createAsync(Dummy)
|
||||
.then((tc) {
|
||||
tc.detectChanges();
|
||||
var cmp = tc.debugElement.componentViewChildren[0].inject(OnChangeComponent);
|
||||
var cmp = tc.debugElement.componentViewChildren[0]
|
||||
.inject(OnChangeComponent);
|
||||
expect(cmp.prop).toEqual('hello');
|
||||
expect(cmp.changes.containsKey('prop')).toEqual(true);
|
||||
async.done();
|
||||
|
@ -171,12 +172,14 @@ main() {
|
|||
directives: [ComponentWithObservableList]))
|
||||
.createAsync(Dummy)
|
||||
.then((tc) {
|
||||
tc.debugElement.componentInstance.value = new ObservableList.from([1, 2]);
|
||||
tc.debugElement.componentInstance.value =
|
||||
new ObservableList.from([1, 2]);
|
||||
|
||||
tc.detectChanges();
|
||||
|
||||
expect(log.result()).toEqual("check");
|
||||
expect(asNativeElements(tc.debugElement.componentViewChildren)).toHaveText('12');
|
||||
expect(asNativeElements(tc.debugElement.componentViewChildren))
|
||||
.toHaveText('12');
|
||||
|
||||
tc.detectChanges();
|
||||
|
||||
|
@ -195,7 +198,8 @@ main() {
|
|||
.toHaveText('123');
|
||||
|
||||
// we replaced the list => a check
|
||||
tc.debugElement.componentInstance.value = new ObservableList.from([5, 6, 7]);
|
||||
tc.debugElement.componentInstance.value =
|
||||
new ObservableList.from([5, 6, 7]);
|
||||
|
||||
tc.detectChanges();
|
||||
|
||||
|
@ -264,9 +268,7 @@ class NoPropertyAccess {
|
|||
final model = new PropModel();
|
||||
}
|
||||
|
||||
@Component(
|
||||
selector: 'on-change',
|
||||
inputs: const ['prop'])
|
||||
@Component(selector: 'on-change', inputs: const ['prop'])
|
||||
@View(template: '')
|
||||
class OnChangeComponent implements OnChanges {
|
||||
Map changes;
|
||||
|
@ -297,8 +299,7 @@ class ComponentWithObservableList {
|
|||
Iterable list;
|
||||
}
|
||||
|
||||
@Directive(
|
||||
selector: 'directive-logging-checks')
|
||||
@Directive(selector: 'directive-logging-checks')
|
||||
class DirectiveLoggingChecks implements DoCheck {
|
||||
Log log;
|
||||
|
||||
|
|
|
@ -31,4 +31,4 @@ PropDecorator propDecorator(value) {
|
|||
class HasGetterAndSetterDecorators {
|
||||
@PropDecorator("get") get a {}
|
||||
@PropDecorator("set") set a(v) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,8 @@ class SpyProtoViewFactory extends SpyObject implements ProtoViewFactory {
|
|||
}
|
||||
|
||||
@proxy
|
||||
class SpyProtoElementInjector extends SpyObject implements ProtoElementInjector {
|
||||
class SpyProtoElementInjector extends SpyObject
|
||||
implements ProtoElementInjector {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
|
@ -108,7 +109,8 @@ class SpyXHR extends SpyObject implements XHR {
|
|||
}
|
||||
|
||||
@proxy
|
||||
class SpyRenderEventDispatcher extends SpyObject implements RenderEventDispatcher {
|
||||
class SpyRenderEventDispatcher extends SpyObject
|
||||
implements RenderEventDispatcher {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ class LibraryInfo {
|
|||
}
|
||||
}
|
||||
|
||||
Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyType) {
|
||||
|
||||
Iterable<Symbol> _getUsedSymbols(
|
||||
DeclarationMirror decl, seenDecls, path, onlyType) {
|
||||
if (seenDecls.containsKey(decl.qualifiedName)) return [];
|
||||
seenDecls[decl.qualifiedName] = true;
|
||||
|
||||
|
@ -111,13 +111,11 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
|
|||
used.addAll(_getUsedSymbols(p.type, seenDecls, path, onlyType));
|
||||
});
|
||||
used.addAll(_getUsedSymbols(ftdecl.returnType, seenDecls, path, onlyType));
|
||||
}
|
||||
else if (decl is TypeMirror) {
|
||||
} else if (decl is TypeMirror) {
|
||||
var tdecl = decl;
|
||||
used.add(tdecl.qualifiedName);
|
||||
}
|
||||
|
||||
|
||||
if (!onlyType) {
|
||||
if (decl is ClassMirror) {
|
||||
ClassMirror cdecl = decl;
|
||||
|
@ -128,15 +126,13 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
|
|||
print("Got error [$e] when visiting $d\n$s");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (decl is MethodMirror) {
|
||||
MethodMirror mdecl = decl;
|
||||
if (mdecl.parameters != null)
|
||||
mdecl.parameters.forEach((p) {
|
||||
used.addAll(_getUsedSymbols(p.type, seenDecls, path, true));
|
||||
});
|
||||
if (mdecl.parameters != null) mdecl.parameters.forEach((p) {
|
||||
used.addAll(_getUsedSymbols(p.type, seenDecls, path, true));
|
||||
});
|
||||
used.addAll(_getUsedSymbols(mdecl.returnType, seenDecls, path, true));
|
||||
}
|
||||
|
||||
|
@ -209,6 +205,5 @@ LibraryInfo extractSymbols(LibraryMirror lib, [String printPrefix = ""]) {
|
|||
return new LibraryInfo(exportedSymbols, used);
|
||||
}
|
||||
|
||||
|
||||
var _SYMBOL_NAME = new RegExp('"(.*)"');
|
||||
unwrapSymbol(sym) => _SYMBOL_NAME.firstMatch(sym.toString()).group(1);
|
||||
|
|
|
@ -10,7 +10,7 @@ import "dart:convert";
|
|||
|
||||
main() {
|
||||
describe("bootstrapWebWorkerCommon", () {
|
||||
it ("should bootstrap on a Dart VM", () {
|
||||
it("should bootstrap on a Dart VM", () {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
var buses = createPairedMessageBuses();
|
||||
bootstrapWebWorkerCommon(App, buses.worker);
|
||||
|
|
|
@ -18,6 +18,7 @@ void expectSinkSendsEncodedJson(SpyObject socket, MessageBusSink sink,
|
|||
}
|
||||
|
||||
void expectMessageEquality(String message, Map expectedData, String channel) {
|
||||
expect(JSON.decode(message))
|
||||
.toEqual([{'channel': channel, 'message': expectedData}]);
|
||||
expect(JSON.decode(message)).toEqual([
|
||||
{'channel': channel, 'message': expectedData}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -79,8 +79,9 @@ main() {
|
|||
var random = new Random();
|
||||
for (var i = 0; i < numMessages; i++) {
|
||||
var message = {'value': random.nextInt(MAX)};
|
||||
messageHistory
|
||||
.add(JSON.encode([{'channel': CHANNEL, 'message': message}]));
|
||||
messageHistory.add(JSON.encode([
|
||||
{'channel': CHANNEL, 'message': message}
|
||||
]));
|
||||
}
|
||||
// copy the message history to ensure the test fails if the wrapper modifies the list
|
||||
return new List.from(messageHistory);
|
||||
|
@ -189,8 +190,7 @@ main() {
|
|||
messageHistory, resultMarkers, result.socket);
|
||||
socket.setPrimary(true);
|
||||
|
||||
var source =
|
||||
new MultiClientServerMessageBusSource();
|
||||
var source = new MultiClientServerMessageBusSource();
|
||||
source.onResult.listen((result) => async.done());
|
||||
source.initChannel(CHANNEL, false);
|
||||
source.addConnection(socket);
|
||||
|
|
|
@ -94,8 +94,9 @@ main() {
|
|||
async.done();
|
||||
});
|
||||
|
||||
controller
|
||||
.add(JSON.encode([{'channel': CHANNEL, 'message': MESSAGE}]));
|
||||
controller.add(JSON.encode([
|
||||
{'channel': CHANNEL, 'message': MESSAGE}
|
||||
]));
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -50,8 +50,9 @@ main() {
|
|||
});
|
||||
|
||||
var event = new SpyMessageEvent();
|
||||
event.spy("get:data").andCallFake(
|
||||
() => JSON.encode([{'channel': CHANNEL, 'message': MESSAGE}]));
|
||||
event.spy("get:data").andCallFake(() => JSON.encode([
|
||||
{'channel': CHANNEL, 'message': MESSAGE}
|
||||
]));
|
||||
controller.add(event);
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -10,7 +10,8 @@ class MockEventEmitter extends EventEmitter {
|
|||
@override
|
||||
StreamSubscription listen(void onData(dynamic line),
|
||||
{void onError(Error error), void onDone(), bool cancelOnError}) {
|
||||
return controller.stream.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||
return controller.stream.listen(onData,
|
||||
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -7,5 +7,3 @@ import 'package:angular2/testing_internal.dart';
|
|||
class SpyMessageBroker extends SpyObject implements ClientMessageBroker {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ class _DirectiveMetadataVisitor extends Object
|
|||
type: _type,
|
||||
isComponent: _isComponent,
|
||||
dynamicLoadable: true,
|
||||
// NOTE(kegluneq): For future optimization.
|
||||
// NOTE(kegluneq): For future optimization.
|
||||
selector: _selector,
|
||||
exportAs: _exportAs,
|
||||
changeDetection: _changeDetection,
|
||||
|
@ -190,7 +190,7 @@ class _DirectiveMetadataVisitor extends Object
|
|||
if (_hasMetadata) {
|
||||
throw new FormatException(
|
||||
'Only one Directive is allowed per class. '
|
||||
'Found unexpected "$node".',
|
||||
'Found unexpected "$node".',
|
||||
'$node' /* source */);
|
||||
}
|
||||
_isComponent = isComponent;
|
||||
|
@ -203,13 +203,14 @@ class _DirectiveMetadataVisitor extends Object
|
|||
}
|
||||
super.visitAnnotation(node);
|
||||
} else if (_annotationMatcher.isView(node, _assetId)) {
|
||||
if (_viewTemplate!= null) {
|
||||
if (_viewTemplate != null) {
|
||||
throw new FormatException(
|
||||
'Only one View is allowed per class. '
|
||||
'Found unexpected "$node".',
|
||||
'$node' /* source */);
|
||||
}
|
||||
_viewTemplate = new _CompileTemplateMetadataVisitor().visitAnnotation(node);
|
||||
_viewTemplate =
|
||||
new _CompileTemplateMetadataVisitor().visitAnnotation(node);
|
||||
}
|
||||
|
||||
// Annotation we do not recognize - no need to visit.
|
||||
|
|
|
@ -47,7 +47,8 @@ const _ON_AFTER_CONTENT_INIT_INTERFACES = const [
|
|||
'AfterContentInit', 'package:angular2/src/core/linker/interfaces.dart')
|
||||
];
|
||||
const _ON_AFTER_CONTENT_CHECKED_INTERFACES = const [
|
||||
const ClassDescriptor('AfterContentChecked', 'package:angular2/angular2.dart'),
|
||||
const ClassDescriptor(
|
||||
'AfterContentChecked', 'package:angular2/angular2.dart'),
|
||||
const ClassDescriptor(
|
||||
'AfterContentChecked', 'package:angular2/lifecycle_hooks.dart'),
|
||||
const ClassDescriptor(
|
||||
|
@ -112,12 +113,13 @@ class InterfaceMatcher extends ClassMatcherBase {
|
|||
firstMatch(typeName, assetId), _ON_AFTER_CONTENT_INIT_INTERFACES);
|
||||
|
||||
/// Checks if an [Identifier] implements [AfterContentChecked].
|
||||
bool isAfterContentChecked(Identifier typeName, AssetId assetId) => implements(
|
||||
firstMatch(typeName, assetId), _ON_AFTER_CONTENT_CHECKED_INTERFACES);
|
||||
bool isAfterContentChecked(Identifier typeName, AssetId assetId) =>
|
||||
implements(
|
||||
firstMatch(typeName, assetId), _ON_AFTER_CONTENT_CHECKED_INTERFACES);
|
||||
|
||||
/// Checks if an [Identifier] implements [AfterViewInit].
|
||||
bool isAfterViewInit(Identifier typeName, AssetId assetId) => implements(
|
||||
firstMatch(typeName, assetId), _ON_AFTER_VIEW_INIT_INTERFACES);
|
||||
bool isAfterViewInit(Identifier typeName, AssetId assetId) =>
|
||||
implements(firstMatch(typeName, assetId), _ON_AFTER_VIEW_INIT_INTERFACES);
|
||||
|
||||
/// Checks if an [Identifier] implements [AfterViewChecked].
|
||||
bool isAfterViewChecked(Identifier typeName, AssetId assetId) => implements(
|
||||
|
|
|
@ -40,8 +40,14 @@ class RegisteredType {
|
|||
factory RegisteredType.fromMethodInvocation(MethodInvocation registerMethod) {
|
||||
var visitor = new _ParseRegisterTypeVisitor();
|
||||
registerMethod.accept(visitor);
|
||||
return new RegisteredType._(visitor.typeName, registerMethod, visitor.info,
|
||||
visitor.factoryFn, visitor.parameters, visitor.annotations, visitor.propMetadata);
|
||||
return new RegisteredType._(
|
||||
visitor.typeName,
|
||||
registerMethod,
|
||||
visitor.info,
|
||||
visitor.factoryFn,
|
||||
visitor.parameters,
|
||||
visitor.annotations,
|
||||
visitor.propMetadata);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ Uri toAssetScheme(Uri absoluteUri) {
|
|||
if (absoluteUri == null) throw new ArgumentError.notNull('absoluteUri');
|
||||
|
||||
if (!absoluteUri.isAbsolute) {
|
||||
throw new ArgumentError.value(
|
||||
absoluteUri.toString(), 'absoluteUri', 'Value passed must be an absolute uri');
|
||||
throw new ArgumentError.value(absoluteUri.toString(), 'absoluteUri',
|
||||
'Value passed must be an absolute uri');
|
||||
}
|
||||
if (absoluteUri.scheme == 'asset') {
|
||||
if (absoluteUri.pathSegments.length < 3) {
|
||||
|
|
|
@ -10,8 +10,12 @@ void initReflector(reflector) {
|
|||
reflector
|
||||
..registerType(
|
||||
ToolTip,
|
||||
new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]')
|
||||
], const [], () => new ToolTip(), null, const {'queryField': const [const ContentChild('child')]}));
|
||||
new ReflectionInfo(
|
||||
const [const Directive(selector: '[tool-tip]')],
|
||||
const [],
|
||||
() => new ToolTip(),
|
||||
null,
|
||||
const {
|
||||
'queryField': const [const ContentChild('child')]
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -10,9 +10,13 @@ void initReflector(reflector) {
|
|||
reflector
|
||||
..registerType(
|
||||
ToolTip,
|
||||
new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]')
|
||||
], const [], () => new ToolTip(), null, const {'queryField': const [const ContentChild('child')]}))
|
||||
new ReflectionInfo(
|
||||
const [const Directive(selector: '[tool-tip]')],
|
||||
const [],
|
||||
() => new ToolTip(),
|
||||
null,
|
||||
const {
|
||||
'queryField': const [const ContentChild('child')]
|
||||
}))
|
||||
..registerSetters({'queryField': (o, v) => o.queryField = v});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue