refactor(dart): Format Dart code
Use the dart formatter to clean up all pure Dart code. Closes #4832
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user