feat: adjust formatting for clang-format v1.0.19.
This commit is contained in:
parent
1c2abbc61d
commit
a6e7123995
|
@ -1,12 +1,6 @@
|
||||||
export class Test {
|
export class Test {
|
||||||
firstItem;
|
firstItem;
|
||||||
constructor() {
|
constructor() { this.doStuff(); }
|
||||||
this.doStuff();
|
otherMethod() {}
|
||||||
}
|
doStuff() {}
|
||||||
otherMethod() {
|
|
||||||
|
|
||||||
}
|
|
||||||
doStuff() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -20,16 +20,12 @@ export class MyClass {
|
||||||
* Create a new MyClass
|
* Create a new MyClass
|
||||||
* @param {String} name The name to say hello to
|
* @param {String} name The name to say hello to
|
||||||
*/
|
*/
|
||||||
constructor(name) {
|
constructor(name) { this.message = 'hello ' + name; }
|
||||||
this.message = 'hello ' + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a greeting message
|
* Return a greeting message
|
||||||
*/
|
*/
|
||||||
greet() {
|
greet() { return this.message; }
|
||||||
return this.message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,8 +3,20 @@ import {BindingRecord} from './binding_record';
|
||||||
import {DirectiveIndex} from './directive_record';
|
import {DirectiveIndex} from './directive_record';
|
||||||
|
|
||||||
export enum RecordType {
|
export enum RecordType {
|
||||||
SELF, CONST, PRIMITIVE_OP, PROPERTY, LOCAL, INVOKE_METHOD, INVOKE_CLOSURE, KEYED_ACCESS, PIPE,
|
SELF,
|
||||||
BINDING_PIPE, INTERPOLATE, SAFE_PROPERTY, SAFE_INVOKE_METHOD, DIRECTIVE_LIFECYCLE
|
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 {
|
export class ProtoRecord {
|
||||||
|
|
|
@ -348,15 +348,18 @@ function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderE
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createElementBinder(protoView, boundElementIndex, renderElementBinder,
|
function _createElementBinder(protoView, boundElementIndex, renderElementBinder,
|
||||||
protoElementInjector, componentDirectiveBinding, directiveBindings): ElementBinder {
|
protoElementInjector, componentDirectiveBinding,
|
||||||
|
directiveBindings): ElementBinder {
|
||||||
var parent = null;
|
var parent = null;
|
||||||
if (renderElementBinder.parentIndex !== -1) {
|
if (renderElementBinder.parentIndex !== -1) {
|
||||||
parent = protoView.elementBinders[renderElementBinder.parentIndex];
|
parent = protoView.elementBinders[renderElementBinder.parentIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings);
|
var directiveVariableBindings =
|
||||||
var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent,
|
createDirectiveVariableBindings(renderElementBinder, directiveBindings);
|
||||||
protoElementInjector, directiveVariableBindings, componentDirectiveBinding);
|
var elBinder =
|
||||||
|
protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector,
|
||||||
|
directiveVariableBindings, componentDirectiveBinding);
|
||||||
protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1);
|
protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1);
|
||||||
// variables
|
// variables
|
||||||
// The view's locals needs to have a full set of variable names at construction time
|
// The view's locals needs to have a full set of variable names at construction time
|
||||||
|
@ -369,7 +372,8 @@ function _createElementBinder(protoView, boundElementIndex, renderElementBinder,
|
||||||
return elBinder;
|
return elBinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createDirectiveVariableBindings(renderElementBinder:renderApi.ElementBinder,
|
export function createDirectiveVariableBindings(
|
||||||
|
renderElementBinder: renderApi.ElementBinder,
|
||||||
directiveBindings: List<DirectiveBinding>): Map<String, number> {
|
directiveBindings: List<DirectiveBinding>): Map<String, number> {
|
||||||
var directiveVariableBindings = MapWrapper.create();
|
var directiveVariableBindings = MapWrapper.create();
|
||||||
MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => {
|
MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => {
|
||||||
|
@ -388,7 +392,8 @@ function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, e
|
||||||
|
|
||||||
if (_directiveExportAs(directive) == exportAs) {
|
if (_directiveExportAs(directive) == exportAs) {
|
||||||
if (isPresent(matchedDirective)) {
|
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;
|
matchedDirectiveIndex = i;
|
||||||
|
@ -405,7 +410,8 @@ function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, e
|
||||||
|
|
||||||
function _directiveExportAs(directive): string {
|
function _directiveExportAs(directive): string {
|
||||||
var directiveExportAs = directive.metadata.exportAs;
|
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";
|
return "$implicit";
|
||||||
} else {
|
} else {
|
||||||
return directiveExportAs;
|
return directiveExportAs;
|
||||||
|
|
|
@ -143,9 +143,7 @@ export class NgZone {
|
||||||
errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone,
|
errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone,
|
||||||
{onError: function(e) { ngZone._onError(this, e) }});
|
{onError: function(e) { ngZone._onError(this, e) }});
|
||||||
} else {
|
} else {
|
||||||
errorHandling = {
|
errorHandling = {onError: function(e) { ngZone._onError(this, e) }};
|
||||||
onError: function(e) { ngZone._onError(this, e) }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return zone.fork(errorHandling)
|
return zone.fork(errorHandling)
|
||||||
|
|
|
@ -11,8 +11,7 @@ import {createTestInjector, FunctionWithParamTokens, inject} from './test_inject
|
||||||
|
|
||||||
export {inject} from './test_injector';
|
export {inject} from './test_injector';
|
||||||
|
|
||||||
export function proxy() {
|
export function proxy() {}
|
||||||
}
|
|
||||||
|
|
||||||
var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
|
var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,8 @@ export function el(html: string) {
|
||||||
return DOM.firstChild(DOM.content(DOM.createTemplate(html)));
|
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('\\')}]`);
|
var _ESCAPE_RE = RegExpWrapper.create(`[\\${_RE_SPECIAL_CHARS.join('\\')}]`);
|
||||||
export function containsRegexp(input: string): RegExp {
|
export function containsRegexp(input: string): RegExp {
|
||||||
return RegExpWrapper.create(
|
return RegExpWrapper.create(
|
||||||
|
|
|
@ -89,9 +89,12 @@ export class TestDefinition {
|
||||||
*/
|
*/
|
||||||
export function getAllDefinitions(): List<TestDefinition> {
|
export function getAllDefinitions(): List<TestDefinition> {
|
||||||
var allDefs = _availableDefinitions;
|
var allDefs = _availableDefinitions;
|
||||||
allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithLocals.availableDefinitions));
|
allDefs = ListWrapper.concat(allDefs,
|
||||||
allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithMode.availableDefinitions));
|
StringMapWrapper.keys(_ExpressionWithLocals.availableDefinitions));
|
||||||
allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_DirectiveUpdating.availableDefinitions));
|
allDefs =
|
||||||
|
ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithMode.availableDefinitions));
|
||||||
|
allDefs =
|
||||||
|
ListWrapper.concat(allDefs, StringMapWrapper.keys(_DirectiveUpdating.availableDefinitions));
|
||||||
return ListWrapper.map(allDefs, (id) => getDefinition(id));
|
return ListWrapper.map(allDefs, (id) => getDefinition(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,8 @@ export function main() {
|
||||||
function _createWithoutHydrate(expression: string) {
|
function _createWithoutHydrate(expression: string) {
|
||||||
var dispatcher = new TestDispatcher();
|
var dispatcher = new TestDispatcher();
|
||||||
var registry = null;
|
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);
|
return new _ChangeDetectorAndDispatcher(cd, dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +335,8 @@ export function main() {
|
||||||
|
|
||||||
it('should happen directly, without invoking the dispatcher', () => {
|
it('should happen directly, without invoking the dispatcher', () => {
|
||||||
var val = _createWithoutHydrate('directNoDispatcher');
|
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();
|
val.changeDetector.detectChanges();
|
||||||
expect(val.dispatcher.loggedValues).toEqual([]);
|
expect(val.dispatcher.loggedValues).toEqual([]);
|
||||||
expect(directive1.a).toEqual(42);
|
expect(directive1.a).toEqual(42);
|
||||||
|
@ -465,11 +467,11 @@ export function main() {
|
||||||
var orderOfOperations = [];
|
var orderOfOperations = [];
|
||||||
|
|
||||||
var directiveInShadowDom = null;
|
var directiveInShadowDom = null;
|
||||||
directiveInShadowDom =
|
directiveInShadowDom = new TestDirective(
|
||||||
new TestDirective(() => { ListWrapper.push(orderOfOperations, directiveInShadowDom); });
|
() => { ListWrapper.push(orderOfOperations, directiveInShadowDom); });
|
||||||
var parentDirective = null;
|
var parentDirective = null;
|
||||||
parentDirective =
|
parentDirective = new TestDirective(
|
||||||
new TestDirective(() => { ListWrapper.push(orderOfOperations, parentDirective); });
|
() => { ListWrapper.push(orderOfOperations, parentDirective); });
|
||||||
|
|
||||||
parent.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([parentDirective], []));
|
parent.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([parentDirective], []));
|
||||||
child.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directiveInShadowDom], []));
|
child.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directiveInShadowDom], []));
|
||||||
|
@ -594,8 +596,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('mode', () => {
|
describe('mode', () => {
|
||||||
it('should set the mode to CHECK_ALWAYS when the default change detection is used',
|
it('should set the mode to CHECK_ALWAYS when the default change detection is used', () => {
|
||||||
() => {
|
|
||||||
var cd = _createWithoutHydrate('emptyUsingDefaultStrategy').changeDetector;
|
var cd = _createWithoutHydrate('emptyUsingDefaultStrategy').changeDetector;
|
||||||
expect(cd.mode).toEqual(null);
|
expect(cd.mode).toEqual(null);
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,7 @@ export function main() {
|
||||||
function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
|
function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
inceptionObj = {
|
inceptionObj = {dream: {dream: {dream: 'Limbo'}}};
|
||||||
dream: {dream: {dream: 'Limbo'}}
|
|
||||||
};
|
|
||||||
inceptionObjString = "{\n" + " \"dream\": {\n" + " \"dream\": {\n" +
|
inceptionObjString = "{\n" + " \"dream\": {\n" + " \"dream\": {\n" +
|
||||||
" \"dream\": \"Limbo\"\n" + " }\n" + " }\n" + "}";
|
" \"dream\": \"Limbo\"\n" + " }\n" + " }\n" + "}";
|
||||||
|
|
||||||
|
|
|
@ -315,9 +315,8 @@ export function main() {
|
||||||
var nestedProtoView = createProtoView();
|
var nestedProtoView = createProtoView();
|
||||||
var compiler = createCompiler([
|
var compiler = createCompiler([
|
||||||
createRenderProtoView([
|
createRenderProtoView([
|
||||||
createRenderViewportElementBinder(
|
createRenderViewportElementBinder(createRenderProtoView(
|
||||||
createRenderProtoView([createRenderComponentElementBinder(0)],
|
[createRenderComponentElementBinder(0)], renderApi.ViewType.EMBEDDED))
|
||||||
renderApi.ViewType.EMBEDDED))
|
|
||||||
]),
|
]),
|
||||||
createRenderProtoView()
|
createRenderProtoView()
|
||||||
],
|
],
|
||||||
|
|
|
@ -1488,8 +1488,7 @@ class DirectiveListeningDomEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
var globalCounter = 0;
|
var globalCounter = 0;
|
||||||
@Directive(
|
@Directive({selector: '[listenerother]', host: {'(window:domEvent)': 'onEvent($event.type)'}})
|
||||||
{selector: '[listenerother]', host: {'(window:domEvent)': 'onEvent($event.type)'}})
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class DirectiveListeningDomEventOther {
|
class DirectiveListeningDomEventOther {
|
||||||
eventType: string;
|
eventType: string;
|
||||||
|
|
|
@ -142,7 +142,9 @@ class NeedsQuery {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class NeedsQueryDesc {
|
class NeedsQueryDesc {
|
||||||
query: QueryList<TextDirective>;
|
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'})
|
@Component({selector: 'my-comp'})
|
||||||
|
|
|
@ -205,21 +205,15 @@ function commonTests() {
|
||||||
_zone.initCallbacks({
|
_zone.initCallbacks({
|
||||||
onTurnDone: () => {
|
onTurnDone: () => {
|
||||||
_log.add('onTurnDone:started');
|
_log.add('onTurnDone:started');
|
||||||
_zone.run(() => _log.add('nested run'))
|
_zone.run(() => _log.add('nested run')) _log.add('onTurnDone:finished');
|
||||||
_log.add('onTurnDone:finished');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
macroTask(() => {
|
macroTask(() => { _zone.run(() => { _log.add('start run'); }); });
|
||||||
_zone.run(() => {
|
|
||||||
_log.add('start run');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
macroTask(() => {
|
macroTask(() => {
|
||||||
expect(_log.result())
|
expect(_log.result())
|
||||||
.toEqual(
|
.toEqual('start run; onTurnDone:started; nested run; onTurnDone:finished');
|
||||||
'start run; onTurnDone:started; nested run; onTurnDone:finished');
|
|
||||||
async.done();
|
async.done();
|
||||||
}, 50);
|
}, 50);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -92,10 +92,7 @@ export function main() {
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
expect(view.rootNodes[0].className).toEqual('ng-binding foo');
|
expect(view.rootNodes[0].className).toEqual('ng-binding foo');
|
||||||
|
|
||||||
view.context.expr = {
|
view.context.expr = {'foo': false, 'bar': true};
|
||||||
'foo': false,
|
|
||||||
'bar': true
|
|
||||||
};
|
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
expect(view.rootNodes[0].className).toEqual('ng-binding bar');
|
expect(view.rootNodes[0].className).toEqual('ng-binding bar');
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ export function main() {
|
||||||
var baseResponse;
|
var baseResponse;
|
||||||
var sampleObserver;
|
var sampleObserver;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = Injector.resolveAndCreate([MockBackend, bind(Http).toFactory(HttpFactory, [MockBackend])]);
|
injector = Injector.resolveAndCreate(
|
||||||
|
[MockBackend, bind(Http).toFactory(HttpFactory, [MockBackend])]);
|
||||||
http = injector.get(Http);
|
http = injector.get(Http);
|
||||||
backend = injector.get(MockBackend);
|
backend = injector.get(MockBackend);
|
||||||
baseResponse = new Response('base response');
|
baseResponse = new Response('base response');
|
||||||
|
|
|
@ -84,10 +84,8 @@ export function main() {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw when more than 20 arguments", () => {
|
it("should throw when more than 20 arguments",
|
||||||
expect(() => reflector.factory(TestObjWith21Args))
|
() => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); });
|
||||||
.toThrowError();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return a registered factory if available", () => {
|
it("should return a registered factory if available", () => {
|
||||||
reflector.registerType(TestObj, {"factory": () => "fake"});
|
reflector.registerType(TestObj, {"factory": () => "fake"});
|
||||||
|
@ -195,65 +193,47 @@ export function main() {
|
||||||
|
|
||||||
class TestObjWith00Args {
|
class TestObjWith00Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor() {
|
constructor() { this.args = []; }
|
||||||
this.args = [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith01Args {
|
class TestObjWith01Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1) {
|
constructor(a1) { this.args = [a1]; }
|
||||||
this.args = [a1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith02Args {
|
class TestObjWith02Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1, a2) {
|
constructor(a1, a2) { this.args = [a1, a2]; }
|
||||||
this.args = [a1, a2];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith03Args {
|
class TestObjWith03Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1, a2, a3) {
|
constructor(a1, a2, a3) { this.args = [a1, a2, a3]; }
|
||||||
this.args = [a1, a2, a3];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith04Args {
|
class TestObjWith04Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1, a2, a3, a4) {
|
constructor(a1, a2, a3, a4) { this.args = [a1, a2, a3, a4]; }
|
||||||
this.args = [a1, a2, a3, a4];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith05Args {
|
class TestObjWith05Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1, a2, a3, a4, a5) {
|
constructor(a1, a2, a3, a4, a5) { this.args = [a1, a2, a3, a4, a5]; }
|
||||||
this.args = [a1, a2, a3, a4, a5];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith06Args {
|
class TestObjWith06Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1, a2, a3, a4, a5, a6) {
|
constructor(a1, a2, a3, a4, a5, a6) { this.args = [a1, a2, a3, a4, a5, a6]; }
|
||||||
this.args = [a1, a2, a3, a4, a5, a6];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith07Args {
|
class TestObjWith07Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(a1, a2, a3, a4, a5, a6, a7) {
|
constructor(a1, a2, a3, a4, a5, a6, a7) { this.args = [a1, a2, a3, a4, a5, a6, a7]; }
|
||||||
this.args = [a1, a2, a3, a4, a5, a6, a7];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith08Args {
|
class TestObjWith08Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(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]; }
|
||||||
this.args = [a1, a2, a3, a4, a5, a6, a7, a8];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith09Args {
|
class TestObjWith09Args {
|
||||||
|
@ -328,21 +308,48 @@ class TestObjWith18Args {
|
||||||
|
|
||||||
class TestObjWith19Args {
|
class TestObjWith19Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(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,
|
||||||
this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19];
|
a19) {
|
||||||
|
this.args =
|
||||||
|
[a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestObjWith20Args {
|
class TestObjWith20Args {
|
||||||
args: List<any>;
|
args: List<any>;
|
||||||
constructor(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,
|
||||||
this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20];
|
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 {
|
class TestObjWith21Args {
|
||||||
args: List<any>;
|
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) {
|
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, a20, a21];
|
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
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,10 +252,8 @@ var someDirectiveWithHostAttributes = DirectiveMetadata.create({
|
||||||
host: MapWrapper.createFromStringMap({'attr_name': 'attr_val', 'class': 'foo bar'})
|
host: MapWrapper.createFromStringMap({'attr_name': 'attr_val', 'class': 'foo bar'})
|
||||||
});
|
});
|
||||||
|
|
||||||
var someDirectiveWithEvents = DirectiveMetadata.create({
|
var someDirectiveWithEvents = DirectiveMetadata.create(
|
||||||
selector: '[some-decor-events]',
|
{selector: '[some-decor-events]', host: MapWrapper.createFromStringMap({'(click)': 'doIt()'})});
|
||||||
host: MapWrapper.createFromStringMap({'(click)': 'doIt()'})
|
|
||||||
});
|
|
||||||
|
|
||||||
var someDirectiveWithHostActions = DirectiveMetadata.create({
|
var someDirectiveWithHostActions = DirectiveMetadata.create({
|
||||||
selector: '[some-decor-host-actions]',
|
selector: '[some-decor-host-actions]',
|
||||||
|
|
|
@ -42,8 +42,7 @@ export function main() {
|
||||||
var pipeline = new CompilePipeline([
|
var pipeline = new CompilePipeline([
|
||||||
new MockStep((parent, current, control) => {
|
new MockStep((parent, current, control) => {
|
||||||
if (isPresent(DOM.getAttribute(current.element, 'viewroot'))) {
|
if (isPresent(DOM.getAttribute(current.element, 'viewroot'))) {
|
||||||
current.inheritedProtoView =
|
current.inheritedProtoView = new ProtoViewBuilder(current.element, ViewType.EMBEDDED);
|
||||||
new ProtoViewBuilder(current.element, ViewType.EMBEDDED);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -26,10 +26,14 @@ export function main() {
|
||||||
});
|
});
|
||||||
var map = directiveMetadataToMap(someComponent);
|
var map = directiveMetadataToMap(someComponent);
|
||||||
expect(MapWrapper.get(map, 'compileChildren')).toEqual(false);
|
expect(MapWrapper.get(map, 'compileChildren')).toEqual(false);
|
||||||
expect(MapWrapper.get(map, 'hostListeners')).toEqual(MapWrapper.createFromPairs([['LKey', 'LVal']]));
|
expect(MapWrapper.get(map, 'hostListeners'))
|
||||||
expect(MapWrapper.get(map, 'hostProperties')).toEqual(MapWrapper.createFromPairs([['PKey', 'PVal']]));
|
.toEqual(MapWrapper.createFromPairs([['LKey', 'LVal']]));
|
||||||
expect(MapWrapper.get(map, 'hostActions')).toEqual(MapWrapper.createFromPairs([['AcKey', 'AcVal']]));
|
expect(MapWrapper.get(map, 'hostProperties'))
|
||||||
expect(MapWrapper.get(map, 'hostAttributes')).toEqual(MapWrapper.createFromPairs([['AtKey', 'AtVal']]));
|
.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, 'id')).toEqual('someComponent');
|
||||||
expect(MapWrapper.get(map, 'properties')).toEqual(['propKey: propVal']);
|
expect(MapWrapper.get(map, 'properties')).toEqual(['propKey: propVal']);
|
||||||
expect(MapWrapper.get(map, 'readAttributes')).toEqual(['read1', 'read2']);
|
expect(MapWrapper.get(map, 'readAttributes')).toEqual(['read1', 'read2']);
|
||||||
|
|
|
@ -75,7 +75,8 @@ export function main() {
|
||||||
tb.compileAll([
|
tb.compileAll([
|
||||||
someComponent,
|
someComponent,
|
||||||
new ViewDefinition({
|
new ViewDefinition({
|
||||||
componentId: 'someComponent', template: '<some-comp> <!-- comment -->\n </some-comp>',
|
componentId: 'someComponent',
|
||||||
|
template: '<some-comp> <!-- comment -->\n </some-comp>',
|
||||||
directives: [someComponent]
|
directives: [someComponent]
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
|
|
|
@ -97,12 +97,14 @@ export function main() {
|
||||||
expect(DOM.getText(styleElement)).not.toEqual(DOM.getText(styleElement2));
|
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) => {
|
it('should move the style element to the style host when @imports are present',
|
||||||
|
inject([AsyncTestCompleter], (async) => {
|
||||||
xhr.reply('http://base/one.css', '.one {}');
|
xhr.reply('http://base/one.css', '.one {}');
|
||||||
|
|
||||||
var compileElement = el('<div><style>@import "one.css";</style></div>');
|
var compileElement = el('<div><style>@import "one.css";</style></div>');
|
||||||
var styleElement = DOM.firstChild(compileElement);
|
var styleElement = DOM.firstChild(compileElement);
|
||||||
var stylePromise = strategy.processStyleElement('someComponent', 'http://base', styleElement);
|
var stylePromise =
|
||||||
|
strategy.processStyleElement('someComponent', 'http://base', styleElement);
|
||||||
|
|
||||||
stylePromise.then((_) => {
|
stylePromise.then((_) => {
|
||||||
expect(compileElement).toHaveText('');
|
expect(compileElement).toHaveText('');
|
||||||
|
|
|
@ -43,8 +43,8 @@ export function main() {
|
||||||
styleInliner, styleUrlResolver, null),
|
styleInliner, styleUrlResolver, null),
|
||||||
[StyleInliner, StyleUrlResolver]),
|
[StyleInliner, StyleUrlResolver]),
|
||||||
"unscoped": bind(ShadowDomStrategy)
|
"unscoped": bind(ShadowDomStrategy)
|
||||||
.toFactory((styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy(
|
.toFactory((styleUrlResolver) =>
|
||||||
styleUrlResolver, null),
|
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, null),
|
||||||
[StyleUrlResolver])
|
[StyleUrlResolver])
|
||||||
};
|
};
|
||||||
if (DOM.supportsNativeShadowDOM()) {
|
if (DOM.supportsNativeShadowDOM()) {
|
||||||
|
@ -398,14 +398,14 @@ export function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var mainDir =
|
var mainDir = DirectiveMetadata.create(
|
||||||
DirectiveMetadata.create({selector: 'main', id: 'main', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'main', id: 'main', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
|
||||||
var simple = DirectiveMetadata.create(
|
var simple = DirectiveMetadata.create(
|
||||||
{selector: 'simple', id: 'simple', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'simple', id: 'simple', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
|
||||||
var empty =
|
var empty = DirectiveMetadata.create(
|
||||||
DirectiveMetadata.create({selector: 'empty', id: 'empty', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'empty', id: 'empty', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
|
||||||
var dynamicComponent = DirectiveMetadata.create(
|
var dynamicComponent = DirectiveMetadata.create(
|
||||||
{selector: 'dynamic', id: 'dynamic', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'dynamic', id: 'dynamic', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
@ -425,11 +425,11 @@ var outerWithIndirectNestedComponent = DirectiveMetadata.create({
|
||||||
type: DirectiveMetadata.COMPONENT_TYPE
|
type: DirectiveMetadata.COMPONENT_TYPE
|
||||||
});
|
});
|
||||||
|
|
||||||
var outerComponent =
|
var outerComponent = DirectiveMetadata.create(
|
||||||
DirectiveMetadata.create({selector: 'outer', id: 'outer', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'outer', id: 'outer', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
|
||||||
var innerComponent =
|
var innerComponent = DirectiveMetadata.create(
|
||||||
DirectiveMetadata.create({selector: 'inner', id: 'inner', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'inner', id: 'inner', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
|
||||||
var innerInnerComponent = DirectiveMetadata.create(
|
var innerInnerComponent = DirectiveMetadata.create(
|
||||||
{selector: 'innerinner', id: 'innerinner', type: DirectiveMetadata.COMPONENT_TYPE});
|
{selector: 'innerinner', id: 'innerinner', type: DirectiveMetadata.COMPONENT_TYPE});
|
||||||
|
|
|
@ -33,14 +33,16 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DARTIUM) {
|
||||||
it('should use a noop setter if the property did not exist when the setter was created', () => {
|
it('should use a noop setter if the property did not exist when the setter was created',
|
||||||
|
() => {
|
||||||
var setterFn = setterFactory.createSetter(div, false, 'someProp');
|
var setterFn = setterFactory.createSetter(div, false, 'someProp');
|
||||||
div.someProp = '';
|
div.someProp = '';
|
||||||
setterFn(div, 'Hello');
|
setterFn(div, 'Hello');
|
||||||
expect(div.someProp).toEqual('');
|
expect(div.someProp).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should use a noop setter if the property did not exist when the setter was created for ng components', () => {
|
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 ce = el('<some-ce></some-ce>');
|
||||||
var setterFn = setterFactory.createSetter(ce, true, 'someProp');
|
var setterFn = setterFactory.createSetter(ce, true, 'someProp');
|
||||||
ce.someProp = '';
|
ce.someProp = '';
|
||||||
|
@ -48,7 +50,8 @@ export function main() {
|
||||||
expect(ce.someProp).toEqual('');
|
expect(ce.someProp).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set the property for custom elements even if it was not present when the setter was created', () => {
|
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 ce = el('<some-ce></some-ce>');
|
||||||
var setterFn = setterFactory.createSetter(ce, false, 'someProp');
|
var setterFn = setterFactory.createSetter(ce, false, 'someProp');
|
||||||
ce.someProp = '';
|
ce.someProp = '';
|
||||||
|
|
|
@ -49,24 +49,21 @@ export function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createElementBinder(parentIndex: number = 0, distanceToParent: number = 1) {
|
function createElementBinder(parentIndex: number = 0, distanceToParent: number = 1) {
|
||||||
return new ElementBinder({parentIndex: parentIndex, distanceToParent:distanceToParent, textNodeIndices:[]});
|
return new ElementBinder(
|
||||||
|
{parentIndex: parentIndex, distanceToParent: distanceToParent, textNodeIndices: []});
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('getDirectParentElement', () => {
|
describe('getDirectParentElement', () => {
|
||||||
|
|
||||||
it('should return the DomElement of the direct parent', () => {
|
it('should return the DomElement of the direct parent', () => {
|
||||||
var pv = createProtoView(
|
var pv = createProtoView([createElementBinder(), createElementBinder(0, 1)]);
|
||||||
[createElementBinder(), createElementBinder(0, 1)]);
|
|
||||||
var view = createView(pv, 2);
|
var view = createView(pv, 2);
|
||||||
expect(view.getDirectParentElement(1)).toBe(view.boundElements[0]);
|
expect(view.getDirectParentElement(1)).toBe(view.boundElements[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null if the direct parent is not bound', () => {
|
it('should return null if the direct parent is not bound', () => {
|
||||||
var pv = createProtoView([
|
var pv = createProtoView(
|
||||||
createElementBinder(),
|
[createElementBinder(), createElementBinder(), createElementBinder(0, 2)]);
|
||||||
createElementBinder(),
|
|
||||||
createElementBinder(0,2)
|
|
||||||
]);
|
|
||||||
var view = createView(pv, 3);
|
var view = createView(pv, 3);
|
||||||
expect(view.getDirectParentElement(2)).toBe(null);
|
expect(view.getDirectParentElement(2)).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,8 @@ export function main() {
|
||||||
registry.config(rootHostComponent, {'path': '/', 'component': DummyCompA});
|
registry.config(rootHostComponent, {'path': '/', 'component': DummyCompA});
|
||||||
registry.config(rootHostComponent, {'path': '/test', 'component': DummyCompB});
|
registry.config(rootHostComponent, {'path': '/test', 'component': DummyCompB});
|
||||||
|
|
||||||
registry.recognize('/test', rootHostComponent).then((instruction) => {
|
registry.recognize('/test', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyCompB);
|
expect(instruction.component).toBe(DummyCompB);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -35,7 +36,8 @@ export function main() {
|
||||||
registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompB});
|
registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompB});
|
||||||
registry.config(rootHostComponent, {'path': '/home', 'component': DummyCompA});
|
registry.config(rootHostComponent, {'path': '/home', 'component': DummyCompA});
|
||||||
|
|
||||||
registry.recognize('/home', rootHostComponent).then((instruction) => {
|
registry.recognize('/home', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyCompA);
|
expect(instruction.component).toBe(DummyCompA);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -45,7 +47,8 @@ export function main() {
|
||||||
registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompA});
|
registry.config(rootHostComponent, {'path': '/:site', 'component': DummyCompA});
|
||||||
registry.config(rootHostComponent, {'path': '/*site', 'component': DummyCompB});
|
registry.config(rootHostComponent, {'path': '/*site', 'component': DummyCompB});
|
||||||
|
|
||||||
registry.recognize('/home', rootHostComponent).then((instruction) => {
|
registry.recognize('/home', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyCompA);
|
expect(instruction.component).toBe(DummyCompA);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -55,7 +58,8 @@ export function main() {
|
||||||
registry.config(rootHostComponent, {'path': '/:first/*rest', 'component': DummyCompA});
|
registry.config(rootHostComponent, {'path': '/:first/*rest', 'component': DummyCompA});
|
||||||
registry.config(rootHostComponent, {'path': '/*all', 'component': DummyCompB});
|
registry.config(rootHostComponent, {'path': '/*all', 'component': DummyCompB});
|
||||||
|
|
||||||
registry.recognize('/some/path', rootHostComponent).then((instruction) => {
|
registry.recognize('/some/path', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyCompA);
|
expect(instruction.component).toBe(DummyCompA);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -65,17 +69,22 @@ export function main() {
|
||||||
registry.config(rootHostComponent, {'path': '/first/:second', 'component': DummyCompA});
|
registry.config(rootHostComponent, {'path': '/first/:second', 'component': DummyCompA});
|
||||||
registry.config(rootHostComponent, {'path': '/:first/:second', 'component': DummyCompB});
|
registry.config(rootHostComponent, {'path': '/:first/:second', 'component': DummyCompB});
|
||||||
|
|
||||||
registry.recognize('/first/second', rootHostComponent).then((instruction) => {
|
registry.recognize('/first/second', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyCompA);
|
expect(instruction.component).toBe(DummyCompA);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should prefer routes with static segments before dynamic segments', inject([AsyncTestCompleter], (async) => {
|
it('should prefer routes with static segments before dynamic segments',
|
||||||
registry.config(rootHostComponent, {'path': '/first/second/:third', 'component': DummyCompB});
|
inject([AsyncTestCompleter], (async) => {
|
||||||
registry.config(rootHostComponent, {'path': '/first/:second/third', 'component': DummyCompA});
|
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) => {
|
registry.recognize('/first/second/third', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyCompB);
|
expect(instruction.component).toBe(DummyCompB);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -84,27 +93,34 @@ export function main() {
|
||||||
it('should match the full URL using child components', inject([AsyncTestCompleter], (async) => {
|
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) => {
|
registry.recognize('/first/second', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyParentComp);
|
expect(instruction.component).toBe(DummyParentComp);
|
||||||
expect(instruction.child.component).toBe(DummyCompB);
|
expect(instruction.child.component).toBe(DummyCompB);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should match the URL using async child components', inject([AsyncTestCompleter], (async) => {
|
it('should match the URL using async child components',
|
||||||
|
inject([AsyncTestCompleter], (async) => {
|
||||||
registry.config(rootHostComponent, {'path': '/first', 'component': DummyAsyncComp});
|
registry.config(rootHostComponent, {'path': '/first', 'component': DummyAsyncComp});
|
||||||
|
|
||||||
registry.recognize('/first/second', rootHostComponent).then((instruction) => {
|
registry.recognize('/first/second', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyAsyncComp);
|
expect(instruction.component).toBe(DummyAsyncComp);
|
||||||
expect(instruction.child.component).toBe(DummyCompB);
|
expect(instruction.child.component).toBe(DummyCompB);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should match the URL using an async parent component', inject([AsyncTestCompleter], (async) => {
|
it('should match the URL using an async parent component',
|
||||||
registry.config(rootHostComponent, {'path': '/first', 'component': {'loader': AsyncParentLoader, 'type': 'loader'} });
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
registry.config(
|
||||||
|
rootHostComponent,
|
||||||
|
{'path': '/first', 'component': {'loader': AsyncParentLoader, 'type': 'loader'}});
|
||||||
|
|
||||||
registry.recognize('/first/second', rootHostComponent).then((instruction) => {
|
registry.recognize('/first/second', rootHostComponent)
|
||||||
|
.then((instruction) => {
|
||||||
expect(instruction.component).toBe(DummyParentComp);
|
expect(instruction.component).toBe(DummyParentComp);
|
||||||
expect(instruction.child.component).toBe(DummyCompB);
|
expect(instruction.child.component).toBe(DummyCompB);
|
||||||
async.done();
|
async.done();
|
||||||
|
@ -113,11 +129,14 @@ export function main() {
|
||||||
|
|
||||||
it('should throw when a config does not have a component or redirectTo property', () => {
|
it('should throw when a config does not have a component or redirectTo property', () => {
|
||||||
expect(() => registry.config(rootHostComponent, {'path': '/some/path'}))
|
expect(() => registry.config(rootHostComponent, {'path': '/some/path'}))
|
||||||
.toThrowError('Route config should contain exactly one \'component\', or \'redirectTo\' property');
|
.toThrowError(
|
||||||
|
'Route config should contain exactly one \'component\', or \'redirectTo\' property');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when a config has an invalid component type', () => {
|
it('should throw when a config has an invalid component type', () => {
|
||||||
expect(() => registry.config(rootHostComponent, {'path': '/some/path', 'component': { 'type': 'intentionallyWrongComponentType' } }))
|
expect(() => registry.config(
|
||||||
|
rootHostComponent,
|
||||||
|
{'path': '/some/path', 'component': {'type': 'intentionallyWrongComponentType'}}))
|
||||||
.toThrowError('Invalid component type \'intentionallyWrongComponentType\'');
|
.toThrowError('Invalid component type \'intentionallyWrongComponentType\'');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -131,10 +150,9 @@ function AsyncChildLoader() {
|
||||||
return PromiseWrapper.resolve(DummyCompB);
|
return PromiseWrapper.resolve(DummyCompB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RouteConfig([
|
@RouteConfig([{'path': '/second', 'component': {'loader': AsyncChildLoader, 'type': 'loader'}}])
|
||||||
{ 'path': '/second', 'component': { 'loader': AsyncChildLoader, 'type': 'loader' } }
|
class DummyAsyncComp {
|
||||||
])
|
}
|
||||||
class DummyAsyncComp {}
|
|
||||||
|
|
||||||
class DummyCompA {}
|
class DummyCompA {}
|
||||||
class DummyCompB {}
|
class DummyCompB {}
|
||||||
|
|
|
@ -49,12 +49,7 @@ angular.module('app', [])
|
||||||
for (var i = 0; i < totalRows; i++) {
|
for (var i = 0; i < totalRows; i++) {
|
||||||
data[i] = [];
|
data[i] = [];
|
||||||
for (var j = 0; j < totalColumns; j++) {
|
for (var j = 0; j < totalColumns; j++) {
|
||||||
data[i][j] = {
|
data[i][j] = {i: i, j: j, iFn: iGetter, jFn: jGetter};
|
||||||
i: i,
|
|
||||||
j: j,
|
|
||||||
iFn: iGetter,
|
|
||||||
jFn: jGetter
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -72,9 +72,7 @@ class MockMetric extends Metric {
|
||||||
|
|
||||||
endMeasure(restart: boolean): Promise<StringMap<string, any>> {
|
endMeasure(restart: boolean): Promise<StringMap<string, any>> {
|
||||||
var result = {};
|
var result = {};
|
||||||
result[this._id] = {
|
result[this._id] = {'restart': restart};
|
||||||
'restart': restart
|
|
||||||
};
|
|
||||||
return PromiseWrapper.resolve(result);
|
return PromiseWrapper.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,8 @@ export function main() {
|
||||||
var reporter;
|
var reporter;
|
||||||
var log;
|
var log;
|
||||||
|
|
||||||
function createReporter({columnWidth = null, sampleId = null, descriptions = null, metrics = null}:{
|
function createReporter({columnWidth = null, sampleId = null, descriptions = null,
|
||||||
columnWidth?, sampleId?, descriptions?, metrics?
|
metrics = null}: {columnWidth?, sampleId?, descriptions?, metrics?}) {
|
||||||
}) {
|
|
||||||
log = [];
|
log = [];
|
||||||
if (isBlank(descriptions)) {
|
if (isBlank(descriptions)) {
|
||||||
descriptions = [];
|
descriptions = [];
|
||||||
|
|
|
@ -31,10 +31,7 @@ export function main() {
|
||||||
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(1234)),
|
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(1234)),
|
||||||
bind(Options.WRITE_FILE)
|
bind(Options.WRITE_FILE)
|
||||||
.toValue((filename, content) => {
|
.toValue((filename, content) => {
|
||||||
loggedFile = {
|
loggedFile = {'filename': filename, 'content': content};
|
||||||
'filename': filename,
|
|
||||||
'content': content
|
|
||||||
};
|
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
@ -34,8 +34,7 @@ if (typeof _global['$traceurRuntime'] === 'object') {
|
||||||
}
|
}
|
||||||
Object.keys(primitives).forEach(function(name) { primitives[name].__assertName = name; });
|
Object.keys(primitives).forEach(function(name) { primitives[name].__assertName = name; });
|
||||||
|
|
||||||
export function proxy() {
|
export function proxy() {}
|
||||||
}
|
|
||||||
|
|
||||||
function assertArgumentTypes(...params) {
|
function assertArgumentTypes(...params) {
|
||||||
var actual, type;
|
var actual, type;
|
||||||
|
|
|
@ -9,9 +9,7 @@ import {DiffingFlatten} from './broccoli-flatten';
|
||||||
describe('Flatten', () => {
|
describe('Flatten', () => {
|
||||||
afterEach(() => mockfs.restore());
|
afterEach(() => mockfs.restore());
|
||||||
|
|
||||||
function flatten(inputPaths) {
|
function flatten(inputPaths) { return new DiffingFlatten(inputPaths, 'output', null); }
|
||||||
return new DiffingFlatten(inputPaths, 'output', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
function read(path) { return fs.readFileSync(path, {encoding: "utf-8"}); }
|
function read(path) { return fs.readFileSync(path, {encoding: "utf-8"}); }
|
||||||
function rm(path) { return fs.unlinkSync(path); }
|
function rm(path) { return fs.unlinkSync(path); }
|
||||||
|
@ -59,9 +57,8 @@ describe('Flatten', () => {
|
||||||
'input': {
|
'input': {
|
||||||
'dir1': {
|
'dir1': {
|
||||||
'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)}),
|
'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)}),
|
||||||
'subdir-1': {
|
'subdir-1':
|
||||||
'file-1.txt': mockfs.file({content: 'file-1.1.txt content', mtime: new Date(1000)})
|
{'file-1.txt': mockfs.file({content: 'file-1.1.txt content', mtime: new Date(1000)})},
|
||||||
},
|
|
||||||
'empty-dir': {}
|
'empty-dir': {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -71,7 +68,7 @@ describe('Flatten', () => {
|
||||||
|
|
||||||
let differ = new TreeDiffer('testLabel', 'input');
|
let differ = new TreeDiffer('testLabel', 'input');
|
||||||
let flattenedTree = flatten('input');
|
let flattenedTree = flatten('input');
|
||||||
expect(() => flattenedTree.rebuild(differ.diffTree())).
|
expect(() => flattenedTree.rebuild(differ.diffTree()))
|
||||||
toThrowError("Duplicate file 'file-1.txt' found in path 'dir1/subdir-1/file-1.txt'");
|
.toThrowError("Duplicate file 'file-1.txt' found in path 'dir1/subdir-1/file-1.txt'");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,11 @@ interface LodashRendererOptions {
|
||||||
files?: string[];
|
files?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const kDefaultOptions: LodashRendererOptions = {encoding: 'utf-8', context: {}, files: []};
|
const kDefaultOptions: LodashRendererOptions = {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
context: {},
|
||||||
|
files: []
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,8 +54,8 @@ describe('MergeTrees', () => {
|
||||||
mockfs(testDir);
|
mockfs(testDir);
|
||||||
let treeDiffer = MakeTreeDiffers(['tree1', 'tree2', 'tree3']);
|
let treeDiffer = MakeTreeDiffers(['tree1', 'tree2', 'tree3']);
|
||||||
let treeMerger = mergeTrees(['tree1', 'tree2', 'tree3'], 'dest', {});
|
let treeMerger = mergeTrees(['tree1', 'tree2', 'tree3'], 'dest', {});
|
||||||
expect(() => treeMerger.rebuild(treeDiffer.diffTrees())).
|
expect(() => treeMerger.rebuild(treeDiffer.diffTrees()))
|
||||||
toThrowError("`overwrite` option is required for handling duplicates.");
|
.toThrowError("`overwrite` option is required for handling duplicates.");
|
||||||
|
|
||||||
testDir = {
|
testDir = {
|
||||||
'tree1': {'foo.js': mockfs.file({content: 'tree1/foo.js content', mtime: new Date(1000)})},
|
'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)});
|
testDir.tree2['foo.js'] = mockfs.file({content: 'tree2/foo.js content', mtime: new Date(1000)});
|
||||||
mockfs(testDir);
|
mockfs(testDir);
|
||||||
expect(() => treeMerger.rebuild(treeDiffer.diffTrees())).
|
expect(() => treeMerger.rebuild(treeDiffer.diffTrees()))
|
||||||
toThrowError("`overwrite` option is required for handling duplicates.");
|
.toThrowError("`overwrite` option is required for handling duplicates.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,7 +10,9 @@ import {wrapDiffingPlugin, DiffingBroccoliPlugin, DiffResult} from './diffing-br
|
||||||
|
|
||||||
type FileRegistry = ts.Map<{version: number}>;
|
type FileRegistry = ts.Map<{version: number}>;
|
||||||
|
|
||||||
const FS_OPTS = {encoding: 'utf-8'};
|
const FS_OPTS = {
|
||||||
|
encoding: 'utf-8'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,8 +30,7 @@ describe('TreeDiffer', () => {
|
||||||
|
|
||||||
let diffResult = differ.diffTree();
|
let diffResult = differ.diffTree();
|
||||||
|
|
||||||
expect(diffResult.addedPaths)
|
expect(diffResult.addedPaths).toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']);
|
||||||
.toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']);
|
|
||||||
|
|
||||||
expect(diffResult.changedPaths).toEqual([]);
|
expect(diffResult.changedPaths).toEqual([]);
|
||||||
expect(diffResult.removedPaths).toEqual([]);
|
expect(diffResult.removedPaths).toEqual([]);
|
||||||
|
@ -83,8 +82,7 @@ describe('TreeDiffer', () => {
|
||||||
|
|
||||||
let diffResult = differ.diffTree();
|
let diffResult = differ.diffTree();
|
||||||
|
|
||||||
expect(diffResult.addedPaths)
|
expect(diffResult.addedPaths).toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']);
|
||||||
.toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']);
|
|
||||||
|
|
||||||
// change two files
|
// change two files
|
||||||
testDir['dir1']['file-1.txt'] = mockfs.file({content: 'new content', mtime: new Date(1000)});
|
testDir['dir1']['file-1.txt'] = mockfs.file({content: 'new content', mtime: new Date(1000)});
|
||||||
|
@ -129,8 +127,7 @@ describe('TreeDiffer', () => {
|
||||||
|
|
||||||
let diffResult = differ.diffTree();
|
let diffResult = differ.diffTree();
|
||||||
|
|
||||||
expect(diffResult.addedPaths)
|
expect(diffResult.addedPaths).toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']);
|
||||||
.toEqual(['file-1.txt', 'file-2.txt', 'subdir-1/file-1.1.txt']);
|
|
||||||
|
|
||||||
// change two files
|
// change two files
|
||||||
testDir['orig_path']['file-1.txt'] =
|
testDir['orig_path']['file-1.txt'] =
|
||||||
|
@ -257,8 +254,7 @@ describe('TreeDiffer', () => {
|
||||||
|
|
||||||
let diffResult = differ.diffTree();
|
let diffResult = differ.diffTree();
|
||||||
|
|
||||||
expect(diffResult.addedPaths)
|
expect(diffResult.addedPaths).toEqual(['file-1.cs', 'file-1.ts', 'file-1d.cs', 'file-3.ts']);
|
||||||
.toEqual(['file-1.cs', 'file-1.ts', 'file-1d.cs', 'file-3.ts']);
|
|
||||||
|
|
||||||
// change two files
|
// change two files
|
||||||
testDir['dir1']['file-1.ts'] = mockfs.file({content: 'new content', mtime: new Date(1000)});
|
testDir['dir1']['file-1.ts'] = mockfs.file({content: 'new content', mtime: new Date(1000)});
|
||||||
|
|
|
@ -133,10 +133,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||||
// Get scripts for each benchmark or example
|
// Get scripts for each benchmark or example
|
||||||
let servingTrees = kServedPaths.reduce(getServedFunnels, []);
|
let servingTrees = kServedPaths.reduce(getServedFunnels, []);
|
||||||
function getServedFunnels(funnels, destDir) {
|
function getServedFunnels(funnels, destDir) {
|
||||||
let options = {
|
let options = {srcDir: '/', destDir: destDir};
|
||||||
srcDir: '/',
|
|
||||||
destDir: destDir
|
|
||||||
};
|
|
||||||
funnels.push(new Funnel(vendorScriptsTree, options));
|
funnels.push(new Funnel(vendorScriptsTree, options));
|
||||||
if (destDir.indexOf('benchmarks') > -1) {
|
if (destDir.indexOf('benchmarks') > -1) {
|
||||||
funnels.push(new Funnel(vendorScripts_benchmark, options));
|
funnels.push(new Funnel(vendorScripts_benchmark, options));
|
||||||
|
|
Loading…
Reference in New Issue