From a6e712399503bc0b4ddd9e55f99ba751934240de Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Fri, 12 Jun 2015 07:50:45 -0700 Subject: [PATCH] feat: adjust formatting for clang-format v1.0.19. --- .../orderingOfMembers.ts | 12 +- docs/dgeni-package/mocks/testSrc.ts | 10 +- .../angular2/src/change_detection/coalesce.ts | 6 +- .../src/change_detection/proto_record.ts | 16 +- modules/angular2/src/core/application.ts | 2 +- .../src/core/compiler/proto_view_factory.ts | 24 ++- modules/angular2/src/core/zone/ng_zone.ts | 4 +- modules/angular2/src/facade/lang.ts | 2 +- modules/angular2/src/http/enums.ts | 12 +- .../src/render/dom/view/proto_view.ts | 2 +- .../angular2/src/test_lib/test_injector.ts | 2 +- modules/angular2/src/test_lib/test_lib.ts | 3 +- modules/angular2/src/test_lib/utils.ts | 3 +- .../change_detector_config.ts | 9 +- .../change_detection/change_detector_spec.ts | 27 +-- .../change_detection/parser/parser_spec.ts | 8 +- .../change_detection/pipes/json_pipe_spec.ts | 4 +- .../test/core/compiler/compiler_spec.ts | 5 +- .../test/core/compiler/integration_spec.ts | 3 +- .../core/compiler/query_integration_spec.ts | 54 +++--- .../test/core/life_cycle/life_cycle_spec.ts | 2 +- .../angular2/test/core/zone/ng_zone_spec.ts | 12 +- .../angular2/test/directives/class_spec.ts | 5 +- modules/angular2/test/http/http_spec.ts | 5 +- .../test/reflection/reflector_spec.ts | 81 +++++---- .../dom/compiler/directive_parser_spec.ts | 8 +- .../test/render/dom/compiler/pipeline_spec.ts | 3 +- .../angular2/test/render/dom/convert_spec.ts | 12 +- .../dom/dom_renderer_integration_spec.ts | 5 +- ...mulated_scoped_shadow_dom_strategy_spec.ts | 24 +-- .../shadow_dom_emulation_integration_spec.ts | 20 +-- .../dom/view/property_setter_factory_spec.ts | 51 +++--- .../test/render/dom/view/view_spec.ts | 15 +- .../test/router/route_registry_spec.ts | 166 ++++++++++-------- .../src/largetable/largetable_benchmark.ts | 7 +- .../benchpress/src/metric/perflog_metric.ts | 2 +- .../src/reporter/console_reporter.ts | 2 +- .../src/reporter/json_file_reporter.ts | 2 +- modules/benchpress/src/sample_description.ts | 14 +- .../test/metric/multi_metric_spec.ts | 4 +- .../test/reporter/console_reporter_spec.ts | 5 +- .../test/reporter/json_file_reporter_spec.ts | 5 +- modules/rtts_assert/src/rtts_assert.ts | 3 +- tools/broccoli/broccoli-flatten.spec.ts | 15 +- tools/broccoli/broccoli-lodash.ts | 6 +- tools/broccoli/broccoli-merge-trees.spec.ts | 8 +- tools/broccoli/broccoli-typescript.ts | 4 +- tools/broccoli/diffing-broccoli-plugin.ts | 2 +- tools/broccoli/tree-differ.spec.ts | 12 +- tools/broccoli/trees/browser_tree.ts | 5 +- 50 files changed, 363 insertions(+), 350 deletions(-) diff --git a/docs/dgeni-package/mocks/readTypeScriptModules/orderingOfMembers.ts b/docs/dgeni-package/mocks/readTypeScriptModules/orderingOfMembers.ts index 738aa60d2f..2020ec7fa4 100644 --- a/docs/dgeni-package/mocks/readTypeScriptModules/orderingOfMembers.ts +++ b/docs/dgeni-package/mocks/readTypeScriptModules/orderingOfMembers.ts @@ -1,12 +1,6 @@ export class Test { firstItem; - constructor() { - this.doStuff(); - } - otherMethod() { - - } - doStuff() { - - } + constructor() { this.doStuff(); } + otherMethod() {} + doStuff() {} } \ No newline at end of file diff --git a/docs/dgeni-package/mocks/testSrc.ts b/docs/dgeni-package/mocks/testSrc.ts index 58aea78d9f..7b6d3f18dd 100644 --- a/docs/dgeni-package/mocks/testSrc.ts +++ b/docs/dgeni-package/mocks/testSrc.ts @@ -20,19 +20,15 @@ export class MyClass { * Create a new MyClass * @param {String} name The name to say hello to */ - constructor(name) { - this.message = 'hello ' + name; - } + constructor(name) { this.message = 'hello ' + name; } /** * Return a greeting message */ - greet() { - return this.message; - } + greet() { return this.message; } } /** * An exported function */ -export var myFn = (val:number) => return val*2; \ No newline at end of file +export var myFn = (val: number) => return val * 2; \ No newline at end of file diff --git a/modules/angular2/src/change_detection/coalesce.ts b/modules/angular2/src/change_detection/coalesce.ts index 8889fcc802..f1d58205a0 100644 --- a/modules/angular2/src/change_detection/coalesce.ts +++ b/modules/angular2/src/change_detection/coalesce.ts @@ -45,9 +45,9 @@ function _selfRecord(r: ProtoRecord, contextIndex: number, selfIndex: number): P function _findMatching(r: ProtoRecord, rs: List) { return ListWrapper.find(rs, (rr) => rr.mode !== RecordType.DIRECTIVE_LIFECYCLE && - rr.mode === r.mode && rr.funcOrValue === r.funcOrValue && - rr.contextIndex === r.contextIndex && - ListWrapper.equals(rr.args, r.args)); + rr.mode === r.mode && rr.funcOrValue === r.funcOrValue && + rr.contextIndex === r.contextIndex && + ListWrapper.equals(rr.args, r.args)); } function _replaceIndices(r: ProtoRecord, selfIndex: number, indexMap: Map) { diff --git a/modules/angular2/src/change_detection/proto_record.ts b/modules/angular2/src/change_detection/proto_record.ts index 88d208f5c5..976fc06b21 100644 --- a/modules/angular2/src/change_detection/proto_record.ts +++ b/modules/angular2/src/change_detection/proto_record.ts @@ -3,8 +3,20 @@ import {BindingRecord} from './binding_record'; import {DirectiveIndex} from './directive_record'; export enum RecordType { - SELF, CONST, PRIMITIVE_OP, PROPERTY, LOCAL, INVOKE_METHOD, INVOKE_CLOSURE, KEYED_ACCESS, PIPE, - BINDING_PIPE, INTERPOLATE, SAFE_PROPERTY, SAFE_INVOKE_METHOD, DIRECTIVE_LIFECYCLE + SELF, + CONST, + PRIMITIVE_OP, + PROPERTY, + LOCAL, + INVOKE_METHOD, + INVOKE_CLOSURE, + KEYED_ACCESS, + PIPE, + BINDING_PIPE, + INTERPOLATE, + SAFE_PROPERTY, + SAFE_INVOKE_METHOD, + DIRECTIVE_LIFECYCLE } export class ProtoRecord { diff --git a/modules/angular2/src/core/application.ts b/modules/angular2/src/core/application.ts index 70b5ecfb7f..4bc6fa6ee9 100644 --- a/modules/angular2/src/core/application.ts +++ b/modules/angular2/src/core/application.ts @@ -101,7 +101,7 @@ function _injectorBindings(appComponentType): List> { [NgZone]), bind(ShadowDomStrategy) .toFactory((styleUrlResolver, doc) => - new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head), + new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head), [StyleUrlResolver, DOCUMENT_TOKEN]), DomRenderer, DefaultDomCompiler, diff --git a/modules/angular2/src/core/compiler/proto_view_factory.ts b/modules/angular2/src/core/compiler/proto_view_factory.ts index 51a836d961..12312c3d98 100644 --- a/modules/angular2/src/core/compiler/proto_view_factory.ts +++ b/modules/angular2/src/core/compiler/proto_view_factory.ts @@ -348,15 +348,18 @@ function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderE } function _createElementBinder(protoView, boundElementIndex, renderElementBinder, - protoElementInjector, componentDirectiveBinding, directiveBindings): ElementBinder { + protoElementInjector, componentDirectiveBinding, + directiveBindings): ElementBinder { var parent = null; if (renderElementBinder.parentIndex !== -1) { parent = protoView.elementBinders[renderElementBinder.parentIndex]; } - var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); - var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, - protoElementInjector, directiveVariableBindings, componentDirectiveBinding); + var directiveVariableBindings = + createDirectiveVariableBindings(renderElementBinder, directiveBindings); + var elBinder = + protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, + directiveVariableBindings, componentDirectiveBinding); protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1); // variables // The view's locals needs to have a full set of variable names at construction time @@ -369,8 +372,9 @@ function _createElementBinder(protoView, boundElementIndex, renderElementBinder, return elBinder; } -export function createDirectiveVariableBindings(renderElementBinder:renderApi.ElementBinder, - directiveBindings:List): Map { +export function createDirectiveVariableBindings( + renderElementBinder: renderApi.ElementBinder, + directiveBindings: List): Map { var directiveVariableBindings = MapWrapper.create(); MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => { var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); @@ -388,7 +392,8 @@ function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, e if (_directiveExportAs(directive) == exportAs) { if (isPresent(matchedDirective)) { - throw new BaseException(`More than one directive have exportAs = '${exportAs}'. Directives: [${matchedDirective.displayName}, ${directive.displayName}]`); + throw new BaseException( + `More than one directive have exportAs = '${exportAs}'. Directives: [${matchedDirective.displayName}, ${directive.displayName}]`); } matchedDirectiveIndex = i; @@ -403,9 +408,10 @@ function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, e return matchedDirectiveIndex; } -function _directiveExportAs(directive):string { +function _directiveExportAs(directive): string { var directiveExportAs = directive.metadata.exportAs; - if (isBlank(directiveExportAs) && directive.metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + if (isBlank(directiveExportAs) && + directive.metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { return "$implicit"; } else { return directiveExportAs; diff --git a/modules/angular2/src/core/zone/ng_zone.ts b/modules/angular2/src/core/zone/ng_zone.ts index 8a131d3389..8d2e1d6300 100644 --- a/modules/angular2/src/core/zone/ng_zone.ts +++ b/modules/angular2/src/core/zone/ng_zone.ts @@ -143,9 +143,7 @@ export class NgZone { errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { ngZone._onError(this, e) }}); } else { - errorHandling = { - onError: function(e) { ngZone._onError(this, e) } - }; + errorHandling = {onError: function(e) { ngZone._onError(this, e) }}; } return zone.fork(errorHandling) diff --git a/modules/angular2/src/facade/lang.ts b/modules/angular2/src/facade/lang.ts index 2a97cd752c..607f51d923 100644 --- a/modules/angular2/src/facade/lang.ts +++ b/modules/angular2/src/facade/lang.ts @@ -240,7 +240,7 @@ export function normalizeBlank(obj) { return isBlank(obj) ? null : obj; } -export function normalizeBool(obj:boolean):boolean { +export function normalizeBool(obj: boolean): boolean { return isBlank(obj) ? false : obj; } diff --git a/modules/angular2/src/http/enums.ts b/modules/angular2/src/http/enums.ts index fac36b4fca..1e67c48cd6 100644 --- a/modules/angular2/src/http/enums.ts +++ b/modules/angular2/src/http/enums.ts @@ -1,12 +1,12 @@ -export enum RequestModesOpts { Cors, NoCors, SameOrigin }; +export enum RequestModesOpts {Cors, NoCors, SameOrigin}; -export enum RequestCacheOpts { Default, NoStore, Reload, NoCache, ForceCache, OnlyIfCached }; +export enum RequestCacheOpts {Default, NoStore, Reload, NoCache, ForceCache, OnlyIfCached}; -export enum RequestCredentialsOpts { Omit, SameOrigin, Include }; +export enum RequestCredentialsOpts {Omit, SameOrigin, Include}; -export enum RequestMethods { GET, POST, PUT, DELETE, OPTIONS, HEAD }; +export enum RequestMethods {GET, POST, PUT, DELETE, OPTIONS, HEAD}; -export enum ReadyStates { UNSENT, OPEN, HEADERS_RECEIVED, LOADING, DONE, CANCELLED }; +export enum ReadyStates {UNSENT, OPEN, HEADERS_RECEIVED, LOADING, DONE, CANCELLED}; -export enum ResponseTypes { Basic, Cors, Default, Error, Opaque } +export enum ResponseTypes {Basic, Cors, Default, Error, Opaque} diff --git a/modules/angular2/src/render/dom/view/proto_view.ts b/modules/angular2/src/render/dom/view/proto_view.ts index efccce804d..155cc84150 100644 --- a/modules/angular2/src/render/dom/view/proto_view.ts +++ b/modules/angular2/src/render/dom/view/proto_view.ts @@ -39,7 +39,7 @@ export class DomProtoView { (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) ? 1 : 0; this.boundTextNodeCount = ListWrapper.reduce(elementBinders, (prevCount: number, elementBinder: ElementBinder) => - prevCount + elementBinder.textNodeIndices.length, + prevCount + elementBinder.textNodeIndices.length, 0); this.rootNodeCount = this.isTemplateElement ? DOM.childNodes(DOM.content(this.element)).length : 1; diff --git a/modules/angular2/src/test_lib/test_injector.ts b/modules/angular2/src/test_lib/test_injector.ts index 3217122b61..21b96e96c9 100644 --- a/modules/angular2/src/test_lib/test_injector.ts +++ b/modules/angular2/src/test_lib/test_injector.ts @@ -86,7 +86,7 @@ function _getAppBindings() { .toValue(appDoc), bind(ShadowDomStrategy) .toFactory((styleUrlResolver, doc) => - new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head), + new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head), [StyleUrlResolver, DOCUMENT_TOKEN]), DomRenderer, DefaultDomCompiler, diff --git a/modules/angular2/src/test_lib/test_lib.ts b/modules/angular2/src/test_lib/test_lib.ts index 5cf865264e..8fc48d3b1e 100644 --- a/modules/angular2/src/test_lib/test_lib.ts +++ b/modules/angular2/src/test_lib/test_lib.ts @@ -11,8 +11,7 @@ import {createTestInjector, FunctionWithParamTokens, inject} from './test_inject export {inject} from './test_injector'; -export function proxy() { -} +export function proxy() {} var _global: jasmine.GlobalPolluter = (typeof window === 'undefined' ? global : window); diff --git a/modules/angular2/src/test_lib/utils.ts b/modules/angular2/src/test_lib/utils.ts index 5e4b2f8552..c0524ede63 100644 --- a/modules/angular2/src/test_lib/utils.ts +++ b/modules/angular2/src/test_lib/utils.ts @@ -42,7 +42,8 @@ export function el(html: string) { return DOM.firstChild(DOM.content(DOM.createTemplate(html))); } -var _RE_SPECIAL_CHARS = ['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|']; +var _RE_SPECIAL_CHARS = + ['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|']; var _ESCAPE_RE = RegExpWrapper.create(`[\\${_RE_SPECIAL_CHARS.join('\\')}]`); export function containsRegexp(input: string): RegExp { return RegExpWrapper.create( diff --git a/modules/angular2/test/change_detection/change_detector_config.ts b/modules/angular2/test/change_detection/change_detector_config.ts index e64cddfc87..70f3c7b3e0 100644 --- a/modules/angular2/test/change_detection/change_detector_config.ts +++ b/modules/angular2/test/change_detection/change_detector_config.ts @@ -89,9 +89,12 @@ export class TestDefinition { */ export function getAllDefinitions(): List { var allDefs = _availableDefinitions; - allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithLocals.availableDefinitions)); - allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithMode.availableDefinitions)); - allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_DirectiveUpdating.availableDefinitions)); + allDefs = ListWrapper.concat(allDefs, + StringMapWrapper.keys(_ExpressionWithLocals.availableDefinitions)); + allDefs = + ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithMode.availableDefinitions)); + allDefs = + ListWrapper.concat(allDefs, StringMapWrapper.keys(_DirectiveUpdating.availableDefinitions)); return ListWrapper.map(allDefs, (id) => getDefinition(id)); } diff --git a/modules/angular2/test/change_detection/change_detector_spec.ts b/modules/angular2/test/change_detection/change_detector_spec.ts index 16b54c3762..22e4796a9b 100644 --- a/modules/angular2/test/change_detection/change_detector_spec.ts +++ b/modules/angular2/test/change_detection/change_detector_spec.ts @@ -87,7 +87,8 @@ export function main() { function _createWithoutHydrate(expression: string) { var dispatcher = new TestDispatcher(); var registry = null; - var cd = _getProtoChangeDetector(getDefinition(expression).cdDef, registry).instantiate(dispatcher); + var cd = _getProtoChangeDetector(getDefinition(expression).cdDef, registry) + .instantiate(dispatcher); return new _ChangeDetectorAndDispatcher(cd, dispatcher); } @@ -334,7 +335,8 @@ export function main() { it('should happen directly, without invoking the dispatcher', () => { var val = _createWithoutHydrate('directNoDispatcher'); - val.changeDetector.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directive1], [])); + val.changeDetector.hydrate(_DEFAULT_CONTEXT, null, + new FakeDirectives([directive1], [])); val.changeDetector.detectChanges(); expect(val.dispatcher.loggedValues).toEqual([]); expect(directive1.a).toEqual(42); @@ -465,11 +467,11 @@ export function main() { var orderOfOperations = []; var directiveInShadowDom = null; - directiveInShadowDom = - new TestDirective(() => { ListWrapper.push(orderOfOperations, directiveInShadowDom); }); + directiveInShadowDom = new TestDirective( + () => { ListWrapper.push(orderOfOperations, directiveInShadowDom); }); var parentDirective = null; - parentDirective = - new TestDirective(() => { ListWrapper.push(orderOfOperations, parentDirective); }); + parentDirective = new TestDirective( + () => { ListWrapper.push(orderOfOperations, parentDirective); }); parent.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([parentDirective], [])); child.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directiveInShadowDom], [])); @@ -594,14 +596,13 @@ export function main() { }); describe('mode', () => { - it('should set the mode to CHECK_ALWAYS when the default change detection is used', - () => { - var cd = _createWithoutHydrate('emptyUsingDefaultStrategy').changeDetector; - expect(cd.mode).toEqual(null); + it('should set the mode to CHECK_ALWAYS when the default change detection is used', () => { + var cd = _createWithoutHydrate('emptyUsingDefaultStrategy').changeDetector; + expect(cd.mode).toEqual(null); - cd.hydrate(_DEFAULT_CONTEXT, null, null); - expect(cd.mode).toEqual(CHECK_ALWAYS); - }); + cd.hydrate(_DEFAULT_CONTEXT, null, null); + expect(cd.mode).toEqual(CHECK_ALWAYS); + }); it('should set the mode to CHECK_ONCE when the push change detection is used', () => { var cd = _createWithoutHydrate('emptyUsingOnPushStrategy').changeDetector; diff --git a/modules/angular2/test/change_detection/parser/parser_spec.ts b/modules/angular2/test/change_detection/parser/parser_spec.ts index fcfd15ffe1..c31ec46c02 100644 --- a/modules/angular2/test/change_detection/parser/parser_spec.ts +++ b/modules/angular2/test/change_detection/parser/parser_spec.ts @@ -462,14 +462,14 @@ export function main() { function exprSources(templateBindings) { return ListWrapper.map(templateBindings, (binding) => isPresent(binding.expression) ? - binding.expression.source : - null); + binding.expression.source : + null); } function exprAsts(templateBindings) { return ListWrapper.map(templateBindings, (binding) => isPresent(binding.expression) ? - binding.expression : - null); + binding.expression : + null); } it('should parse an empty string', () => { diff --git a/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts b/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts index 16dc14c2c0..03fe47e84f 100644 --- a/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts +++ b/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts @@ -31,9 +31,7 @@ export function main() { function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); } beforeEach(() => { - inceptionObj = { - dream: {dream: {dream: 'Limbo'}} - }; + inceptionObj = {dream: {dream: {dream: 'Limbo'}}}; inceptionObjString = "{\n" + " \"dream\": {\n" + " \"dream\": {\n" + " \"dream\": \"Limbo\"\n" + " }\n" + " }\n" + "}"; diff --git a/modules/angular2/test/core/compiler/compiler_spec.ts b/modules/angular2/test/core/compiler/compiler_spec.ts index b75346d92f..e3864ea9e9 100644 --- a/modules/angular2/test/core/compiler/compiler_spec.ts +++ b/modules/angular2/test/core/compiler/compiler_spec.ts @@ -315,9 +315,8 @@ export function main() { var nestedProtoView = createProtoView(); var compiler = createCompiler([ createRenderProtoView([ - createRenderViewportElementBinder( - createRenderProtoView([createRenderComponentElementBinder(0)], - renderApi.ViewType.EMBEDDED)) + createRenderViewportElementBinder(createRenderProtoView( + [createRenderComponentElementBinder(0)], renderApi.ViewType.EMBEDDED)) ]), createRenderProtoView() ], diff --git a/modules/angular2/test/core/compiler/integration_spec.ts b/modules/angular2/test/core/compiler/integration_spec.ts index 47b13ec10e..2740702c56 100644 --- a/modules/angular2/test/core/compiler/integration_spec.ts +++ b/modules/angular2/test/core/compiler/integration_spec.ts @@ -1488,8 +1488,7 @@ class DirectiveListeningDomEvent { } var globalCounter = 0; -@Directive( - {selector: '[listenerother]', host: {'(window:domEvent)': 'onEvent($event.type)'}}) +@Directive({selector: '[listenerother]', host: {'(window:domEvent)': 'onEvent($event.type)'}}) @Injectable() class DirectiveListeningDomEventOther { eventType: string; diff --git a/modules/angular2/test/core/compiler/query_integration_spec.ts b/modules/angular2/test/core/compiler/query_integration_spec.ts index f503e6cfb9..213d4b2e5f 100644 --- a/modules/angular2/test/core/compiler/query_integration_spec.ts +++ b/modules/angular2/test/core/compiler/query_integration_spec.ts @@ -29,7 +29,7 @@ export function main() { inject([TestBed, AsyncTestCompleter], (tb, async) => { var template = '
' + '
' + - '
' + + '
' + '
' + '
'; @@ -43,36 +43,36 @@ export function main() { })); it('should contain all directives in the light dom when descendants flag is used', - inject([TestBed, AsyncTestCompleter], (tb, async) => { - var template = '
' + - '
' + - '
' + - '
' + - '
'; + inject([TestBed, AsyncTestCompleter], (tb, async) => { + var template = '
' + + '
' + + '
' + + '
' + + '
'; - tb.createView(MyComp, {html: template}) - .then((view) => { - view.detectChanges(); - expect(view.rootNodes).toHaveText('2|3|4|'); + tb.createView(MyComp, {html: template}) + .then((view) => { + view.detectChanges(); + expect(view.rootNodes).toHaveText('2|3|4|'); - async.done(); - }); - })); + async.done(); + }); + })); it('should contain all directives in the light dom', - inject([TestBed, AsyncTestCompleter], (tb, async) => { - var template = '
' + - '
' + - '
'; + inject([TestBed, AsyncTestCompleter], (tb, async) => { + var template = '
' + + '
' + + '
'; - tb.createView(MyComp, {html: template}) - .then((view) => { - view.detectChanges(); - expect(view.rootNodes).toHaveText('2|3|'); + tb.createView(MyComp, {html: template}) + .then((view) => { + view.detectChanges(); + expect(view.rootNodes).toHaveText('2|3|'); - async.done(); - }); - })); + async.done(); + }); + })); // TODO(rado): The test below should be using descendants: false, // but due to a bug with how injectors are hooked up query considers the @@ -142,7 +142,9 @@ class NeedsQuery { @Injectable() class NeedsQueryDesc { query: QueryList; - constructor(@Query(TextDirective, {descendants: true}) query: QueryList) { this.query = query; } + constructor(@Query(TextDirective, {descendants: true}) query: QueryList) { + this.query = query; + } } @Component({selector: 'my-comp'}) diff --git a/modules/angular2/test/core/life_cycle/life_cycle_spec.ts b/modules/angular2/test/core/life_cycle/life_cycle_spec.ts index 98a48d2552..6727dd06c5 100644 --- a/modules/angular2/test/core/life_cycle/life_cycle_spec.ts +++ b/modules/angular2/test/core/life_cycle/life_cycle_spec.ts @@ -14,7 +14,7 @@ import { SpyObject, inject, proxy - } from 'angular2/test_lib'; +} from 'angular2/test_lib'; import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; import {ChangeDetector} from 'angular2/change_detection'; import {IMPLEMENTS} from 'angular2/src/facade/lang'; diff --git a/modules/angular2/test/core/zone/ng_zone_spec.ts b/modules/angular2/test/core/zone/ng_zone_spec.ts index 8cf5476b07..208e3c7124 100644 --- a/modules/angular2/test/core/zone/ng_zone_spec.ts +++ b/modules/angular2/test/core/zone/ng_zone_spec.ts @@ -205,21 +205,15 @@ function commonTests() { _zone.initCallbacks({ onTurnDone: () => { _log.add('onTurnDone:started'); - _zone.run(() => _log.add('nested run')) - _log.add('onTurnDone:finished'); + _zone.run(() => _log.add('nested run')) _log.add('onTurnDone:finished'); } }); - macroTask(() => { - _zone.run(() => { - _log.add('start run'); - }); - }); + macroTask(() => { _zone.run(() => { _log.add('start run'); }); }); macroTask(() => { expect(_log.result()) - .toEqual( - 'start run; onTurnDone:started; nested run; onTurnDone:finished'); + .toEqual('start run; onTurnDone:started; nested run; onTurnDone:finished'); async.done(); }, 50); })); diff --git a/modules/angular2/test/directives/class_spec.ts b/modules/angular2/test/directives/class_spec.ts index 63a5eb5d1d..35630cc7da 100644 --- a/modules/angular2/test/directives/class_spec.ts +++ b/modules/angular2/test/directives/class_spec.ts @@ -92,10 +92,7 @@ export function main() { view.detectChanges(); expect(view.rootNodes[0].className).toEqual('ng-binding foo'); - view.context.expr = { - 'foo': false, - 'bar': true - }; + view.context.expr = {'foo': false, 'bar': true}; view.detectChanges(); expect(view.rootNodes[0].className).toEqual('ng-binding bar'); diff --git a/modules/angular2/test/http/http_spec.ts b/modules/angular2/test/http/http_spec.ts index 15d031dd56..e3af4b7e37 100644 --- a/modules/angular2/test/http/http_spec.ts +++ b/modules/angular2/test/http/http_spec.ts @@ -39,14 +39,15 @@ export function main() { var baseResponse; var sampleObserver; beforeEach(() => { - injector = Injector.resolveAndCreate([MockBackend, bind(Http).toFactory(HttpFactory, [MockBackend])]); + injector = Injector.resolveAndCreate( + [MockBackend, bind(Http).toFactory(HttpFactory, [MockBackend])]); http = injector.get(Http); backend = injector.get(MockBackend); baseResponse = new Response('base response'); sampleObserver = new SpyObserver(); }); - afterEach(() => { /*backend.verifyNoPendingRequests();*/ }); + afterEach(() => {/*backend.verifyNoPendingRequests();*/}); it('should return an Observable', () => { diff --git a/modules/angular2/test/reflection/reflector_spec.ts b/modules/angular2/test/reflection/reflector_spec.ts index 3c7f256e2e..227ee4f366 100644 --- a/modules/angular2/test/reflection/reflector_spec.ts +++ b/modules/angular2/test/reflection/reflector_spec.ts @@ -84,10 +84,8 @@ export function main() { // clang-format on }); - it("should throw when more than 20 arguments", () => { - expect(() => reflector.factory(TestObjWith21Args)) - .toThrowError(); - }); + it("should throw when more than 20 arguments", + () => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); }); it("should return a registered factory if available", () => { reflector.registerType(TestObj, {"factory": () => "fake"}); @@ -195,65 +193,47 @@ export function main() { class TestObjWith00Args { args: List; - constructor() { - this.args = []; - } + constructor() { this.args = []; } } class TestObjWith01Args { args: List; - constructor(a1) { - this.args = [a1]; - } + constructor(a1) { this.args = [a1]; } } class TestObjWith02Args { args: List; - constructor(a1, a2) { - this.args = [a1, a2]; - } + constructor(a1, a2) { this.args = [a1, a2]; } } class TestObjWith03Args { args: List; - constructor(a1, a2, a3) { - this.args = [a1, a2, a3]; - } + constructor(a1, a2, a3) { this.args = [a1, a2, a3]; } } class TestObjWith04Args { args: List; - constructor(a1, a2, a3, a4) { - this.args = [a1, a2, a3, a4]; - } + constructor(a1, a2, a3, a4) { this.args = [a1, a2, a3, a4]; } } class TestObjWith05Args { args: List; - constructor(a1, a2, a3, a4, a5) { - this.args = [a1, a2, a3, a4, a5]; - } + constructor(a1, a2, a3, a4, a5) { this.args = [a1, a2, a3, a4, a5]; } } class TestObjWith06Args { args: List; - constructor(a1, a2, a3, a4, a5, a6) { - this.args = [a1, a2, a3, a4, a5, a6]; - } + constructor(a1, a2, a3, a4, a5, a6) { this.args = [a1, a2, a3, a4, a5, a6]; } } class TestObjWith07Args { args: List; - constructor(a1, a2, a3, a4, a5, a6, a7) { - this.args = [a1, a2, a3, a4, a5, a6, a7]; - } + constructor(a1, a2, a3, a4, a5, a6, a7) { this.args = [a1, a2, a3, a4, a5, a6, a7]; } } class TestObjWith08Args { args: List; - constructor(a1, a2, a3, a4, a5, a6, a7, a8) { - this.args = [a1, a2, a3, a4, a5, a6, a7, a8]; - } + constructor(a1, a2, a3, a4, a5, a6, a7, a8) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8]; } } class TestObjWith09Args { @@ -328,21 +308,48 @@ class TestObjWith18Args { class TestObjWith19Args { args: List; - constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { - this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19]; + constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, + a19) { + this.args = + [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19]; } } class TestObjWith20Args { args: List; - constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { - this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20]; + constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20) { + this.args = + [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20]; } } class TestObjWith21Args { args: List; - constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) { - this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21]; + constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21) { + this.args = [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + a20, + a21 + ]; } } diff --git a/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts b/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts index 97bf556ad4..f8c24db235 100644 --- a/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts +++ b/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts @@ -244,7 +244,7 @@ var someDirectiveWithProps = DirectiveMetadata.create({ var someDirectiveWithHostProperties = DirectiveMetadata.create({ selector: '[some-decor-with-host-props]', - host: MapWrapper.createFromStringMap({'[hostProp]' : 'dirProp'}) + host: MapWrapper.createFromStringMap({'[hostProp]': 'dirProp'}) }); var someDirectiveWithHostAttributes = DirectiveMetadata.create({ @@ -252,10 +252,8 @@ var someDirectiveWithHostAttributes = DirectiveMetadata.create({ host: MapWrapper.createFromStringMap({'attr_name': 'attr_val', 'class': 'foo bar'}) }); -var someDirectiveWithEvents = DirectiveMetadata.create({ - selector: '[some-decor-events]', - host: MapWrapper.createFromStringMap({'(click)': 'doIt()'}) -}); +var someDirectiveWithEvents = DirectiveMetadata.create( + {selector: '[some-decor-events]', host: MapWrapper.createFromStringMap({'(click)': 'doIt()'})}); var someDirectiveWithHostActions = DirectiveMetadata.create({ selector: '[some-decor-host-actions]', diff --git a/modules/angular2/test/render/dom/compiler/pipeline_spec.ts b/modules/angular2/test/render/dom/compiler/pipeline_spec.ts index 1600941ed4..8348637be1 100644 --- a/modules/angular2/test/render/dom/compiler/pipeline_spec.ts +++ b/modules/angular2/test/render/dom/compiler/pipeline_spec.ts @@ -42,8 +42,7 @@ export function main() { var pipeline = new CompilePipeline([ new MockStep((parent, current, control) => { if (isPresent(DOM.getAttribute(current.element, 'viewroot'))) { - current.inheritedProtoView = - new ProtoViewBuilder(current.element, ViewType.EMBEDDED); + current.inheritedProtoView = new ProtoViewBuilder(current.element, ViewType.EMBEDDED); } }) ]); diff --git a/modules/angular2/test/render/dom/convert_spec.ts b/modules/angular2/test/render/dom/convert_spec.ts index a880ec96ef..36c2c4ca68 100644 --- a/modules/angular2/test/render/dom/convert_spec.ts +++ b/modules/angular2/test/render/dom/convert_spec.ts @@ -26,10 +26,14 @@ export function main() { }); var map = directiveMetadataToMap(someComponent); expect(MapWrapper.get(map, 'compileChildren')).toEqual(false); - expect(MapWrapper.get(map, 'hostListeners')).toEqual(MapWrapper.createFromPairs([['LKey', 'LVal']])); - expect(MapWrapper.get(map, 'hostProperties')).toEqual(MapWrapper.createFromPairs([['PKey', 'PVal']])); - expect(MapWrapper.get(map, 'hostActions')).toEqual(MapWrapper.createFromPairs([['AcKey', 'AcVal']])); - expect(MapWrapper.get(map, 'hostAttributes')).toEqual(MapWrapper.createFromPairs([['AtKey', 'AtVal']])); + expect(MapWrapper.get(map, 'hostListeners')) + .toEqual(MapWrapper.createFromPairs([['LKey', 'LVal']])); + expect(MapWrapper.get(map, 'hostProperties')) + .toEqual(MapWrapper.createFromPairs([['PKey', 'PVal']])); + expect(MapWrapper.get(map, 'hostActions')) + .toEqual(MapWrapper.createFromPairs([['AcKey', 'AcVal']])); + expect(MapWrapper.get(map, 'hostAttributes')) + .toEqual(MapWrapper.createFromPairs([['AtKey', 'AtVal']])); expect(MapWrapper.get(map, 'id')).toEqual('someComponent'); expect(MapWrapper.get(map, 'properties')).toEqual(['propKey: propVal']); expect(MapWrapper.get(map, 'readAttributes')).toEqual(['read1', 'read2']); diff --git a/modules/angular2/test/render/dom/dom_renderer_integration_spec.ts b/modules/angular2/test/render/dom/dom_renderer_integration_spec.ts index 360dc15db0..0abe235635 100644 --- a/modules/angular2/test/render/dom/dom_renderer_integration_spec.ts +++ b/modules/angular2/test/render/dom/dom_renderer_integration_spec.ts @@ -75,8 +75,9 @@ export function main() { tb.compileAll([ someComponent, new ViewDefinition({ - componentId: 'someComponent', template: ' \n ', - directives: [someComponent] + componentId: 'someComponent', + template: ' \n ', + directives: [someComponent] }) ]) .then((protoViewDtos) => { diff --git a/modules/angular2/test/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy_spec.ts b/modules/angular2/test/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy_spec.ts index f73c944775..451f7de806 100644 --- a/modules/angular2/test/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy_spec.ts +++ b/modules/angular2/test/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy_spec.ts @@ -97,19 +97,21 @@ export function main() { expect(DOM.getText(styleElement)).not.toEqual(DOM.getText(styleElement2)); }); - it('should move the style element to the style host when @imports are present', inject([AsyncTestCompleter], (async) => { - xhr.reply('http://base/one.css', '.one {}'); + it('should move the style element to the style host when @imports are present', + inject([AsyncTestCompleter], (async) => { + xhr.reply('http://base/one.css', '.one {}'); - var compileElement = el('
'); - var styleElement = DOM.firstChild(compileElement); - var stylePromise = strategy.processStyleElement('someComponent', 'http://base', styleElement); + var compileElement = el('
'); + var styleElement = DOM.firstChild(compileElement); + var stylePromise = + strategy.processStyleElement('someComponent', 'http://base', styleElement); - stylePromise.then((_) => { - expect(compileElement).toHaveText(''); - expect(styleHost).toHaveText('.one[_ngcontent-0] {\n\n}'); - async.done(); - }); - })); + stylePromise.then((_) => { + expect(compileElement).toHaveText(''); + expect(styleHost).toHaveText('.one[_ngcontent-0] {\n\n}'); + async.done(); + }); + })); it('should move the style element to the style host', () => { var compileElement = el('
'); diff --git a/modules/angular2/test/render/dom/shadow_dom_emulation_integration_spec.ts b/modules/angular2/test/render/dom/shadow_dom_emulation_integration_spec.ts index 172db28914..dee9367d0e 100644 --- a/modules/angular2/test/render/dom/shadow_dom_emulation_integration_spec.ts +++ b/modules/angular2/test/render/dom/shadow_dom_emulation_integration_spec.ts @@ -43,8 +43,8 @@ export function main() { styleInliner, styleUrlResolver, null), [StyleInliner, StyleUrlResolver]), "unscoped": bind(ShadowDomStrategy) - .toFactory((styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy( - styleUrlResolver, null), + .toFactory((styleUrlResolver) => + new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, null), [StyleUrlResolver]) }; if (DOM.supportsNativeShadowDOM()) { @@ -398,14 +398,14 @@ export function main() { } -var mainDir = - DirectiveMetadata.create({selector: 'main', id: 'main', type: DirectiveMetadata.COMPONENT_TYPE}); +var mainDir = DirectiveMetadata.create( + {selector: 'main', id: 'main', type: DirectiveMetadata.COMPONENT_TYPE}); var simple = DirectiveMetadata.create( {selector: 'simple', id: 'simple', type: DirectiveMetadata.COMPONENT_TYPE}); -var empty = - DirectiveMetadata.create({selector: 'empty', id: 'empty', type: DirectiveMetadata.COMPONENT_TYPE}); +var empty = DirectiveMetadata.create( + {selector: 'empty', id: 'empty', type: DirectiveMetadata.COMPONENT_TYPE}); var dynamicComponent = DirectiveMetadata.create( {selector: 'dynamic', id: 'dynamic', type: DirectiveMetadata.COMPONENT_TYPE}); @@ -425,11 +425,11 @@ var outerWithIndirectNestedComponent = DirectiveMetadata.create({ type: DirectiveMetadata.COMPONENT_TYPE }); -var outerComponent = - DirectiveMetadata.create({selector: 'outer', id: 'outer', type: DirectiveMetadata.COMPONENT_TYPE}); +var outerComponent = DirectiveMetadata.create( + {selector: 'outer', id: 'outer', type: DirectiveMetadata.COMPONENT_TYPE}); -var innerComponent = - DirectiveMetadata.create({selector: 'inner', id: 'inner', type: DirectiveMetadata.COMPONENT_TYPE}); +var innerComponent = DirectiveMetadata.create( + {selector: 'inner', id: 'inner', type: DirectiveMetadata.COMPONENT_TYPE}); var innerInnerComponent = DirectiveMetadata.create( {selector: 'innerinner', id: 'innerinner', type: DirectiveMetadata.COMPONENT_TYPE}); diff --git a/modules/angular2/test/render/dom/view/property_setter_factory_spec.ts b/modules/angular2/test/render/dom/view/property_setter_factory_spec.ts index 9ec9102eb5..bcde779f41 100644 --- a/modules/angular2/test/render/dom/view/property_setter_factory_spec.ts +++ b/modules/angular2/test/render/dom/view/property_setter_factory_spec.ts @@ -33,32 +33,35 @@ export function main() { }); if (!IS_DARTIUM) { - it('should use a noop setter if the property did not exist when the setter was created', () => { - var setterFn = setterFactory.createSetter(div, false, 'someProp'); - div.someProp = ''; - setterFn(div, 'Hello'); - expect(div.someProp).toEqual(''); - }); + it('should use a noop setter if the property did not exist when the setter was created', + () => { + var setterFn = setterFactory.createSetter(div, false, 'someProp'); + div.someProp = ''; + setterFn(div, 'Hello'); + expect(div.someProp).toEqual(''); + }); - it('should use a noop setter if the property did not exist when the setter was created for ng components', () => { - var ce = el(''); - var setterFn = setterFactory.createSetter(ce, true, 'someProp'); - ce.someProp = ''; - setterFn(ce, 'Hello'); - expect(ce.someProp).toEqual(''); - }); + it('should use a noop setter if the property did not exist when the setter was created for ng components', + () => { + var ce = el(''); + var setterFn = setterFactory.createSetter(ce, true, 'someProp'); + ce.someProp = ''; + setterFn(ce, 'Hello'); + expect(ce.someProp).toEqual(''); + }); - it('should set the property for custom elements even if it was not present when the setter was created', () => { - var ce = el(''); - var setterFn = setterFactory.createSetter(ce, false, 'someProp'); - ce.someProp = ''; - // Our CJS DOM adapter does not support custom properties, - // need to exclude here. - if (DOM.hasProperty(ce, 'someProp')) { - setterFn(ce, 'Hello'); - expect(ce.someProp).toEqual('Hello'); - } - }); + it('should set the property for custom elements even if it was not present when the setter was created', + () => { + var ce = el(''); + var setterFn = setterFactory.createSetter(ce, false, 'someProp'); + ce.someProp = ''; + // Our CJS DOM adapter does not support custom properties, + // need to exclude here. + if (DOM.hasProperty(ce, 'someProp')) { + setterFn(ce, 'Hello'); + expect(ce.someProp).toEqual('Hello'); + } + }); } }); diff --git a/modules/angular2/test/render/dom/view/view_spec.ts b/modules/angular2/test/render/dom/view/view_spec.ts index 4eeef9669c..63397a4a21 100644 --- a/modules/angular2/test/render/dom/view/view_spec.ts +++ b/modules/angular2/test/render/dom/view/view_spec.ts @@ -48,25 +48,22 @@ export function main() { return new DomView(pv, [DOM.childNodes(root)[0]], [], boundElements); } - function createElementBinder(parentIndex:number = 0, distanceToParent:number = 1) { - return new ElementBinder({parentIndex: parentIndex, distanceToParent:distanceToParent, textNodeIndices:[]}); + function createElementBinder(parentIndex: number = 0, distanceToParent: number = 1) { + return new ElementBinder( + {parentIndex: parentIndex, distanceToParent: distanceToParent, textNodeIndices: []}); } describe('getDirectParentElement', () => { it('should return the DomElement of the direct parent', () => { - var pv = createProtoView( - [createElementBinder(), createElementBinder(0, 1)]); + var pv = createProtoView([createElementBinder(), createElementBinder(0, 1)]); var view = createView(pv, 2); expect(view.getDirectParentElement(1)).toBe(view.boundElements[0]); }); it('should return null if the direct parent is not bound', () => { - var pv = createProtoView([ - createElementBinder(), - createElementBinder(), - createElementBinder(0,2) - ]); + var pv = createProtoView( + [createElementBinder(), createElementBinder(), createElementBinder(0, 2)]); var view = createView(pv, 3); expect(view.getDirectParentElement(2)).toBe(null); }); diff --git a/modules/angular2/test/router/route_registry_spec.ts b/modules/angular2/test/router/route_registry_spec.ts index 1441a33d3a..ea7aebabda 100644 --- a/modules/angular2/test/router/route_registry_spec.ts +++ b/modules/angular2/test/router/route_registry_spec.ts @@ -22,103 +22,122 @@ export function main() { beforeEach(() => { registry = new RouteRegistry(); }); it('should match the full URL', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/', 'component': DummyCompA}); - registry.config(rootHostComponent, {'path': '/test', 'component': DummyCompB}); + registry.config(rootHostComponent, {'path': '/', 'component': DummyCompA}); + registry.config(rootHostComponent, {'path': '/test', 'component': DummyCompB}); - registry.recognize('/test', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyCompB); - async.done(); - }); - })); + registry.recognize('/test', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyCompB); + async.done(); + }); + })); it('should prefer static segments to dynamic', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompB}); - registry.config(rootHostComponent, {'path': '/home', 'component': DummyCompA}); + registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompB}); + registry.config(rootHostComponent, {'path': '/home', 'component': DummyCompA}); - registry.recognize('/home', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyCompA); - async.done(); - }); - })); + registry.recognize('/home', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyCompA); + async.done(); + }); + })); it('should prefer dynamic segments to star', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompA}); - registry.config(rootHostComponent, {'path': '/*site', 'component': DummyCompB}); + registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompA}); + registry.config(rootHostComponent, {'path': '/*site', 'component': DummyCompB}); - registry.recognize('/home', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyCompA); - async.done(); - }); - })); + registry.recognize('/home', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyCompA); + async.done(); + }); + })); it('should prefer routes with more dynamic segments', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/:first/*rest', 'component': DummyCompA}); - registry.config(rootHostComponent, {'path': '/*all', 'component': DummyCompB}); + registry.config(rootHostComponent, {'path': '/:first/*rest', 'component': DummyCompA}); + registry.config(rootHostComponent, {'path': '/*all', 'component': DummyCompB}); - registry.recognize('/some/path', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyCompA); - async.done(); - }); - })); + registry.recognize('/some/path', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyCompA); + async.done(); + }); + })); it('should prefer routes with more static segments', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/first/:second', 'component': DummyCompA}); - registry.config(rootHostComponent, {'path': '/:first/:second', 'component': DummyCompB}); + registry.config(rootHostComponent, {'path': '/first/:second', 'component': DummyCompA}); + registry.config(rootHostComponent, {'path': '/:first/:second', 'component': DummyCompB}); - registry.recognize('/first/second', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyCompA); - async.done(); - }); - })); + registry.recognize('/first/second', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyCompA); + async.done(); + }); + })); - it('should prefer routes with static segments before dynamic segments', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/first/second/:third', 'component': DummyCompB}); - registry.config(rootHostComponent, {'path': '/first/:second/third', 'component': DummyCompA}); + it('should prefer routes with static segments before dynamic segments', + inject([AsyncTestCompleter], (async) => { + registry.config(rootHostComponent, + {'path': '/first/second/:third', 'component': DummyCompB}); + registry.config(rootHostComponent, + {'path': '/first/:second/third', 'component': DummyCompA}); - registry.recognize('/first/second/third', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyCompB); - async.done(); - }); - })); + registry.recognize('/first/second/third', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyCompB); + async.done(); + }); + })); it('should match the full URL using child components', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/first', 'component': DummyParentComp}); + registry.config(rootHostComponent, {'path': '/first', 'component': DummyParentComp}); - registry.recognize('/first/second', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyParentComp); - expect(instruction.child.component).toBe(DummyCompB); - async.done(); - }); - })); + registry.recognize('/first/second', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyParentComp); + expect(instruction.child.component).toBe(DummyCompB); + async.done(); + }); + })); - it('should match the URL using async child components', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/first', 'component': DummyAsyncComp}); + it('should match the URL using async child components', + inject([AsyncTestCompleter], (async) => { + registry.config(rootHostComponent, {'path': '/first', 'component': DummyAsyncComp}); - registry.recognize('/first/second', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyAsyncComp); - expect(instruction.child.component).toBe(DummyCompB); - async.done(); - }); - })); + registry.recognize('/first/second', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyAsyncComp); + expect(instruction.child.component).toBe(DummyCompB); + async.done(); + }); + })); - it('should match the URL using an async parent component', inject([AsyncTestCompleter], (async) => { - registry.config(rootHostComponent, {'path': '/first', 'component': {'loader': AsyncParentLoader, 'type': 'loader'} }); + it('should match the URL using an async parent component', + inject([AsyncTestCompleter], (async) => { + registry.config( + rootHostComponent, + {'path': '/first', 'component': {'loader': AsyncParentLoader, 'type': 'loader'}}); - registry.recognize('/first/second', rootHostComponent).then((instruction) => { - expect(instruction.component).toBe(DummyParentComp); - expect(instruction.child.component).toBe(DummyCompB); - async.done(); - }); - })); + registry.recognize('/first/second', rootHostComponent) + .then((instruction) => { + expect(instruction.component).toBe(DummyParentComp); + expect(instruction.child.component).toBe(DummyCompB); + async.done(); + }); + })); it('should throw when a config does not have a component or redirectTo property', () => { - expect(() => registry.config(rootHostComponent, {'path': '/some/path' })) - .toThrowError('Route config should contain exactly one \'component\', or \'redirectTo\' property'); + expect(() => registry.config(rootHostComponent, {'path': '/some/path'})) + .toThrowError( + 'Route config should contain exactly one \'component\', or \'redirectTo\' property'); }); it('should throw when a config has an invalid component type', () => { - expect(() => registry.config(rootHostComponent, {'path': '/some/path', 'component': { 'type': 'intentionallyWrongComponentType' } })) - .toThrowError('Invalid component type \'intentionallyWrongComponentType\''); + expect(() => registry.config( + rootHostComponent, + {'path': '/some/path', 'component': {'type': 'intentionallyWrongComponentType'}})) + .toThrowError('Invalid component type \'intentionallyWrongComponentType\''); }); }); } @@ -131,10 +150,9 @@ function AsyncChildLoader() { return PromiseWrapper.resolve(DummyCompB); } -@RouteConfig([ - { 'path': '/second', 'component': { 'loader': AsyncChildLoader, 'type': 'loader' } } -]) -class DummyAsyncComp {} +@RouteConfig([{'path': '/second', 'component': {'loader': AsyncChildLoader, 'type': 'loader'}}]) +class DummyAsyncComp { +} class DummyCompA {} class DummyCompB {} diff --git a/modules/benchmarks_external/src/largetable/largetable_benchmark.ts b/modules/benchmarks_external/src/largetable/largetable_benchmark.ts index 21dfa7295e..792c14aa7d 100644 --- a/modules/benchmarks_external/src/largetable/largetable_benchmark.ts +++ b/modules/benchmarks_external/src/largetable/largetable_benchmark.ts @@ -49,12 +49,7 @@ angular.module('app', []) for (var i = 0; i < totalRows; i++) { data[i] = []; for (var j = 0; j < totalColumns; j++) { - data[i][j] = { - i: i, - j: j, - iFn: iGetter, - jFn: jGetter - }; + data[i][j] = {i: i, j: j, iFn: iGetter, jFn: jGetter}; } } }) diff --git a/modules/benchpress/src/metric/perflog_metric.ts b/modules/benchpress/src/metric/perflog_metric.ts index 201c1bf8ed..1044a15fda 100644 --- a/modules/benchpress/src/metric/perflog_metric.ts +++ b/modules/benchpress/src/metric/perflog_metric.ts @@ -242,7 +242,7 @@ var _SET_TIMEOUT = new OpaqueToken('PerflogMetric.setTimeout'); var _BINDINGS = [ bind(PerflogMetric) .toFactory((driverExtension, setTimeout, microMetrics, forceGc) => - new PerflogMetric(driverExtension, setTimeout, microMetrics, forceGc), + new PerflogMetric(driverExtension, setTimeout, microMetrics, forceGc), [WebDriverExtension, _SET_TIMEOUT, Options.MICRO_METRICS, Options.FORCE_GC]), bind(_SET_TIMEOUT).toValue((fn, millis) => TimerWrapper.setTimeout(fn, millis)) ]; diff --git a/modules/benchpress/src/reporter/console_reporter.ts b/modules/benchpress/src/reporter/console_reporter.ts index e09b63ad61..323bd7eb3d 100644 --- a/modules/benchpress/src/reporter/console_reporter.ts +++ b/modules/benchpress/src/reporter/console_reporter.ts @@ -100,7 +100,7 @@ var _COLUMN_WIDTH = new OpaqueToken('ConsoleReporter.columnWidth'); var _BINDINGS = [ bind(ConsoleReporter) .toFactory((columnWidth, sampleDescription, print) => - new ConsoleReporter(columnWidth, sampleDescription, print), + new ConsoleReporter(columnWidth, sampleDescription, print), [_COLUMN_WIDTH, SampleDescription, _PRINT]), bind(_COLUMN_WIDTH).toValue(18), bind(_PRINT).toValue(print) diff --git a/modules/benchpress/src/reporter/json_file_reporter.ts b/modules/benchpress/src/reporter/json_file_reporter.ts index a544e0437b..ae704c1b90 100644 --- a/modules/benchpress/src/reporter/json_file_reporter.ts +++ b/modules/benchpress/src/reporter/json_file_reporter.ts @@ -52,7 +52,7 @@ var _PATH = new OpaqueToken('JsonFileReporter.path'); var _BINDINGS = [ bind(JsonFileReporter) .toFactory((sampleDescription, path, writeFile, now) => - new JsonFileReporter(sampleDescription, path, writeFile, now), + new JsonFileReporter(sampleDescription, path, writeFile, now), [SampleDescription, _PATH, Options.WRITE_FILE, Options.NOW]), bind(_PATH).toValue('.') ]; diff --git a/modules/benchpress/src/sample_description.ts b/modules/benchpress/src/sample_description.ts index d07ccc119a..13a4e1e871 100644 --- a/modules/benchpress/src/sample_description.ts +++ b/modules/benchpress/src/sample_description.ts @@ -26,13 +26,13 @@ export class SampleDescription { var _BINDINGS = [ bind(SampleDescription) .toFactory((metric, id, forceGc, userAgent, validator, defaultDesc, userDesc) => - new SampleDescription(id, [ - {'forceGc': forceGc, 'userAgent': userAgent}, - validator.describe(), - defaultDesc, - userDesc - ], - metric.describe()), + new SampleDescription(id, [ + {'forceGc': forceGc, 'userAgent': userAgent}, + validator.describe(), + defaultDesc, + userDesc + ], + metric.describe()), [ Metric, Options.SAMPLE_ID, diff --git a/modules/benchpress/test/metric/multi_metric_spec.ts b/modules/benchpress/test/metric/multi_metric_spec.ts index f412fdc22f..a4c9a390ff 100644 --- a/modules/benchpress/test/metric/multi_metric_spec.ts +++ b/modules/benchpress/test/metric/multi_metric_spec.ts @@ -72,9 +72,7 @@ class MockMetric extends Metric { endMeasure(restart: boolean): Promise> { var result = {}; - result[this._id] = { - 'restart': restart - }; + result[this._id] = {'restart': restart}; return PromiseWrapper.resolve(result); } diff --git a/modules/benchpress/test/reporter/console_reporter_spec.ts b/modules/benchpress/test/reporter/console_reporter_spec.ts index 53a5f4c405..e24f9c7c8a 100644 --- a/modules/benchpress/test/reporter/console_reporter_spec.ts +++ b/modules/benchpress/test/reporter/console_reporter_spec.ts @@ -18,9 +18,8 @@ export function main() { var reporter; var log; - function createReporter({columnWidth = null, sampleId = null, descriptions = null, metrics = null}:{ - columnWidth?, sampleId?, descriptions?, metrics? - }) { + function createReporter({columnWidth = null, sampleId = null, descriptions = null, + metrics = null}: {columnWidth?, sampleId?, descriptions?, metrics?}) { log = []; if (isBlank(descriptions)) { descriptions = []; diff --git a/modules/benchpress/test/reporter/json_file_reporter_spec.ts b/modules/benchpress/test/reporter/json_file_reporter_spec.ts index 3429963f12..97d0d6a357 100644 --- a/modules/benchpress/test/reporter/json_file_reporter_spec.ts +++ b/modules/benchpress/test/reporter/json_file_reporter_spec.ts @@ -31,10 +31,7 @@ export function main() { bind(Options.NOW).toValue(() => DateWrapper.fromMillis(1234)), bind(Options.WRITE_FILE) .toValue((filename, content) => { - loggedFile = { - 'filename': filename, - 'content': content - }; + loggedFile = {'filename': filename, 'content': content}; return PromiseWrapper.resolve(null); }) ]; diff --git a/modules/rtts_assert/src/rtts_assert.ts b/modules/rtts_assert/src/rtts_assert.ts index 1d5d882451..d23b5fa456 100644 --- a/modules/rtts_assert/src/rtts_assert.ts +++ b/modules/rtts_assert/src/rtts_assert.ts @@ -34,8 +34,7 @@ if (typeof _global['$traceurRuntime'] === 'object') { } Object.keys(primitives).forEach(function(name) { primitives[name].__assertName = name; }); -export function proxy() { -} +export function proxy() {} function assertArgumentTypes(...params) { var actual, type; diff --git a/tools/broccoli/broccoli-flatten.spec.ts b/tools/broccoli/broccoli-flatten.spec.ts index f44b36a60b..2281b59d52 100644 --- a/tools/broccoli/broccoli-flatten.spec.ts +++ b/tools/broccoli/broccoli-flatten.spec.ts @@ -9,9 +9,7 @@ import {DiffingFlatten} from './broccoli-flatten'; describe('Flatten', () => { afterEach(() => mockfs.restore()); - function flatten(inputPaths) { - return new DiffingFlatten(inputPaths, 'output', null); - } + function flatten(inputPaths) { return new DiffingFlatten(inputPaths, 'output', null); } function read(path) { return fs.readFileSync(path, {encoding: "utf-8"}); } function rm(path) { return fs.unlinkSync(path); } @@ -40,7 +38,7 @@ describe('Flatten', () => { expect(fs.readdirSync('output')).toEqual(['file-1.1.txt', 'file-1.txt', 'file-2.txt']); // fails due to a mock-fs bug related to reading symlinks? - //expect(read('output/file-1.1.txt')).toBe('file-1.1.txt content'); + // expect(read('output/file-1.1.txt')).toBe('file-1.1.txt content'); // delete a file @@ -59,9 +57,8 @@ describe('Flatten', () => { 'input': { 'dir1': { 'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)}), - 'subdir-1': { - 'file-1.txt': mockfs.file({content: 'file-1.1.txt content', mtime: new Date(1000)}) - }, + 'subdir-1': + {'file-1.txt': mockfs.file({content: 'file-1.1.txt content', mtime: new Date(1000)})}, 'empty-dir': {} }, }, @@ -71,7 +68,7 @@ describe('Flatten', () => { let differ = new TreeDiffer('testLabel', 'input'); let flattenedTree = flatten('input'); - expect(() => flattenedTree.rebuild(differ.diffTree())). - toThrowError("Duplicate file 'file-1.txt' found in path 'dir1/subdir-1/file-1.txt'"); + expect(() => flattenedTree.rebuild(differ.diffTree())) + .toThrowError("Duplicate file 'file-1.txt' found in path 'dir1/subdir-1/file-1.txt'"); }); }); diff --git a/tools/broccoli/broccoli-lodash.ts b/tools/broccoli/broccoli-lodash.ts index ce1ea3bb0d..849792f9dd 100644 --- a/tools/broccoli/broccoli-lodash.ts +++ b/tools/broccoli/broccoli-lodash.ts @@ -11,7 +11,11 @@ interface LodashRendererOptions { files?: string[]; } -const kDefaultOptions: LodashRendererOptions = {encoding: 'utf-8', context: {}, files: []}; +const kDefaultOptions: LodashRendererOptions = { + encoding: 'utf-8', + context: {}, + files: [] +}; /** diff --git a/tools/broccoli/broccoli-merge-trees.spec.ts b/tools/broccoli/broccoli-merge-trees.spec.ts index d29e640320..8e5f5a5d35 100644 --- a/tools/broccoli/broccoli-merge-trees.spec.ts +++ b/tools/broccoli/broccoli-merge-trees.spec.ts @@ -54,8 +54,8 @@ describe('MergeTrees', () => { mockfs(testDir); let treeDiffer = MakeTreeDiffers(['tree1', 'tree2', 'tree3']); let treeMerger = mergeTrees(['tree1', 'tree2', 'tree3'], 'dest', {}); - expect(() => treeMerger.rebuild(treeDiffer.diffTrees())). - toThrowError("`overwrite` option is required for handling duplicates."); + expect(() => treeMerger.rebuild(treeDiffer.diffTrees())) + .toThrowError("`overwrite` option is required for handling duplicates."); testDir = { 'tree1': {'foo.js': mockfs.file({content: 'tree1/foo.js content', mtime: new Date(1000)})}, @@ -81,7 +81,7 @@ describe('MergeTrees', () => { testDir.tree2['foo.js'] = mockfs.file({content: 'tree2/foo.js content', mtime: new Date(1000)}); mockfs(testDir); - expect(() => treeMerger.rebuild(treeDiffer.diffTrees())). - toThrowError("`overwrite` option is required for handling duplicates."); + expect(() => treeMerger.rebuild(treeDiffer.diffTrees())) + .toThrowError("`overwrite` option is required for handling duplicates."); }); }); diff --git a/tools/broccoli/broccoli-typescript.ts b/tools/broccoli/broccoli-typescript.ts index 7fcf04dcfc..70d4433a11 100644 --- a/tools/broccoli/broccoli-typescript.ts +++ b/tools/broccoli/broccoli-typescript.ts @@ -10,7 +10,9 @@ import {wrapDiffingPlugin, DiffingBroccoliPlugin, DiffResult} from './diffing-br type FileRegistry = ts.Map<{version: number}>; -const FS_OPTS = {encoding: 'utf-8'}; +const FS_OPTS = { + encoding: 'utf-8' +}; /** diff --git a/tools/broccoli/diffing-broccoli-plugin.ts b/tools/broccoli/diffing-broccoli-plugin.ts index a7762df712..ff2b69ae47 100644 --- a/tools/broccoli/diffing-broccoli-plugin.ts +++ b/tools/broccoli/diffing-broccoli-plugin.ts @@ -34,7 +34,7 @@ export interface DiffingBroccoliPlugin { type DiffingPluginWrapperFactory = (inputTrees: (BroccoliTree | BroccoliTree[]), options?) => - BroccoliTree; + BroccoliTree; class DiffingPluginWrapper implements BroccoliTree { diff --git a/tools/broccoli/tree-differ.spec.ts b/tools/broccoli/tree-differ.spec.ts index c698a1f4fe..1933e4a3f3 100644 --- a/tools/broccoli/tree-differ.spec.ts +++ b/tools/broccoli/tree-differ.spec.ts @@ -30,8 +30,7 @@ describe('TreeDiffer', () => { let diffResult = differ.diffTree(); - expect(diffResult.addedPaths) - .toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']); + expect(diffResult.addedPaths).toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']); expect(diffResult.changedPaths).toEqual([]); expect(diffResult.removedPaths).toEqual([]); @@ -83,8 +82,7 @@ describe('TreeDiffer', () => { let diffResult = differ.diffTree(); - expect(diffResult.addedPaths) - .toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']); + expect(diffResult.addedPaths).toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']); // change two files testDir['dir1']['file-1.txt'] = mockfs.file({content: 'new content', mtime: new Date(1000)}); @@ -129,8 +127,7 @@ describe('TreeDiffer', () => { let diffResult = differ.diffTree(); - expect(diffResult.addedPaths) - .toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']); + expect(diffResult.addedPaths).toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']); // change two files testDir['orig_path']['file-1.txt'] = @@ -257,8 +254,7 @@ describe('TreeDiffer', () => { let diffResult = differ.diffTree(); - expect(diffResult.addedPaths) - .toEqual(['file-1.cs', 'file-1.ts', 'file-1d.cs', 'file-3.ts']); + expect(diffResult.addedPaths).toEqual(['file-1.cs', 'file-1.ts', 'file-1d.cs', 'file-3.ts']); // change two files testDir['dir1']['file-1.ts'] = mockfs.file({content: 'new content', mtime: new Date(1000)}); diff --git a/tools/broccoli/trees/browser_tree.ts b/tools/broccoli/trees/browser_tree.ts index fba937b095..ccb39fe28c 100644 --- a/tools/broccoli/trees/browser_tree.ts +++ b/tools/broccoli/trees/browser_tree.ts @@ -133,10 +133,7 @@ module.exports = function makeBrowserTree(options, destinationPath) { // Get scripts for each benchmark or example let servingTrees = kServedPaths.reduce(getServedFunnels, []); function getServedFunnels(funnels, destDir) { - let options = { - srcDir: '/', - destDir: destDir - }; + let options = {srcDir: '/', destDir: destDir}; funnels.push(new Funnel(vendorScriptsTree, options)); if (destDir.indexOf('benchmarks') > -1) { funnels.push(new Funnel(vendorScripts_benchmark, options));