Skip to content

Commit 920982c

Browse files
committed
chore: update files to match clang-format 1.0.21.
1 parent 254e58c commit 920982c

File tree

14 files changed

+380
-334
lines changed

14 files changed

+380
-334
lines changed

modules/angular2/src/change_detection/parser/lexer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ enum TokenType {
1717
NUMBER
1818
}
1919

20-
@Injectable() export class Lexer {
20+
@Injectable()
21+
export class Lexer {
2122
tokenize(text: string): List<any> {
2223
var scanner = new _Scanner(text);
2324
var tokens = [];

modules/angular2/src/facade/lang.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ export function assertionsEnabled(): boolean {
2828
// TODO: remove calls to assert in production environment
2929
// Note: Can't just export this and import in in other files
3030
// as `assert` is a reserved keyword in Dart
31-
_global.assert =
32-
function assert(condition) {
33-
if (assertionsEnabled_) {
34-
_global['assert'].call(condition);
35-
}
36-
}
31+
_global.assert = function assert(condition) {
32+
if (assertionsEnabled_) {
33+
_global['assert'].call(condition);
34+
}
35+
};
3736
// This function is needed only to properly support Dart's const expressions
3837
// see https://github.com/angular/ts2dart/pull/151 for more info
3938
export function CONST_EXPR<T>(expr: T): T {

modules/angular2/src/http/enums.ts

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
1+
export enum RequestModesOpts {
2+
Cors,
3+
NoCors,
4+
SameOrigin
5+
}
16

2-
export enum RequestModesOpts {Cors, NoCors, SameOrigin};
7+
export enum RequestCacheOpts {
8+
Default,
9+
NoStore,
10+
Reload,
11+
NoCache,
12+
ForceCache,
13+
OnlyIfCached
14+
}
315

4-
export enum RequestCacheOpts {Default, NoStore, Reload, NoCache, ForceCache, OnlyIfCached};
16+
export enum RequestCredentialsOpts {
17+
Omit,
18+
SameOrigin,
19+
Include
20+
}
521

6-
export enum RequestCredentialsOpts {Omit, SameOrigin, Include};
22+
export enum RequestMethods {
23+
GET,
24+
POST,
25+
PUT,
26+
DELETE,
27+
OPTIONS,
28+
HEAD,
29+
PATCH
30+
}
731

8-
export enum RequestMethods {GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH};
32+
export enum ReadyStates {
33+
UNSENT,
34+
OPEN,
35+
HEADERS_RECEIVED,
36+
LOADING,
37+
DONE,
38+
CANCELLED
39+
}
940

10-
export enum ReadyStates {UNSENT, OPEN, HEADERS_RECEIVED, LOADING, DONE, CANCELLED};
11-
12-
export enum ResponseTypes {Basic, Cors, Default, Error, Opaque}
41+
export enum ResponseTypes {
42+
Basic,
43+
Cors,
44+
Default,
45+
Error,
46+
Opaque
47+
}

modules/angular2/src/test_lib/test_lib.ts

Lines changed: 76 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -172,103 +172,97 @@ export function iit(name, fn) {
172172
// gives us bad error messages in tests.
173173
// The only way to do this in Jasmine is to monkey patch a method
174174
// to the object :-(
175-
Map.prototype['jasmineToString'] =
176-
function() {
177-
var m = this;
178-
if (!m) {
179-
return '' + m;
180-
}
181-
var res = [];
182-
m.forEach((v, k) => { res.push(`${k}:${v}`); });
183-
return `{ ${res.join(',')} }`;
184-
}
185-
186-
_global.beforeEach(function() {
187-
jasmine.addMatchers({
188-
// Custom handler for Map as Jasmine does not support it yet
189-
toEqual: function(util, customEqualityTesters) {
190-
return {
191-
compare: function(actual, expected) {
192-
return {pass: util.equals(actual, expected, [compareMap])};
193-
}
194-
};
175+
Map.prototype['jasmineToString'] = function() {
176+
var m = this;
177+
if (!m) {
178+
return '' + m;
179+
}
180+
var res = [];
181+
m.forEach((v, k) => { res.push(`${k}:${v}`); });
182+
return `{ ${res.join(',')} }`;
183+
};
184+
185+
_global.beforeEach(function() {
186+
jasmine.addMatchers({
187+
// Custom handler for Map as Jasmine does not support it yet
188+
toEqual: function(util, customEqualityTesters) {
189+
return {
190+
compare: function(actual, expected) {
191+
return {pass: util.equals(actual, expected, [compareMap])};
192+
}
193+
};
195194

196-
function compareMap(actual, expected) {
197-
if (actual instanceof Map) {
198-
var pass = actual.size === expected.size;
199-
if (pass) {
200-
actual.forEach((v, k) => { pass = pass && util.equals(v, expected.get(k)); });
201-
}
202-
return pass;
203-
} else {
204-
return undefined;
205-
}
195+
function compareMap(actual, expected) {
196+
if (actual instanceof Map) {
197+
var pass = actual.size === expected.size;
198+
if (pass) {
199+
actual.forEach((v, k) => { pass = pass && util.equals(v, expected.get(k)); });
206200
}
207-
},
201+
return pass;
202+
} else {
203+
return undefined;
204+
}
205+
}
206+
},
208207

209-
toBePromise: function() {
210-
return {
211-
compare: function(actual, expectedClass) {
212-
var pass = typeof actual === 'object' && typeof actual.then === 'function';
213-
return {
214-
pass: pass,
215-
get message() { return 'Expected ' + actual + ' to be a promise'; }
216-
};
217-
}
218-
};
219-
},
208+
toBePromise: function() {
209+
return {
210+
compare: function(actual, expectedClass) {
211+
var pass = typeof actual === 'object' && typeof actual.then === 'function';
212+
return {pass: pass, get message() { return 'Expected ' + actual + ' to be a promise'; }};
213+
}
214+
};
215+
},
220216

221-
toBeAnInstanceOf: function() {
217+
toBeAnInstanceOf: function() {
218+
return {
219+
compare: function(actual, expectedClass) {
220+
var pass = typeof actual === 'object' && actual instanceof expectedClass;
222221
return {
223-
compare: function(actual, expectedClass) {
224-
var pass = typeof actual === 'object' && actual instanceof expectedClass;
225-
return {
226-
pass: pass,
227-
get message() {
228-
return 'Expected ' + actual + ' to be an instance of ' + expectedClass;
229-
}
230-
};
222+
pass: pass,
223+
get message() {
224+
return 'Expected ' + actual + ' to be an instance of ' + expectedClass;
231225
}
232226
};
233-
},
227+
}
228+
};
229+
},
234230

235-
toHaveText: function() {
231+
toHaveText: function() {
232+
return {
233+
compare: function(actual, expectedText) {
234+
var actualText = elementText(actual);
236235
return {
237-
compare: function(actual, expectedText) {
238-
var actualText = elementText(actual);
239-
return {
240-
pass: actualText == expectedText,
241-
get message() {
242-
return 'Expected ' + actualText + ' to be equal to ' + expectedText;
243-
}
244-
};
245-
}
236+
pass: actualText == expectedText,
237+
get message() { return 'Expected ' + actualText + ' to be equal to ' + expectedText; }
246238
};
247-
},
239+
}
240+
};
241+
},
242+
243+
toImplement: function() {
244+
return {
245+
compare: function(actualObject, expectedInterface) {
246+
var objProps = Object.keys(actualObject.constructor.prototype);
247+
var intProps = Object.keys(expectedInterface.prototype);
248+
249+
var missedMethods = [];
250+
intProps.forEach((k) => {
251+
if (!actualObject.constructor.prototype[k]) missedMethods.push(k);
252+
});
248253

249-
toImplement: function() {
250254
return {
251-
compare: function(actualObject, expectedInterface) {
252-
var objProps = Object.keys(actualObject.constructor.prototype);
253-
var intProps = Object.keys(expectedInterface.prototype);
254-
255-
var missedMethods = [];
256-
intProps.forEach((k) => {
257-
if (!actualObject.constructor.prototype[k]) missedMethods.push(k);
258-
});
259-
260-
return {
261-
pass: missedMethods.length == 0,
262-
get message() {
263-
return 'Expected ' + actualObject + ' to have the following methods: ' +
264-
missedMethods.join(", ");
265-
}
266-
};
255+
pass: missedMethods.length == 0,
256+
get message() {
257+
return 'Expected ' + actualObject + ' to have the following methods: ' +
258+
missedMethods.join(", ");
267259
}
268260
};
269261
}
270-
});
271-
});
262+
};
263+
}
264+
});
265+
});
272266

273267
export interface GuinessCompatibleSpy extends jasmine.Spy {
274268
/** By chaining the spy with and.returnValue, all calls to the function will return a specific

modules/angular2/test/change_detection/change_detector_config.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,20 @@ class _DirectiveUpdating {
237237
'noCallbacks': new _DirectiveUpdating(
238238
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
239239
[_DirectiveUpdating.recordNoCallbacks]),
240-
'readingDirectives': new _DirectiveUpdating([
241-
BindingRecord.createForHostProperty(new DirectiveIndex(0, 0),
242-
_getParser().parseBinding('a', 'location'), PROP_NAME)
243-
],
244-
[_DirectiveUpdating.basicRecords[0]]),
245-
'interpolation': new _DirectiveUpdating([
246-
BindingRecord.createForElement(_getParser().parseInterpolation('B{{a}}A', 'location'), 0,
247-
PROP_NAME)
248-
],
249-
[])
240+
'readingDirectives':
241+
new _DirectiveUpdating(
242+
[
243+
BindingRecord.createForHostProperty(
244+
new DirectiveIndex(0, 0), _getParser().parseBinding('a', 'location'), PROP_NAME)
245+
],
246+
[_DirectiveUpdating.basicRecords[0]]),
247+
'interpolation':
248+
new _DirectiveUpdating(
249+
[
250+
BindingRecord.createForElement(_getParser().parseInterpolation('B{{a}}A', 'location'),
251+
0, PROP_NAME)
252+
],
253+
[])
250254
};
251255
}
252256

modules/angular2/test/core/compiler/compiler_spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,12 @@ export function main() {
317317
var mainProtoView =
318318
createProtoView([createComponentElementBinder(directiveResolver, NestedComponent)]);
319319
var nestedProtoView = createProtoView();
320-
var compiler = createCompiler([
321-
createRenderProtoView([createRenderComponentElementBinder(0)]),
322-
createRenderProtoView()
323-
],
324-
[[rootProtoView], [mainProtoView], [nestedProtoView]]);
320+
var compiler = createCompiler(
321+
[
322+
createRenderProtoView([createRenderComponentElementBinder(0)]),
323+
createRenderProtoView()
324+
],
325+
[[rootProtoView], [mainProtoView], [nestedProtoView]]);
325326
compiler.compileInHost(MainComponent)
326327
.then((protoViewRef) => {
327328
expect(internalProtoView(protoViewRef).elementBinders[0].nestedProtoView)

modules/benchmarks/e2e_test/naive_infinite_scroll_spec.ts

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,22 @@ describe('ng2 naive infinite scroll benchmark', function() {
1414
var cells = `${ allScrollItems } .row *`;
1515
var stageButtons = `${ allScrollItems } .row stage-buttons button`;
1616

17-
var count =
18-
function(selector) {
19-
return browser.executeScript(`return ` +
20-
`document.querySelectorAll("${ selector }").length;`);
21-
}
22-
23-
var clickFirstOf =
24-
function(selector) {
25-
return browser.executeScript(`document.querySelector("${ selector }").click();`);
26-
}
27-
28-
var firstTextOf =
29-
function(selector) {
30-
return browser.executeScript(`return ` +
31-
`document.querySelector("${ selector }").innerText;`);
32-
}
33-
34-
// Make sure rows are rendered
35-
count(allScrollItems)
36-
.then(function(c) { expect(c).toEqual(expectedRowCount); });
17+
var count = function(selector) {
18+
return browser.executeScript(`return ` +
19+
`document.querySelectorAll("${ selector }").length;`);
20+
};
21+
22+
var clickFirstOf = function(selector) {
23+
return browser.executeScript(`document.querySelector("${ selector }").click();`);
24+
};
25+
26+
var firstTextOf = function(selector) {
27+
return browser.executeScript(`return ` +
28+
`document.querySelector("${ selector }").innerText;`);
29+
};
30+
31+
// Make sure rows are rendered
32+
count(allScrollItems).then(function(c) { expect(c).toEqual(expectedRowCount); });
3733

3834
// Make sure cells are rendered
3935
count(cells).then(function(c) { expect(c).toEqual(expectedRowCount * expectedCellsPerRow); });
@@ -47,10 +43,9 @@ describe('ng2 naive infinite scroll benchmark', function() {
4743
firstTextOf(`${ stageButtons }:enabled`)
4844
.then(function(text) { expect(text).toEqual('Won'); })
4945
});
50-
})
46+
});
5147

52-
$("#reset-btn")
53-
.click();
48+
$("#reset-btn").click();
5449
$("#run-btn").click();
5550
browser.wait(() => {
5651
return $('#done').getText().then(function() { return true; }, function() { return false; });

0 commit comments

Comments
 (0)