feat: adjust formatting for clang-format v1.0.19.

This commit is contained in:
Martin Probst 2015-06-12 07:50:45 -07:00
parent 1c2abbc61d
commit a6e7123995
50 changed files with 363 additions and 350 deletions

View File

@ -1,12 +1,6 @@
export class Test {
firstItem;
constructor() {
this.doStuff();
}
otherMethod() {
}
doStuff() {
}
constructor() { this.doStuff(); }
otherMethod() {}
doStuff() {}
}

View File

@ -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;
export var myFn = (val: number) => return val * 2;

View File

@ -45,9 +45,9 @@ function _selfRecord(r: ProtoRecord, contextIndex: number, selfIndex: number): P
function _findMatching(r: ProtoRecord, rs: List<ProtoRecord>) {
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<any, any>) {

View File

@ -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 {

View File

@ -101,7 +101,7 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
[NgZone]),
bind(ShadowDomStrategy)
.toFactory((styleUrlResolver, doc) =>
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
[StyleUrlResolver, DOCUMENT_TOKEN]),
DomRenderer,
DefaultDomCompiler,

View File

@ -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<DirectiveBinding>): Map<String, number> {
export function createDirectiveVariableBindings(
renderElementBinder: renderApi.ElementBinder,
directiveBindings: List<DirectiveBinding>): Map<String, number> {
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;

View File

@ -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)

View File

@ -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;
}

View File

@ -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}

View File

@ -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;

View File

@ -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,

View File

@ -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 = <any>(typeof window === 'undefined' ? global : window);

View File

@ -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(

View File

@ -89,9 +89,12 @@ export class TestDefinition {
*/
export function getAllDefinitions(): List<TestDefinition> {
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));
}

View File

@ -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;

View File

@ -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', () => {

View File

@ -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" + "}";

View File

@ -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()
],

View File

@ -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;

View File

@ -29,7 +29,7 @@ export function main() {
inject([TestBed, AsyncTestCompleter], (tb, async) => {
var template = '<div text="1"></div>' +
'<needs-query text="2"><div text="3">' +
'<div text="too-deep"></div>' +
'<div text="too-deep"></div>' +
'</div></needs-query>' +
'<div text="4"></div>';
@ -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 = '<div text="1"></div>' +
'<needs-query-desc text="2"><div text="3">' +
'<div text="4"></div>' +
'</div></needs-query-desc>' +
'<div text="5"></div>';
inject([TestBed, AsyncTestCompleter], (tb, async) => {
var template = '<div text="1"></div>' +
'<needs-query-desc text="2"><div text="3">' +
'<div text="4"></div>' +
'</div></needs-query-desc>' +
'<div text="5"></div>';
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 = '<div text="1"></div>' +
'<needs-query text="2"><div text="3"></div></needs-query>' +
'<div text="4"></div>';
inject([TestBed, AsyncTestCompleter], (tb, async) => {
var template = '<div text="1"></div>' +
'<needs-query text="2"><div text="3"></div></needs-query>' +
'<div text="4"></div>';
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<TextDirective>;
constructor(@Query(TextDirective, {descendants: true}) query: QueryList<TextDirective>) { this.query = query; }
constructor(@Query(TextDirective, {descendants: true}) query: QueryList<TextDirective>) {
this.query = query;
}
}
@Component({selector: 'my-comp'})

View File

@ -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';

View File

@ -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);
}));

View File

@ -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');

View File

@ -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', () => {

View File

@ -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<any>;
constructor() {
this.args = [];
}
constructor() { this.args = []; }
}
class TestObjWith01Args {
args: List<any>;
constructor(a1) {
this.args = [a1];
}
constructor(a1) { this.args = [a1]; }
}
class TestObjWith02Args {
args: List<any>;
constructor(a1, a2) {
this.args = [a1, a2];
}
constructor(a1, a2) { this.args = [a1, a2]; }
}
class TestObjWith03Args {
args: List<any>;
constructor(a1, a2, a3) {
this.args = [a1, a2, a3];
}
constructor(a1, a2, a3) { this.args = [a1, a2, a3]; }
}
class TestObjWith04Args {
args: List<any>;
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<any>;
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<any>;
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<any>;
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<any>;
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<any>;
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<any>;
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<any>;
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
];
}
}

View File

@ -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]',

View File

@ -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);
}
})
]);

View File

@ -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']);

View File

@ -75,8 +75,9 @@ export function main() {
tb.compileAll([
someComponent,
new ViewDefinition({
componentId: 'someComponent', template: '<some-comp> <!-- comment -->\n </some-comp>',
directives: [someComponent]
componentId: 'someComponent',
template: '<some-comp> <!-- comment -->\n </some-comp>',
directives: [someComponent]
})
])
.then((protoViewDtos) => {

View File

@ -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('<div><style>@import "one.css";</style></div>');
var styleElement = DOM.firstChild(compileElement);
var stylePromise = strategy.processStyleElement('someComponent', 'http://base', styleElement);
var compileElement = el('<div><style>@import "one.css";</style></div>');
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('<div><style>.one {}</style></div>');

View File

@ -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});

View File

@ -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('<some-ce></some-ce>');
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('<some-ce></some-ce>');
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('<some-ce></some-ce>');
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('<some-ce></some-ce>');
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');
}
});
}
});

View File

@ -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);
});

View File

@ -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 {}

View File

@ -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};
}
}
})

View File

@ -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))
];

View File

@ -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)

View File

@ -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('.')
];

View File

@ -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,

View File

@ -72,9 +72,7 @@ class MockMetric extends Metric {
endMeasure(restart: boolean): Promise<StringMap<string, any>> {
var result = {};
result[this._id] = {
'restart': restart
};
result[this._id] = {'restart': restart};
return PromiseWrapper.resolve(result);
}

View File

@ -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 = [];

View File

@ -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);
})
];

View File

@ -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;

View File

@ -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'");
});
});

View File

@ -11,7 +11,11 @@ interface LodashRendererOptions {
files?: string[];
}
const kDefaultOptions: LodashRendererOptions = {encoding: 'utf-8', context: {}, files: []};
const kDefaultOptions: LodashRendererOptions = {
encoding: 'utf-8',
context: {},
files: []
};
/**

View File

@ -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.");
});
});

View File

@ -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'
};
/**

View File

@ -34,7 +34,7 @@ export interface DiffingBroccoliPlugin {
type DiffingPluginWrapperFactory = (inputTrees: (BroccoliTree | BroccoliTree[]), options?) =>
BroccoliTree;
BroccoliTree;
class DiffingPluginWrapper implements BroccoliTree {

View File

@ -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)});

View File

@ -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));