style(dart): Run dartfmt v0.1.8+2 on all pure Dart code

Update formatting for all pure Dart code in the repo.
This commit is contained in:
Tim Blasi
2015-07-27 17:26:28 -07:00
parent 6fac901151
commit 2c9951273a
63 changed files with 406 additions and 273 deletions
@@ -18,8 +18,8 @@ main() {
});
it("should be true when the lifecycle includes onChange", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onChange])).callOnChange).toBe(true);
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onChange])).callOnChange).toBe(true);
});
it("should be false otherwise", () {
@@ -40,8 +40,8 @@ main() {
});
it("should be true when the lifecycle includes onDestroy", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onDestroy])).callOnDestroy).toBe(true);
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onDestroy])).callOnDestroy).toBe(true);
});
it("should be false otherwise", () {
@@ -58,8 +58,8 @@ main() {
});
it("should be true when the lifecycle includes onCheck", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onCheck])).callOnCheck).toBe(true);
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onCheck])).callOnCheck).toBe(true);
});
it("should be false otherwise", () {
@@ -77,7 +77,8 @@ main() {
it("should be true when the lifecycle includes onInit", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onInit])).callOnInit).toBe(true);
new Directive(lifecycle: [LifecycleEvent.onInit])).callOnInit)
.toBe(true);
});
it("should be false otherwise", () {
@@ -94,7 +95,9 @@ main() {
it("should be true when the lifecycle includes onAllChangesDone", () {
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onAllChangesDone])).callOnAllChangesDone).toBe(true);
lifecycle: [
LifecycleEvent.onAllChangesDone
])).callOnAllChangesDone).toBe(true);
});
it("should be false otherwise", () {
@@ -45,13 +45,15 @@ main() {
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb.overrideView(Dummy, new View(
template: '<type-literal-component></type-literal-component>',
directives: [TypeLiteralComponent]))
.createAsync(Dummy).then((tc) {
tb
.overrideView(Dummy, new View(
template: '<type-literal-component></type-literal-component>',
directives: [TypeLiteralComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.componentViewChildren)).toHaveText('[Hello, World]');
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('[Hello, World]');
async.done();
});
}));
@@ -62,11 +64,12 @@ main() {
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb.overrideView(Dummy, new View(
template: '<throwing-component></throwing-component>',
directives: [ThrowingComponent]))
.createAsync(Dummy).catchError((e, stack) {
tb
.overrideView(Dummy, new View(
template: '<throwing-component></throwing-component>',
directives: [ThrowingComponent]))
.createAsync(Dummy)
.catchError((e, stack) {
expect(e).toContainError("MockException");
expect(e).toContainError("functionThatThrows");
async.done();
@@ -77,11 +80,12 @@ main() {
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb.overrideView(Dummy, new View(
template: '<throwing-component2></throwing-component2>',
directives: [ThrowingComponent2]))
.createAsync(Dummy).catchError((e, stack) {
tb
.overrideView(Dummy, new View(
template: '<throwing-component2></throwing-component2>',
directives: [ThrowingComponent2]))
.createAsync(Dummy)
.catchError((e, stack) {
expect(e).toContainError("NonError");
expect(e).toContainError("functionThatThrows");
async.done();
@@ -94,13 +98,15 @@ main() {
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb.overrideView(Dummy, new View(
template: '<property-access></property-access>',
directives: [PropertyAccess]))
.createAsync(Dummy).then((tc) {
tb
.overrideView(Dummy, new View(
template: '<property-access></property-access>',
directives: [PropertyAccess]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.componentViewChildren)).toHaveText('prop:foo-prop;map:foo-map');
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('prop:foo-prop;map:foo-map');
async.done();
});
}));
@@ -109,11 +115,12 @@ main() {
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb.overrideView(Dummy, new View(
template: '<no-property-access></no-property-access>',
directives: [NoPropertyAccess]))
.createAsync(Dummy).then((tc) {
tb
.overrideView(Dummy, new View(
template: '<no-property-access></no-property-access>',
directives: [NoPropertyAccess]))
.createAsync(Dummy)
.then((tc) {
expect(() => tc.detectChanges())
.toThrowError(new RegExp('property not found'));
async.done();
@@ -126,11 +133,12 @@ main() {
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb.overrideView(Dummy, new View(
template: '''<on-change [prop]="'hello'"></on-change>''',
directives: [OnChangeComponent]))
.createAsync(Dummy).then((tc) {
tb
.overrideView(Dummy, new View(
template: '''<on-change [prop]="'hello'"></on-change>''',
directives: [OnChangeComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
var cmp = tc.componentViewChildren[0].inject(OnChangeComponent);
expect(cmp.prop).toEqual('hello');
@@ -141,13 +149,17 @@ main() {
});
describe("ObservableListDiff", () {
it('should be notified of changes', inject([TestComponentBuilder, Log], fakeAsync((TestComponentBuilder tcb, Log log) {
tcb.overrideView(Dummy, new View(
template: '''<component-with-observable-list [list]="value"></component-with-observable-list>''',
directives: [ComponentWithObservableList]))
.createAsync(Dummy).then((tc) {
tc.componentInstance.value = new ObservableList.from([1,2]);
it('should be notified of changes', inject([
TestComponentBuilder,
Log
], fakeAsync((TestComponentBuilder tcb, Log log) {
tcb
.overrideView(Dummy, new View(
template: '''<component-with-observable-list [list]="value"></component-with-observable-list>''',
directives: [ComponentWithObservableList]))
.createAsync(Dummy)
.then((tc) {
tc.componentInstance.value = new ObservableList.from([1, 2]);
tc.detectChanges();
@@ -170,7 +182,7 @@ main() {
expect(asNativeElements(tc.componentViewChildren)).toHaveText('123');
// we replaced the list => a check
tc.componentInstance.value = new ObservableList.from([5,6,7]);
tc.componentInstance.value = new ObservableList.from([5, 6, 7]);
tc.detectChanges();
@@ -257,22 +269,29 @@ class OnChangeComponent implements OnChange {
changeDetection: ON_PUSH,
properties: const ['list'],
hostInjector: const [
const Binding(Pipes, toValue: const Pipes (const {"iterableDiff": const [const ObservableListDiffFactory(), const IterableChangesFactory(), const NullPipeFactory()]}))
const Binding(Pipes,
toValue: const Pipes(const {
"iterableDiff": const [
const ObservableListDiffFactory(),
const IterableChangesFactory(),
const NullPipeFactory()
]
)
@View(template: '<span *ng-for="#item of list">{{item}}</span><directive-logging-checks></directive-logging-checks>', directives: const [NgFor, DirectiveLoggingChecks])
class ComponentWithObservableList {
}))
])
@View(
template: '<span *ng-for="#item of list">{{item}}</span><directive-logging-checks></directive-logging-checks>',
directives: const [NgFor, DirectiveLoggingChecks])
class ComponentWithObservableList {
Iterable list;
}
@Directive(
selector: 'directive-logging-checks',
lifecycle: const [LifecycleEvent.onCheck]
)
selector: 'directive-logging-checks',
lifecycle: const [LifecycleEvent.onCheck])
class DirectiveLoggingChecks implements OnCheck {
Log log;
DirectiveLoggingChecks(this.log);
onCheck() => log.add("check");
}
}
@@ -19,30 +19,32 @@ main() {
});
it("should be false otherwise", () {
expect(pipeFactory.supports([1,2,3])).toBe(false);
expect(pipeFactory.supports([1, 2, 3])).toBe(false);
});
});
it("should return the wrapped value to trigger change detection on first invocation of transform", () {
it("should return the wrapped value to trigger change detection on first invocation of transform",
() {
final pipe = pipeFactory.create(changeDetectorRef);
final c = new ObservableList.from([1,2]);
final c = new ObservableList.from([1, 2]);
expect(pipe.transform(c, []).wrapped).toBe(pipe);
});
it("should return itself when no changes between the calls", () {
final pipe = pipeFactory.create(changeDetectorRef);
final c = new ObservableList.from([1,2]);
final c = new ObservableList.from([1, 2]);
pipe.transform(c, []);
expect(pipe.transform(c, [])).toBe(pipe);
});
it("should return the wrapped value once a change has been trigger", fakeAsync(() {
it("should return the wrapped value once a change has been trigger",
fakeAsync(() {
final pipe = pipeFactory.create(changeDetectorRef);
final c = new ObservableList.from([1,2]);
final c = new ObservableList.from([1, 2]);
pipe.transform(c, []);
@@ -56,10 +58,11 @@ main() {
expect(pipe.transform(c, []).wrapped).toBe(pipe);
}));
it("should request a change detection check upon receiving a change", fakeAsync(() {
it("should request a change detection check upon receiving a change",
fakeAsync(() {
final pipe = pipeFactory.create(changeDetectorRef);
final c = new ObservableList.from([1,2]);
final c = new ObservableList.from([1, 2]);
pipe.transform(c, []);
c.add(3);
@@ -71,20 +74,21 @@ main() {
it("should return the wrapped value after changing a collection", () {
final pipe = pipeFactory.create(changeDetectorRef);
final c1 = new ObservableList.from([1,2]);
final c2 = new ObservableList.from([3,4]);
final c1 = new ObservableList.from([1, 2]);
final c2 = new ObservableList.from([3, 4]);
expect(pipe.transform(c1, []).wrapped).toBe(pipe);
expect(pipe.transform(c2, []).wrapped).toBe(pipe);
});
it("should not unbsubscribe from the stream of chagnes after changing a collection", () {
it("should not unbsubscribe from the stream of chagnes after changing a collection",
() {
final pipe = pipeFactory.create(changeDetectorRef);
final c1 = new ObservableList.from([1,2]);
final c1 = new ObservableList.from([1, 2]);
expect(pipe.transform(c1, []).wrapped).toBe(pipe);
final c2 = new ObservableList.from([3,4]);
final c2 = new ObservableList.from([3, 4]);
expect(pipe.transform(c2, []).wrapped).toBe(pipe);
// pushing into the first collection has no effect, and we do not see the change
@@ -92,4 +96,4 @@ main() {
expect(pipe.transform(c2, [])).toBe(pipe);
});
});
}
}
@@ -6,4 +6,4 @@ library angular2.test.router.route_config_spec;
* The rest of the router tests have typed annotations, so there's no need to add
* additional tests here for Dart.
*/
main () {}
main() {}
@@ -30,7 +30,6 @@ void initReflector() {
], const [], () => new MixedSoupComponent(), const [OnChange]))
..registerType(MatchedSoupComponent, new _ngRef.ReflectionInfo(const [
const Component(
selector: '[soup]',
lifecycle: const [LifecycleEvent.onChange])
selector: '[soup]', lifecycle: const [LifecycleEvent.onChange])
], const [], () => new MatchedSoupComponent(), const [OnChange]));
}
@@ -91,7 +91,9 @@ class _MyComponent_ChangeDetector0 extends _gen.AbstractChangeDetector {
_alreadyChecked = true;
}
void checkNoChanges() {this.runDetectChanges(true);}
void checkNoChanges() {
this.runDetectChanges(true);
}
void callOnAllChangesDone() {
dispatcher.notifyOnAllChangesDone();