From ffb219fb913137eaff51c295597d21f0c9470a8e Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Fri, 29 May 2015 10:42:47 -0700 Subject: [PATCH] style(dart): Format Dart source with dart_style 0.1.8 --- modules/angular2/angular2_sfx.dart | 3 +- .../directive_lifecycle_reflector.dart | 6 +- modules/angular2/src/core/zone/ng_zone.dart | 37 +++--- modules/angular2/src/dom/browser_adapter.dart | 2 +- modules/angular2/src/dom/html_adapter.dart | 2 +- modules/angular2/src/facade/async.dart | 17 +-- .../reflection/reflection_capabilities.dart | 4 +- modules/angular2/src/services/xhr_impl.dart | 7 +- modules/angular2/src/test_lib/e2e_util.dart | 3 +- modules/angular2/src/test_lib/fake_async.dart | 25 ++-- modules/angular2/src/test_lib/perf_utils.dart | 3 +- .../common/directive_metadata_reader.dart | 1 - .../compiler/directive_lifecycle_spec.dart | 73 +++++++---- .../core/compiler/integration_dart_spec.dart | 120 +++++++++--------- .../angular2/test/di/injector_dart_spec.dart | 6 +- .../angular2/test/facade/async_dart_spec.dart | 50 ++++---- .../test/reflection/reflector_common.dart | 2 +- 17 files changed, 190 insertions(+), 171 deletions(-) diff --git a/modules/angular2/angular2_sfx.dart b/modules/angular2/angular2_sfx.dart index 37273e309d..529af8346b 100644 --- a/modules/angular2/angular2_sfx.dart +++ b/modules/angular2/angular2_sfx.dart @@ -1,2 +1,3 @@ library angular2.sfx; -// empty as we don't have a version for Dart \ No newline at end of file + +// empty as we don't have a version for Dart diff --git a/modules/angular2/src/core/compiler/directive_lifecycle_reflector.dart b/modules/angular2/src/core/compiler/directive_lifecycle_reflector.dart index cae92deeb0..c035e996d5 100644 --- a/modules/angular2/src/core/compiler/directive_lifecycle_reflector.dart +++ b/modules/angular2/src/core/compiler/directive_lifecycle_reflector.dart @@ -13,20 +13,16 @@ bool hasLifecycleHook(LifecycleEvent e, type, Directive annotation) { if (e == onChange) { interface = OnChange; - } else if (e == onDestroy) { interface = OnDestroy; - } else if (e == onAllChangesDone) { interface = OnAllChangesDone; - } else if (e == onCheck) { interface = OnCheck; - } else if (e == onInit) { interface = OnInit; } return interfaces.contains(interface); } -} \ No newline at end of file +} diff --git a/modules/angular2/src/core/zone/ng_zone.dart b/modules/angular2/src/core/zone/ng_zone.dart index b1b8eb4500..6415068fc9 100644 --- a/modules/angular2/src/core/zone/ng_zone.dart +++ b/modules/angular2/src/core/zone/ng_zone.dart @@ -52,15 +52,13 @@ class NgZone { _mountZone = Zone.current; if (enableLongStackTrace) { - _innerZone = Chain.capture( - () => _createInnerZone(Zone.current), + _innerZone = Chain.capture(() => _createInnerZone(Zone.current), onError: _onErrorWithLongStackTrace); } else { - _innerZone = _createInnerZone( - Zone.current, - handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone, error, StackTrace trace) => - _onErrorWithoutLongStackTrace(error, trace) - ); + _innerZone = _createInnerZone(Zone.current, + handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone, + error, + StackTrace trace) => _onErrorWithoutLongStackTrace(error, trace)); } } @@ -75,7 +73,8 @@ class NgZone { * @param {Function} onTurnDone called at the end of a VM turn if code has executed in the inner zone * @param {Function} onErrorHandler called when an exception is thrown by a macro or micro task */ - void initCallbacks({Function onTurnStart, Function onTurnDone, Function onErrorHandler}) { + void initCallbacks( + {Function onTurnStart, Function onTurnDone, Function onErrorHandler}) { _onTurnStart = onTurnStart; _onTurnDone = onTurnDone; _onErrorHandler = onErrorHandler; @@ -158,10 +157,10 @@ class NgZone { } dynamic _runUnary(Zone self, ZoneDelegate parent, Zone zone, fn(arg), arg) => - _run(self, parent, zone, () => fn(arg)); + _run(self, parent, zone, () => fn(arg)); - dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2), arg1, arg2) => - _run(self, parent, zone, () => fn(arg1, arg2)); + dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2), + arg1, arg2) => _run(self, parent, zone, () => fn(arg1, arg2)); void _scheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, fn) { _pendingMicrotasks++; @@ -196,14 +195,12 @@ class NgZone { Zone _createInnerZone(Zone zone, {handleUncaughtError}) { return zone.fork( - specification: new ZoneSpecification( - scheduleMicrotask: _scheduleMicrotask, - run: _run, - runUnary: _runUnary, - runBinary: _runBinary, - handleUncaughtError: handleUncaughtError - ), - zoneValues: {'_innerZone': true} - ); + specification: new ZoneSpecification( + scheduleMicrotask: _scheduleMicrotask, + run: _run, + runUnary: _runUnary, + runBinary: _runBinary, + handleUncaughtError: handleUncaughtError), + zoneValues: {'_innerZone': true}); } } diff --git a/modules/angular2/src/dom/browser_adapter.dart b/modules/angular2/src/dom/browser_adapter.dart index 8084d9b98c..1850184c05 100644 --- a/modules/angular2/src/dom/browser_adapter.dart +++ b/modules/angular2/src/dom/browser_adapter.dart @@ -135,7 +135,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { MouseEvent createMouseEvent(String eventType) => new MouseEvent(eventType, canBubble: true); Event createEvent(String eventType) => new Event(eventType, canBubble: true); - void preventDefault(Event evt) { + void preventDefault(Event evt) { evt.preventDefault(); } String getInnerHTML(Element el) => el.innerHtml; diff --git a/modules/angular2/src/dom/html_adapter.dart b/modules/angular2/src/dom/html_adapter.dart index 4ff959868c..b41ddebb0a 100644 --- a/modules/angular2/src/dom/html_adapter.dart +++ b/modules/angular2/src/dom/html_adapter.dart @@ -76,7 +76,7 @@ class Html5LibDomAdapter implements DomAdapter { createEvent(eventType) { throw 'not implemented'; } - preventDefault(evt) { + preventDefault(evt) { throw 'not implemented'; } getInnerHTML(el) { diff --git a/modules/angular2/src/facade/async.dart b/modules/angular2/src/facade/async.dart index 7ebd7b4f66..38fd1babe6 100644 --- a/modules/angular2/src/facade/async.dart +++ b/modules/angular2/src/facade/async.dart @@ -6,13 +6,8 @@ export 'dart:async' show Future, Stream, StreamController, StreamSubscription; class PromiseWrapper { static Future resolve(obj) => new Future.value(obj); - static Future reject(obj, stackTrace) => new Future.error( - obj, - stackTrace != null - ? stackTrace - : obj is Error - ? obj.stackTrace - : null); + static Future reject(obj, stackTrace) => new Future.error(obj, + stackTrace != null ? stackTrace : obj is Error ? obj.stackTrace : null); static Future all(List promises) => Future.wait(promises); @@ -35,15 +30,17 @@ class PromiseWrapper { } class TimerWrapper { - static Timer setTimeout(fn(), int millis) - => new Timer(new Duration(milliseconds: millis), fn); + static Timer setTimeout(fn(), int millis) => + new Timer(new Duration(milliseconds: millis), fn); static void clearTimeout(Timer timer) { timer.cancel(); } static Timer setInterval(fn(), int millis) { var interval = new Duration(milliseconds: millis); - return new Timer.periodic(interval, (Timer timer) { fn(); }); + return new Timer.periodic(interval, (Timer timer) { + fn(); + }); } static void clearInterval(Timer timer) { timer.cancel(); diff --git a/modules/angular2/src/reflection/reflection_capabilities.dart b/modules/angular2/src/reflection/reflection_capabilities.dart index 0edb79c017..f4205b7a7d 100644 --- a/modules/angular2/src/reflection/reflection_capabilities.dart +++ b/modules/angular2/src/reflection/reflection_capabilities.dart @@ -57,7 +57,9 @@ class ReflectionCapabilities { List _convertParameter(ParameterMirror p) { var t = p.type; - var res = (!t.hasReflectedType || t.reflectedType == dynamic) ? [] : [t.reflectedType]; + var res = (!t.hasReflectedType || t.reflectedType == dynamic) + ? [] + : [t.reflectedType]; res.addAll(p.metadata.map((m) => m.reflectee)); return res; } diff --git a/modules/angular2/src/services/xhr_impl.dart b/modules/angular2/src/services/xhr_impl.dart index 91ce87dea6..bf22d64345 100644 --- a/modules/angular2/src/services/xhr_impl.dart +++ b/modules/angular2/src/services/xhr_impl.dart @@ -8,10 +8,7 @@ import './xhr.dart' show XHR; @Injectable() class XHRImpl extends XHR { Future get(String url) { - - return HttpRequest - .request(url) - .then((HttpRequest req) => req.responseText, - onError: (_) => new Future.error('Failed to load $url')); + return HttpRequest.request(url).then((HttpRequest req) => req.responseText, + onError: (_) => new Future.error('Failed to load $url')); } } diff --git a/modules/angular2/src/test_lib/e2e_util.dart b/modules/angular2/src/test_lib/e2e_util.dart index fddb844706..7e5c3da282 100644 --- a/modules/angular2/src/test_lib/e2e_util.dart +++ b/modules/angular2/src/test_lib/e2e_util.dart @@ -1,2 +1,3 @@ library angular2.e2e_util; -// empty as this file is node.js specific and should not be transpiled to dart \ No newline at end of file + +// empty as this file is node.js specific and should not be transpiled to dart diff --git a/modules/angular2/src/test_lib/fake_async.dart b/modules/angular2/src/test_lib/fake_async.dart index b197e39ee3..9e8884c879 100644 --- a/modules/angular2/src/test_lib/fake_async.dart +++ b/modules/angular2/src/test_lib/fake_async.dart @@ -24,24 +24,33 @@ Function fakeAsync(Function fn) { } return ([a0 = _u, a1 = _u, a2 = _u, a3 = _u, a4 = _u, a5 = _u, a6 = _u, - a7 = _u, a8 = _u, a9 = _u]) { + a7 = _u, a8 = _u, a9 = _u]) { // runZoned() to install a custom exception handler that re-throws return runZoned(() { new quiver.FakeAsync().run((quiver.FakeAsync async) { try { _fakeAsync = async; - List args = [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9] - .takeWhile((a) => a != _u).toList(); - return Function.apply(fn , args); + List args = [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9 + ].takeWhile((a) => a != _u).toList(); + return Function.apply(fn, args); } finally { _fakeAsync = null; } }); }, - zoneSpecification: new ZoneSpecification( - handleUncaughtError: (self, parent, zone, error, stackTrace) - => throw error - )); + zoneSpecification: new ZoneSpecification( + handleUncaughtError: (self, parent, zone, error, stackTrace) => + throw error)); }; } diff --git a/modules/angular2/src/test_lib/perf_utils.dart b/modules/angular2/src/test_lib/perf_utils.dart index 6a3eb75233..48627b21ab 100644 --- a/modules/angular2/src/test_lib/perf_utils.dart +++ b/modules/angular2/src/test_lib/perf_utils.dart @@ -1,2 +1,3 @@ library angular2.perf_util; -// empty as this file is node.js specific and should not be transpiled to dart \ No newline at end of file + +// empty as this file is node.js specific and should not be transpiled to dart diff --git a/modules/angular2/src/transform/common/directive_metadata_reader.dart b/modules/angular2/src/transform/common/directive_metadata_reader.dart index 5ef485933e..6adcac4902 100644 --- a/modules/angular2/src/transform/common/directive_metadata_reader.dart +++ b/modules/angular2/src/transform/common/directive_metadata_reader.dart @@ -190,7 +190,6 @@ class _DirectiveMetadataVisitor extends Object '$propertyName.', '$expression' /* source */); } list.addAll(evaluated); - } void _populateProperties(Expression propertiesValue) { diff --git a/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart b/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart index bff7a9e23b..29219250f7 100644 --- a/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart +++ b/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart @@ -4,108 +4,127 @@ import 'package:angular2/test_lib.dart'; import 'package:angular2/angular2.dart'; import 'package:angular2/src/core/compiler/element_injector.dart'; - main() { describe('Create DirectiveMetadata', () { describe('lifecycle', () { - metadata(type, annotation) => DirectiveBinding.createFromType(type, annotation).metadata; - + metadata(type, annotation) => + DirectiveBinding.createFromType(type, annotation).metadata; + describe("onChange", () { it("should be true when the directive implements OnChange", () { - expect(metadata(DirectiveImplementingOnChange, new Directive()).callOnChange).toBe(true); + expect(metadata( + DirectiveImplementingOnChange, new Directive()).callOnChange) + .toBe(true); }); it("should be true when the lifecycle includes onChange", () { - expect(metadata(DirectiveNoHooks, new Directive(lifecycle: [onChange])).callOnChange).toBe(true); + expect(metadata(DirectiveNoHooks, + new Directive(lifecycle: [onChange])).callOnChange).toBe(true); }); it("should be false otherwise", () { - expect(metadata(DirectiveNoHooks, new Directive()).callOnChange).toBe(false); + expect(metadata(DirectiveNoHooks, new Directive()).callOnChange) + .toBe(false); }); it("should be false when empty lifecycle", () { - expect(metadata(DirectiveImplementingOnChange, new Directive(lifecycle: [])).callOnChange).toBe(false); + expect(metadata(DirectiveImplementingOnChange, + new Directive(lifecycle: [])).callOnChange).toBe(false); }); }); describe("onDestroy", () { it("should be true when the directive implements OnDestroy", () { - expect(metadata(DirectiveImplementingOnDestroy, new Directive()).callOnDestroy).toBe(true); + expect(metadata(DirectiveImplementingOnDestroy, + new Directive()).callOnDestroy).toBe(true); }); it("should be true when the lifecycle includes onDestroy", () { - expect(metadata(DirectiveNoHooks, new Directive(lifecycle: [onDestroy])).callOnDestroy).toBe(true); + expect(metadata(DirectiveNoHooks, + new Directive(lifecycle: [onDestroy])).callOnDestroy).toBe(true); }); it("should be false otherwise", () { - expect(metadata(DirectiveNoHooks, new Directive()).callOnDestroy).toBe(false); + expect(metadata(DirectiveNoHooks, new Directive()).callOnDestroy) + .toBe(false); }); }); describe("onCheck", () { it("should be true when the directive implements OnCheck", () { - expect(metadata(DirectiveImplementingOnCheck, new Directive()).callOnCheck).toBe(true); + expect(metadata( + DirectiveImplementingOnCheck, new Directive()).callOnCheck) + .toBe(true); }); it("should be true when the lifecycle includes onCheck", () { - expect(metadata(DirectiveNoHooks, new Directive(lifecycle: [onCheck])).callOnCheck).toBe(true); + expect(metadata(DirectiveNoHooks, + new Directive(lifecycle: [onCheck])).callOnCheck).toBe(true); }); it("should be false otherwise", () { - expect(metadata(DirectiveNoHooks, new Directive()).callOnCheck).toBe(false); + expect(metadata(DirectiveNoHooks, new Directive()).callOnCheck) + .toBe(false); }); }); describe("onInit", () { it("should be true when the directive implements OnInit", () { - expect(metadata(DirectiveImplementingOnInit, new Directive()).callOnInit).toBe(true); + expect(metadata( + DirectiveImplementingOnInit, new Directive()).callOnInit) + .toBe(true); }); it("should be true when the lifecycle includes onInit", () { - expect(metadata(DirectiveNoHooks, new Directive(lifecycle: [onInit])).callOnInit).toBe(true); + expect(metadata(DirectiveNoHooks, + new Directive(lifecycle: [onInit])).callOnInit).toBe(true); }); it("should be false otherwise", () { - expect(metadata(DirectiveNoHooks, new Directive()).callOnInit).toBe(false); + expect(metadata(DirectiveNoHooks, new Directive()).callOnInit) + .toBe(false); }); }); describe("onAllChangesDone", () { it("should be true when the directive implements OnAllChangesDone", () { - expect(metadata(DirectiveImplementingOnAllChangesDone, new Directive()).callOnAllChangesDone).toBe(true); + expect(metadata(DirectiveImplementingOnAllChangesDone, + new Directive()).callOnAllChangesDone).toBe(true); }); it("should be true when the lifecycle includes onAllChangesDone", () { - expect(metadata(DirectiveNoHooks, new Directive(lifecycle: [onAllChangesDone])).callOnAllChangesDone).toBe(true); + expect(metadata(DirectiveNoHooks, new Directive( + lifecycle: [onAllChangesDone])).callOnAllChangesDone).toBe(true); }); it("should be false otherwise", () { - expect(metadata(DirectiveNoHooks, new Directive()).callOnAllChangesDone).toBe(false); + expect(metadata( + DirectiveNoHooks, new Directive()).callOnAllChangesDone) + .toBe(false); }); }); }); }); } -class DirectiveNoHooks { -} +class DirectiveNoHooks {} class DirectiveImplementingOnChange implements OnChange { - onChange(_){} + onChange(_) {} } class DirectiveImplementingOnCheck implements OnCheck { - onCheck(){} + onCheck() {} } class DirectiveImplementingOnInit implements OnInit { - onInit(){} + onInit() {} } class DirectiveImplementingOnDestroy implements OnDestroy { - onDestroy(){} + onDestroy() {} } class DirectiveImplementingOnAllChangesDone implements OnAllChangesDone { - onAllChangesDone(){} -} \ No newline at end of file + onAllChangesDone() {} +} diff --git a/modules/angular2/test/core/compiler/integration_dart_spec.dart b/modules/angular2/test/core/compiler/integration_dart_spec.dart index 63555cb211..cf2450934a 100644 --- a/modules/angular2/test/core/compiler/integration_dart_spec.dart +++ b/modules/angular2/test/core/compiler/integration_dart_spec.dart @@ -6,12 +6,18 @@ import 'package:angular2/di.dart'; import 'package:angular2/src/test_lib/test_bed.dart'; import 'package:angular2/test_lib.dart'; -class MockException implements Error { var message; var stackTrace; } -class NonError { var message; } +class MockException implements Error { + var message; + var stackTrace; +} +class NonError { + var message; +} void functionThatThrows() { - try { throw new MockException(); } - catch(e, stack) { + try { + throw new MockException(); + } catch (e, stack) { // If we lose the stack trace the message will no longer match // the first line in the stack e.message = stack.toString().split('\n')[0]; @@ -21,8 +27,9 @@ void functionThatThrows() { } void functionThatThrowsNonError() { - try { throw new NonError(); } - catch(e, stack) { + try { + throw new NonError(); + } catch (e, stack) { // If we lose the stack trace the message will no longer match // the first line in the stack e.message = stack.toString().split('\n')[0]; @@ -32,12 +39,13 @@ void functionThatThrowsNonError() { main() { describe('TypeLiteral', () { - it('should publish via appInjector', - inject([TestBed, AsyncTestCompleter], (tb, async) { + it('should publish via appInjector', inject([ + TestBed, + AsyncTestCompleter + ], (tb, async) { tb.overrideView(Dummy, new View( - template: '', - directives: [TypeLiteralComponent] - )); + template: '', + directives: [TypeLiteralComponent])); tb.createView(Dummy).then((view) { view.detectChanges(); @@ -48,12 +56,13 @@ main() { }); describe('Error handling', () { - it('should preserve Error stack traces thrown from components', - inject([TestBed, AsyncTestCompleter], (tb, async) { + it('should preserve Error stack traces thrown from components', inject([ + TestBed, + AsyncTestCompleter + ], (tb, async) { tb.overrideView(Dummy, new View( - template: '', - directives: [ThrowingComponent] - )); + template: '', + directives: [ThrowingComponent])); tb.createView(Dummy).catchError((e, stack) { expect(stack.toString().split('\n')[0]).toEqual(e.message); @@ -61,12 +70,13 @@ main() { }); })); - it('should preserve non-Error stack traces thrown from components', - inject([TestBed, AsyncTestCompleter], (tb, async) { + it('should preserve non-Error stack traces thrown from components', inject([ + TestBed, + AsyncTestCompleter + ], (tb, async) { tb.overrideView(Dummy, new View( - template: '', - directives: [ThrowingComponent2] - )); + template: '', + directives: [ThrowingComponent2])); tb.createView(Dummy).catchError((e, stack) { expect(stack.toString().split('\n')[0]).toEqual(e.message); @@ -76,12 +86,13 @@ main() { }); describe('Property access', () { - it('should distinguish between map and property access', - inject([TestBed, AsyncTestCompleter], (tb, async) { + it('should distinguish between map and property access', inject([ + TestBed, + AsyncTestCompleter + ], (tb, async) { tb.overrideView(Dummy, new View( - template: '', - directives: [PropertyAccess] - )); + template: '', + directives: [PropertyAccess])); tb.createView(Dummy).then((view) { view.detectChanges(); @@ -90,12 +101,13 @@ main() { }); })); - it('should not fallback on map access if property missing', - inject([TestBed, AsyncTestCompleter], (tb, async) { + it('should not fallback on map access if property missing', inject([ + TestBed, + AsyncTestCompleter + ], (tb, async) { tb.overrideView(Dummy, new View( - template: '', - directives: [NoPropertyAccess] - )); + template: '', + directives: [NoPropertyAccess])); tb.createView(Dummy).then((view) { expect(() => view.detectChanges()) @@ -106,12 +118,13 @@ main() { }); describe('OnChange', () { - it('should be notified of changes', - inject([TestBed, AsyncTestCompleter], (tb, async) { + it('should be notified of changes', inject([ + TestBed, + AsyncTestCompleter + ], (tb, async) { tb.overrideView(Dummy, new View( - template: '''''', - directives: [OnChangeComponent] - )); + template: '''''', + directives: [OnChangeComponent])); tb.createView(Dummy).then((view) { view.detectChanges(); @@ -128,25 +141,19 @@ main() { class Dummy {} @Component( - selector: 'type-literal-component', - appInjector: const [ - const Binding( - const TypeLiteral>(), - toValue: const ['Hello', 'World']) - ] -) -@View( - template: '{{list}}' -) + selector: 'type-literal-component', + appInjector: const [ + const Binding(const TypeLiteral>(), + toValue: const ['Hello', 'World']) +]) +@View(template: '{{list}}') class TypeLiteralComponent { final List list; TypeLiteralComponent(this.list); } -@Component( - selector: 'throwing-component' -) +@Component(selector: 'throwing-component') @View(template: '') class ThrowingComponent { ThrowingComponent() { @@ -154,9 +161,7 @@ class ThrowingComponent { } } -@Component( - selector: 'throwing-component2' -) +@Component(selector: 'throwing-component2') @View(template: '') class ThrowingComponent2 { ThrowingComponent2() { @@ -168,7 +173,7 @@ class ThrowingComponent2 { class PropModel implements Map { final String foo = 'foo-prop'; - operator[](_) => 'foo-map'; + operator [](_) => 'foo-map'; noSuchMethod(_) { throw 'property not found'; @@ -187,12 +192,9 @@ class NoPropertyAccess { final model = new PropModel(); } -@Component( - selector: 'on-change', - // TODO: needed because of https://github.com/angular/angular/issues/2120 - lifecycle: const [onChange], - properties: const ['prop'] -) +@Component(selector: 'on-change', + // TODO: needed because of https://github.com/angular/angular/issues/2120 + lifecycle: const [onChange], properties: const ['prop']) @View(template: '') class OnChangeComponent implements OnChange { Map changes; diff --git a/modules/angular2/test/di/injector_dart_spec.dart b/modules/angular2/test/di/injector_dart_spec.dart index ff6a756106..e90c6299c7 100644 --- a/modules/angular2/test/di/injector_dart_spec.dart +++ b/modules/angular2/test/di/injector_dart_spec.dart @@ -7,10 +7,8 @@ import 'package:angular2/di.dart'; main() { describe('Injector', () { it('should support TypeLiteral', () { - var i = Injector.resolveAndCreate([ - bind(new TypeLiteral>()).toValue([1, 2, 3]), - Foo, - ]); + var i = Injector.resolveAndCreate( + [bind(new TypeLiteral>()).toValue([1, 2, 3]), Foo,]); expect(i.get(Foo).value).toEqual([1, 2, 3]); }); }); diff --git a/modules/angular2/test/facade/async_dart_spec.dart b/modules/angular2/test/facade/async_dart_spec.dart index 2404735ff2..aa6541ff22 100644 --- a/modules/angular2/test/facade/async_dart_spec.dart +++ b/modules/angular2/test/facade/async_dart_spec.dart @@ -4,12 +4,18 @@ library angular2.test.facade.async_dart_spec; import 'package:angular2/test_lib.dart'; import 'package:angular2/src/facade/async.dart'; -class MockException implements Error { var message; var stackTrace; } -class NonError { var message; } +class MockException implements Error { + var message; + var stackTrace; +} +class NonError { + var message; +} void functionThatThrows() { - try { throw new MockException(); } - catch(e, stack) { + try { + throw new MockException(); + } catch (e, stack) { // If we lose the stack trace the message will no longer match // the first line in the stack e.message = stack.toString().split('\n')[0]; @@ -19,8 +25,9 @@ void functionThatThrows() { } void functionThatThrowsNonError() { - try { throw new NonError(); } - catch(e, stack) { + try { + throw new NonError(); + } catch (e, stack) { // If we lose the stack trace the message will no longer match // the first line in the stack e.message = stack.toString().split('\n')[0]; @@ -39,62 +46,55 @@ void expectFunctionThatThrowsWithStackTrace( main() { describe('async facade', () { describe('Completer', () { - - it('should preserve Error stack traces', - inject([AsyncTestCompleter], (async) { + it('should preserve Error stack traces', inject([AsyncTestCompleter], + (async) { var c = PromiseWrapper.completer(); expectFunctionThatThrowsWithStackTrace(c.promise, async); try { functionThatThrows(); - } catch(e) { + } catch (e) { c.reject(e, null); } })); - it('should preserve error stack traces for non-Errors', - inject([AsyncTestCompleter], (async) { + it('should preserve error stack traces for non-Errors', inject( + [AsyncTestCompleter], (async) { var c = PromiseWrapper.completer(); expectFunctionThatThrowsWithStackTrace(c.promise, async); try { functionThatThrowsNonError(); - } catch(e, s) { + } catch (e, s) { c.reject(e, s); } })); - }); describe('PromiseWrapper', () { - describe('reject', () { - - it('should preserve Error stack traces', - inject([AsyncTestCompleter], (async) { + it('should preserve Error stack traces', inject([AsyncTestCompleter], + (async) { try { functionThatThrows(); - } catch(e) { + } catch (e) { var rejectedFuture = PromiseWrapper.reject(e, null); expectFunctionThatThrowsWithStackTrace(rejectedFuture, async); } })); - it('should preserve stack traces for non-Errors', - inject([AsyncTestCompleter], (async) { + it('should preserve stack traces for non-Errors', inject( + [AsyncTestCompleter], (async) { try { functionThatThrowsNonError(); - } catch(e, s) { + } catch (e, s) { var rejectedFuture = PromiseWrapper.reject(e, s); expectFunctionThatThrowsWithStackTrace(rejectedFuture, async); } })); - }); - }); - }); } diff --git a/modules/angular2/test/reflection/reflector_common.dart b/modules/angular2/test/reflection/reflector_common.dart index f077374c61..8fe8321d5f 100644 --- a/modules/angular2/test/reflection/reflector_common.dart +++ b/modules/angular2/test/reflection/reflector_common.dart @@ -16,4 +16,4 @@ ClassDecorator classDecorator(value) { ParamDecorator paramDecorator(value) { return new ParamDecorator(value); -} \ No newline at end of file +}