[Code Style] Run gulp fixstyle

...to apply code style settings from #142.
This commit is contained in:
Victor Woeltjen
2016-05-19 11:29:13 -07:00
parent f12b9704d9
commit fa77139077
440 changed files with 1885 additions and 1662 deletions

View File

@ -316,7 +316,7 @@ define([
"transactionService" "transactionService"
] ]
} }
], ]
} }
}); });
}); });

View File

@ -24,8 +24,12 @@ define(
function () { function () {
// Utility functions for reducing truth arrays // Utility functions for reducing truth arrays
function and(a, b) { return a && b; } function and(a, b) {
function or(a, b) { return a || b; } return a && b;
}
function or(a, b) {
return a || b;
}
/** /**

View File

@ -38,7 +38,9 @@ define(
beforeEach(function () { beforeEach(function () {
capabilities = { capabilities = {
type: { type: {
getProperties: function () { return []; }, getProperties: function () {
return [];
},
hasFeature: jasmine.createSpy('hasFeature') hasFeature: jasmine.createSpy('hasFeature')
}, },
persistence: jasmine.createSpyObj("persistence", ["persist"]), persistence: jasmine.createSpyObj("persistence", ["persist"]),
@ -47,11 +49,21 @@ define(
model = {}; model = {};
input = {}; input = {};
object = { object = {
getId: function () { return 'test-id'; }, getId: function () {
getCapability: function (k) { return capabilities[k]; }, return 'test-id';
getModel: function () { return model; }, },
useCapability: function (k, v) { return capabilities[k](v); }, getCapability: function (k) {
hasCapability: function () { return true; } return capabilities[k];
},
getModel: function () {
return model;
},
useCapability: function (k, v) {
return capabilities[k](v);
},
hasCapability: function () {
return true;
}
}; };
context = { someKey: "some value", domainObject: object }; context = { someKey: "some value", domainObject: object };
dialogService = { dialogService = {

View File

@ -30,14 +30,22 @@ define(
beforeEach(function () { beforeEach(function () {
type = { type = {
getProperties: function () { return properties; } getProperties: function () {
return properties;
}
}; };
model = { x: "initial value" }; model = { x: "initial value" };
properties = ["x", "y", "z"].map(function (k) { properties = ["x", "y", "z"].map(function (k) {
return { return {
getValue: function (model) { return model[k]; }, getValue: function (model) {
setValue: function (model, v) { model[k] = v; }, return model[k];
getDefinition: function () { return { control: 'textfield '}; } },
setValue: function (model, v) {
model[k] = v;
},
getDefinition: function () {
return { control: 'textfield '};
}
}; };
}); });

View File

@ -126,7 +126,9 @@ define(
it("reads properties from getters", function () { it("reads properties from getters", function () {
var structure, state; var structure, state;
testABC.a = function () { return "from a getter!"; }; testABC.a = function () {
return "from a getter!";
};
toolbar.setSelection([testABC]); toolbar.setSelection([testABC]);
structure = toolbar.getStructure(); structure = toolbar.getStructure();

View File

@ -40,7 +40,9 @@ define(
}); });
// Return constructors // Return constructors
mockFormats = KEYS.map(function (k, i) { mockFormats = KEYS.map(function (k, i) {
function MockFormat() { return mockFormatInstances[i]; } function MockFormat() {
return mockFormatInstances[i];
}
MockFormat.key = k; MockFormat.key = k;
return MockFormat; return MockFormat;
}); });

View File

@ -69,7 +69,9 @@ define(
function updateList(ids) { function updateList(ids) {
function updateSelectedObjects(objects) { function updateSelectedObjects(objects) {
// Look up from the // Look up from the
function getObject(id) { return objects[id]; } function getObject(id) {
return objects[id];
}
self.selectedObjects = self.selectedObjects =
ids.filter(getObject).map(getObject); ids.filter(getObject).map(getObject);
} }

View File

@ -39,7 +39,9 @@ define(
); );
testIndicatorA = {}; testIndicatorA = {};
testIndicatorB = function () { return mockIndicator; }; testIndicatorB = function () {
return mockIndicator;
};
testIndicatorC = { template: "someTemplate" }; testIndicatorC = { template: "someTemplate" };
testIndicators = [ testIndicators = [

View File

@ -32,7 +32,9 @@ define(
function TestObject(id, context) { function TestObject(id, context) {
return { return {
getId: function () { return id; }, getId: function () {
return id;
},
getCapability: function (key) { getCapability: function (key) {
return key === 'context' ? context : undefined; return key === 'context' ? context : undefined;
} }

View File

@ -35,7 +35,9 @@ define(
beforeEach(function () { beforeEach(function () {
mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
mockTimeout = jasmine.createSpy("$timeout"); mockTimeout = jasmine.createSpy("$timeout");
mockTimeout.andCallFake(function (cb) { cb(); }); mockTimeout.andCallFake(function (cb) {
cb();
});
mockScope.ngModel = {}; mockScope.ngModel = {};
controller = new ViewSwitcherController(mockScope, mockTimeout); controller = new ViewSwitcherController(mockScope, mockTimeout);
}); });

View File

@ -46,7 +46,9 @@ define(
*/ */
function RootModelProvider(roots, $q, $log) { function RootModelProvider(roots, $q, $log) {
// Pull out identifiers to used as ROOT's // Pull out identifiers to used as ROOT's
var ids = roots.map(function (root) { return root.id; }); var ids = roots.map(function (root) {
return root.id;
});
// Assign an initial location to root models // Assign an initial location to root models
roots.forEach(function (root) { roots.forEach(function (root) {

View File

@ -33,8 +33,12 @@ define(
} }
}, },
identity: { identity: {
toModelValue: function (v) { return v; }, toModelValue: function (v) {
toFormValue: function (v) { return v; } return v;
},
toFormValue: function (v) {
return v;
}
} }
}, },
ARRAY_SUFFIX = '[]'; ARRAY_SUFFIX = '[]';

View File

@ -33,29 +33,41 @@ define(
actionProvider; actionProvider;
function SimpleAction() { function SimpleAction() {
return { perform: function () { return "simple"; } }; return { perform: function () {
return "simple";
} };
} }
function CategorizedAction() { function CategorizedAction() {
return { perform: function () { return "categorized"; } }; return { perform: function () {
return "categorized";
} };
} }
CategorizedAction.category = "someCategory"; CategorizedAction.category = "someCategory";
function KeyedAction() { function KeyedAction() {
return { perform: function () { return "keyed"; } }; return { perform: function () {
return "keyed";
} };
} }
KeyedAction.key = "someKey"; KeyedAction.key = "someKey";
function CategorizedKeyedAction() { function CategorizedKeyedAction() {
return { perform: function () { return "both"; } }; return { perform: function () {
return "both";
} };
} }
CategorizedKeyedAction.key = "someKey"; CategorizedKeyedAction.key = "someKey";
CategorizedKeyedAction.category = "someCategory"; CategorizedKeyedAction.category = "someCategory";
function MetadataAction() { function MetadataAction() {
return { return {
perform: function () { return "metadata"; }, perform: function () {
getMetadata: function () { return "custom metadata"; } return "metadata";
},
getMetadata: function () {
return "custom metadata";
}
}; };
} }
MetadataAction.key = "metadata"; MetadataAction.key = "metadata";

View File

@ -114,7 +114,9 @@ define(
mockObjectService.getObjects.andReturn(mockPromise({x: mockChild})); mockObjectService.getObjects.andReturn(mockPromise({x: mockChild}));
mockChild.getCapability.andReturn(undefined); mockChild.getCapability.andReturn(undefined);
composition.invoke().then(function (c) { result = c; }); composition.invoke().then(function (c) {
result = c;
});
// Should have been added by a wrapper // Should have been added by a wrapper
expect(result[0].getCapability('context')).toBeDefined(); expect(result[0].getCapability('context')).toBeDefined();

View File

@ -31,16 +31,22 @@ define(
var mockLog, var mockLog,
provider; provider;
function BasicCapability() { return; } function BasicCapability() {
return;
}
BasicCapability.key = "basic"; BasicCapability.key = "basic";
function ApplicableCapability() { return; } function ApplicableCapability() {
return;
}
ApplicableCapability.key = "applicable"; ApplicableCapability.key = "applicable";
ApplicableCapability.appliesTo = function (model) { ApplicableCapability.appliesTo = function (model) {
return !model.isNotApplicable; return !model.isNotApplicable;
}; };
function KeylessCapability() { return; } function KeylessCapability() {
return;
}
beforeEach(function () { beforeEach(function () {
mockLog = jasmine.createSpyObj( mockLog = jasmine.createSpyObj(

View File

@ -36,7 +36,11 @@ define(
object = {}, object = {},
delegation; delegation;
function capture(k) { return function (v) { captured[k] = v; }; } function capture(k) {
return function (v) {
captured[k] = v;
};
}
function TestDomainObject(caps, id) { function TestDomainObject(caps, id) {
return { return {
getId: function () { getId: function () {
@ -68,11 +72,15 @@ define(
captured = {}; captured = {};
typeDef = {}; typeDef = {};
typeDef.delegates = ["foo"]; typeDef.delegates = ["foo"];
type = { getDefinition: function () { return typeDef; } }; type = { getDefinition: function () {
return typeDef;
} };
children = []; children = [];
capabilities = { capabilities = {
type: type, type: type,
composition: { invoke: function () { return mockPromise(children); } } composition: { invoke: function () {
return mockPromise(children);
} }
}; };
object = new TestDomainObject(capabilities); object = new TestDomainObject(capabilities);

View File

@ -35,8 +35,12 @@ define(
topic, topic,
mockNow, mockNow,
domainObject = { domainObject = {
getId: function () { return "test-id"; }, getId: function () {
getModel: function () { return testModel; } return "test-id";
},
getModel: function () {
return testModel;
}
}, },
mutation; mutation;

View File

@ -85,8 +85,12 @@ define(
); );
mockDomainObject = { mockDomainObject = {
getId: function () { return id; }, getId: function () {
getModel: function () { return model; }, return id;
},
getModel: function () {
return model;
},
useCapability: jasmine.createSpy() useCapability: jasmine.createSpy()
}; };
// Simulate mutation capability // Simulate mutation capability

View File

@ -61,14 +61,18 @@ define(
it("provides models for any IDs which are missing", function () { it("provides models for any IDs which are missing", function () {
var models; var models;
decorator.getModels(['testId', 'otherId']) decorator.getModels(['testId', 'otherId'])
.then(function (m) { models = m; }); .then(function (m) {
models = m;
});
expect(models.otherId).toBeDefined(); expect(models.otherId).toBeDefined();
}); });
it("does not overwrite existing models", function () { it("does not overwrite existing models", function () {
var models; var models;
decorator.getModels(['testId', 'otherId']) decorator.getModels(['testId', 'otherId'])
.then(function (m) { models = m; }); .then(function (m) {
models = m;
});
expect(models.testId).toEqual({ someKey: "some value" }); expect(models.testId).toEqual({ someKey: "some value" });
}); });

View File

@ -48,7 +48,9 @@ define(
}); });
mockQ.all.andReturn({ mockQ.all.andReturn({
then: function (c) { return c(modelList); } then: function (c) {
return c(modelList);
}
}); });
aggregator = new ModelAggregator(mockQ, mockProviders); aggregator = new ModelAggregator(mockQ, mockProviders);

View File

@ -57,7 +57,9 @@ define(
}; };
} }
function capture(value) { captured = value; } function capture(value) {
captured = value;
}
beforeEach(function () { beforeEach(function () {

View File

@ -55,7 +55,9 @@ define(
}); });
it("provides models from extension declarations", function () { it("provides models from extension declarations", function () {
var mockPromise = { then: function () { return; } }; var mockPromise = { then: function () {
return;
} };
mockQ.when.andReturn(mockPromise); mockQ.when.andReturn(mockPromise);
// Verify that we got the promise as the return value // Verify that we got the promise as the return value

View File

@ -74,10 +74,14 @@ define(
it("supports instance-of checks by type object", function () { it("supports instance-of checks by type object", function () {
expect(type.instanceOf({ expect(type.instanceOf({
getKey: function () { return 'test-parent-1'; } getKey: function () {
return 'test-parent-1';
}
})).toBeTruthy(); })).toBeTruthy();
expect(type.instanceOf({ expect(type.instanceOf({
getKey: function () { return 'some-other-type'; } getKey: function () {
return 'some-other-type';
}
})).toBeFalsy(); })).toBeFalsy();
}); });

View File

@ -167,7 +167,8 @@ define(
// set, however linked objects will not. // set, however linked objects will not.
return composeChild(clonedComposee, clonedParent, clonedComposee !== originalComposee); return composeChild(clonedComposee, clonedParent, clonedComposee !== originalComposee);
}); });
});}, self.$q.when(undefined) });
}, self.$q.when(undefined)
).then(function () { ).then(function () {
//Replace any references in the cloned parent to //Replace any references in the cloned parent to
// contained objects that have been composed with the // contained objects that have been composed with the

View File

@ -67,7 +67,9 @@ define(
.then(function (objectInNewContext) { .then(function (objectInNewContext) {
return parentObject.getCapability('persistence') return parentObject.getCapability('persistence')
.persist() .persist()
.then(function () { return objectInNewContext; }); .then(function () {
return objectInNewContext;
});
}); });
}; };

View File

@ -171,7 +171,9 @@ define(
['notify', 'resolve', 'reject'] ['notify', 'resolve', 'reject']
); );
mockDeferred.notify.andCallFake(function () {}); mockDeferred.notify.andCallFake(function () {});
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;}); mockDeferred.resolve.andCallFake(function (value) {
resolvedValue = value;
});
mockDeferred.promise = { mockDeferred.promise = {
then: function (callback) { then: function (callback) {
return synchronousPromise(callback(resolvedValue)); return synchronousPromise(callback(resolvedValue));
@ -187,7 +189,9 @@ define(
mockQ.all.andCallFake(function (promises) { mockQ.all.andCallFake(function (promises) {
var result = {}; var result = {};
Object.keys(promises).forEach(function (k) { Object.keys(promises).forEach(function (k) {
promises[k].then(function (v) { result[k] = v; }); promises[k].then(function (v) {
result[k] = v;
});
}); });
return synchronousPromise(result); return synchronousPromise(result);
}); });

View File

@ -130,7 +130,9 @@ define(
mockQ.all.andCallFake(function (promises) { mockQ.all.andCallFake(function (promises) {
return synchronousPromise(promises.map(function (promise) { return synchronousPromise(promises.map(function (promise) {
var value; var value;
promise.then(function (v) { value = v; }); promise.then(function (v) {
value = v;
});
return value; return value;
})); }));
}); });

View File

@ -76,7 +76,9 @@ define(
mockQ.all.andCallFake(function (promises) { mockQ.all.andCallFake(function (promises) {
var result = {}; var result = {};
Object.keys(promises).forEach(function (k) { Object.keys(promises).forEach(function (k) {
promises[k].then(function (v) { result[k] = v; }); promises[k].then(function (v) {
result[k] = v;
});
}); });
return testPromise(result); return testPromise(result);
}); });

View File

@ -63,7 +63,9 @@ define(
beforeEach(function () { beforeEach(function () {
title = "Get a location to do something"; title = "Get a location to do something";
label = "a location"; label = "a location";
validate = function () { return true; }; validate = function () {
return true;
};
initialLocation = { key: "a key" }; initialLocation = { key: "a key" };
locationResult = locationService.getLocationFromUser( locationResult = locationService.getLocationFromUser(
title, title,

View File

@ -27,7 +27,9 @@
define( define(
function () { function () {
function identity(x) { return x; } function identity(x) {
return x;
}
/** /**
* The PlotPreparer is responsible for handling data sets and * The PlotPreparer is responsible for handling data sets and

View File

@ -96,7 +96,9 @@ define(
); );
mockHandler.handle.andReturn(mockHandle); mockHandler.handle.andReturn(mockHandle);
mockThrottle.andCallFake(function (fn) { return fn; }); mockThrottle.andCallFake(function (fn) {
return fn;
});
mockHandle.getTelemetryObjects.andReturn([mockDomainObject]); mockHandle.getTelemetryObjects.andReturn([mockDomainObject]);
mockHandle.getMetadata.andReturn([{}]); mockHandle.getMetadata.andReturn([{}]);
mockHandle.getDomainValue.andReturn(123); mockHandle.getDomainValue.andReturn(123);

View File

@ -88,7 +88,7 @@ define(
enableFilter: "=?", enableFilter: "=?",
enableSort: "=?", enableSort: "=?",
autoScroll: "=?" autoScroll: "=?"
}, }
}; };
} }

View File

@ -87,7 +87,7 @@ define(
'column1': true, 'column1': true,
'column2': true, 'column2': true,
'column3': false, 'column3': false,
'column4': true, 'column4': true
} }
} }
} }

View File

@ -42,7 +42,9 @@ define(
candidates; candidates;
// Filter an id for inclustion // Filter an id for inclustion
function include(id) { return id !== exclude; } function include(id) {
return id !== exclude;
}
// Evaluate a candidate timestamp as a snap-to location // Evaluate a candidate timestamp as a snap-to location
function evaluate(candidate) { function evaluate(candidate) {

View File

@ -67,8 +67,12 @@ define(
mockQ.when.andCallFake(asPromise); mockQ.when.andCallFake(asPromise);
mockQ.all.andCallFake(function (values) { mockQ.all.andCallFake(function (values) {
var result = []; var result = [];
function addResult(v) { result.push(v); } function addResult(v) {
function promiseResult(v) { asPromise(v).then(addResult); } result.push(v);
}
function promiseResult(v) {
asPromise(v).then(addResult);
}
values.forEach(promiseResult); values.forEach(promiseResult);
return asPromise(result); return asPromise(result);
}); });

View File

@ -61,7 +61,9 @@ define(
mockTimespan.getDuration.andReturn(50); mockTimespan.getDuration.andReturn(50);
mockTimespan.getEnd.andReturn(150); mockTimespan.getEnd.andReturn(150);
mockToPixels.andCallFake(function (t) { return t * 10; }); mockToPixels.andCallFake(function (t) {
return t * 10;
});
controller = new TimelineGanttController(TEST_MAX_OFFSCREEN); controller = new TimelineGanttController(TEST_MAX_OFFSCREEN);
}); });

View File

@ -90,7 +90,9 @@ define(
mockScope.domainObject.getCapability.andCallFake(function (c) { mockScope.domainObject.getCapability.andCallFake(function (c) {
if (c === 'editor') { if (c === 'editor') {
return { return {
inEditContext: function () {return true;} inEditContext: function () {
return true;
}
}; };
} }
}); });

View File

@ -49,10 +49,14 @@ define(
var colors = {}, i, ids = []; var colors = {}, i, ids = [];
// Add item to set // Add item to set
function set(c) { colors[c] = true; } function set(c) {
colors[c] = true;
}
// Generate ids // Generate ids
for (i = 0; i < 30; i += 1) { ids.push("id" + i); } for (i = 0; i < 30; i += 1) {
ids.push("id" + i);
}
// Assign colors to each id, then retrieve colors, // Assign colors to each id, then retrieve colors,
// storing into the set // storing into the set

View File

@ -36,7 +36,9 @@ define(
testConfiguration; testConfiguration;
function asPromise(v) { function asPromise(v) {
return { then: function (cb) { cb(v); } }; return { then: function (cb) {
cb(v);
} };
} }
beforeEach(function () { beforeEach(function () {

View File

@ -82,8 +82,12 @@ define(
mockQ.when.andCallFake(asPromise); mockQ.when.andCallFake(asPromise);
mockQ.all.andCallFake(function (values) { mockQ.all.andCallFake(function (values) {
var result = []; var result = [];
function addResult(v) { result.push(v); } function addResult(v) {
function promiseResult(v) { asPromise(v).then(addResult); } result.push(v);
}
function promiseResult(v) {
asPromise(v).then(addResult);
}
values.forEach(promiseResult); values.forEach(promiseResult);
return asPromise(result); return asPromise(result);
}); });

View File

@ -73,7 +73,9 @@ define(
// loadBundleDefinition, so at this point they are safe // loadBundleDefinition, so at this point they are safe
// to discard. // to discard.
function filterBundles(array) { function filterBundles(array) {
return array.filter(function (x) { return x !== undefined; }); return array.filter(function (x) {
return x !== undefined;
});
} }
// Load a definition for a bundle // Load a definition for a bundle

View File

@ -92,7 +92,9 @@ define(
// Always return a static value; used to represent plain // Always return a static value; used to represent plain
// metadata as a single dependency in Angular. // metadata as a single dependency in Angular.
function staticFunction(value) { function staticFunction(value) {
return function () { return value; }; return function () {
return value;
};
} }
// Utility function; create the second argument for Angular's // Utility function; create the second argument for Angular's

View File

@ -50,10 +50,14 @@ define(
it("calls injected stages in order", function () { it("calls injected stages in order", function () {
var result; var result;
initializer.runApplication([]).then(function (v) { result = v; }); initializer.runApplication([]).then(function (v) {
result = v;
});
waitsFor( waitsFor(
function () { return result !== undefined; }, function () {
return result !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );

View File

@ -40,7 +40,9 @@ define(
mockSorter = jasmine.createSpyObj("sorter", ["sort"]); mockSorter = jasmine.createSpyObj("sorter", ["sort"]);
customRegistrars = {}; customRegistrars = {};
mockSorter.sort.andCallFake(function (v) { return v; }); mockSorter.sort.andCallFake(function (v) {
return v;
});
registrar = new ExtensionRegistrar( registrar = new ExtensionRegistrar(
mockApp, mockApp,
@ -98,7 +100,9 @@ define(
var a = { a: 'a' }, b = { b: 'b' }, c = { c: 'c' }; var a = { a: 'a' }, b = { b: 'b' }, c = { c: 'c' };
// Fake sorting; just reverse the array // Fake sorting; just reverse the array
mockSorter.sort.andCallFake(function (v) { return v.reverse(); }); mockSorter.sort.andCallFake(function (v) {
return v.reverse();
});
// Register the extensions // Register the extensions
registrar.registerExtensions({ things: [a, b, c] }); registrar.registerExtensions({ things: [a, b, c] });

View File

@ -66,11 +66,21 @@ define(
it("allows composite services to be registered", function () { it("allows composite services to be registered", function () {
// Prepare components that look like resolved extensions // Prepare components that look like resolved extensions
var components, name; var components, name;
function MyDecorator() { return {}; } function MyDecorator() {
function MyOtherDecorator() { return {}; } return {};
function MyProvider() { return {}; } }
function MyOtherProvider() { return {}; } function MyOtherDecorator() {
function MyAggregator() { return {}; } return {};
}
function MyProvider() {
return {};
}
function MyOtherProvider() {
return {};
}
function MyAggregator() {
return {};
}
components = [ components = [
MyDecorator, MyDecorator,
@ -85,7 +95,9 @@ define(
MyProvider.type = "provider"; MyProvider.type = "provider";
MyOtherProvider.type = "provider"; MyOtherProvider.type = "provider";
MyAggregator.type = "aggregator"; MyAggregator.type = "aggregator";
components.forEach(function (c) { c.provides = "testService"; }); components.forEach(function (c) {
c.provides = "testService";
});
// Add some test dependencies, to check prepending // Add some test dependencies, to check prepending
MyOtherDecorator.depends = ["someOtherService"]; MyOtherDecorator.depends = ["someOtherService"];
@ -117,16 +129,24 @@ define(
it("allows registered composite services to be instantiated", function () { it("allows registered composite services to be instantiated", function () {
// Prepare components that look like resolved extensions // Prepare components that look like resolved extensions
var components, name; var components, name;
function MyProvider() { return {}; } function MyProvider() {
function MyOtherProvider() { return {}; } return {};
function MyAggregator() { return {}; } }
function MyOtherProvider() {
return {};
}
function MyAggregator() {
return {};
}
components = [MyProvider, MyAggregator, MyOtherProvider]; components = [MyProvider, MyAggregator, MyOtherProvider];
MyProvider.type = "provider"; MyProvider.type = "provider";
MyOtherProvider.type = "provider"; MyOtherProvider.type = "provider";
MyAggregator.type = "aggregator"; MyAggregator.type = "aggregator";
components.forEach(function (c) { c.provides = "testService"; }); components.forEach(function (c) {
c.provides = "testService";
});
// Register! // Register!
compositor.registerCompositeServices(components); compositor.registerCompositeServices(components);
@ -149,9 +169,15 @@ define(
it("warns and skips components with no service type", function () { it("warns and skips components with no service type", function () {
// Prepare components that look like resolved extensions // Prepare components that look like resolved extensions
var components; var components;
function MyProvider() { return {}; } function MyProvider() {
function MyDecorator() { return {}; } return {};
function MyAggregator() { return {}; } }
function MyDecorator() {
return {};
}
function MyAggregator() {
return {};
}
components = [MyProvider, MyAggregator, MyDecorator]; components = [MyProvider, MyAggregator, MyDecorator];
@ -175,7 +201,9 @@ define(
it("warns about and skips aggregators with zero providers", function () { it("warns about and skips aggregators with zero providers", function () {
// Prepare components that look like resolved extensions // Prepare components that look like resolved extensions
var components; var components;
function MyAggregator() { return {}; } function MyAggregator() {
return {};
}
components = [MyAggregator]; components = [MyAggregator];
@ -195,7 +223,9 @@ define(
it("warns about and skips decorators with nothing to decorate", function () { it("warns about and skips decorators with nothing to decorate", function () {
// Prepare components that look like resolved extensions // Prepare components that look like resolved extensions
var components; var components;
function MyDecorator() { return {}; } function MyDecorator() {
return {};
}
components = [MyDecorator]; components = [MyDecorator];

View File

@ -63,10 +63,14 @@ define(
new Bundle("x", { extensions: { tests: [{}, {}, {}] } }), new Bundle("x", { extensions: { tests: [{}, {}, {}] } }),
new Bundle("y", { extensions: { tests: [{}, {}], others: [{}, {}] } }), new Bundle("y", { extensions: { tests: [{}, {}], others: [{}, {}] } }),
new Bundle("z", { extensions: { others: [{}] } }) new Bundle("z", { extensions: { others: [{}] } })
]).then(function (v) { result = v; }); ]).then(function (v) {
result = v;
});
waitsFor( waitsFor(
function () { return result !== undefined; }, function () {
return result !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );

View File

@ -33,7 +33,9 @@ define(
resolver; resolver;
// Test implementation, to load from the mock loader // Test implementation, to load from the mock loader
function Constructor() { return { someKey: "some value" }; } function Constructor() {
return { someKey: "some value" };
}
Constructor.someProperty = "some static value"; Constructor.someProperty = "some static value";
beforeEach(function () { beforeEach(function () {
@ -57,10 +59,14 @@ define(
extension = bundle.getExtensions("tests")[0], extension = bundle.getExtensions("tests")[0],
result; result;
resolver.resolve(extension).then(function (v) { result = v; }); resolver.resolve(extension).then(function (v) {
result = v;
});
waitsFor( waitsFor(
function () { return result !== undefined; }, function () {
return result !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );
@ -88,10 +94,14 @@ define(
result; result;
mockLoader.load.andReturn(Promise.reject(new Error("test error"))); mockLoader.load.andReturn(Promise.reject(new Error("test error")));
resolver.resolve(extension).then(function (v) { result = v; }); resolver.resolve(extension).then(function (v) {
result = v;
});
waitsFor( waitsFor(
function () { return result !== undefined; }, function () {
return result !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );
@ -114,10 +124,14 @@ define(
extension = bundle.getExtensions("tests")[0], extension = bundle.getExtensions("tests")[0],
result; result;
resolver.resolve(extension).then(function (v) { result = v; }); resolver.resolve(extension).then(function (v) {
result = v;
});
waitsFor( waitsFor(
function () { return result !== undefined; }, function () {
return result !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );

View File

@ -53,14 +53,18 @@ define(
var result; var result;
// Load and get the result // Load and get the result
loader.load("xyz.js").then(function (v) { result = v; }); loader.load("xyz.js").then(function (v) {
result = v;
});
expect(result).toBeUndefined(); expect(result).toBeUndefined();
required.fulfill("test result"); required.fulfill("test result");
waitsFor( waitsFor(
function () { return result !== undefined; }, function () {
return result !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );
@ -76,8 +80,12 @@ define(
// Load and get the result // Load and get the result
loader.load("xyz.js").then( loader.load("xyz.js").then(
function (v) { result = v; }, function (v) {
function (v) { rejection = v; } result = v;
},
function (v) {
rejection = v;
}
); );
expect(result).toBeUndefined(); expect(result).toBeUndefined();
@ -85,7 +93,9 @@ define(
required.reject("test result"); required.reject("test result");
waitsFor( waitsFor(
function () { return rejection !== undefined; }, function () {
return rejection !== undefined;
},
"promise resolution", "promise resolution",
250 250
); );

View File

@ -61,7 +61,9 @@ define(
} }
this.providerMapPromise = $q.all(providers.map(addToMap)) this.providerMapPromise = $q.all(providers.map(addToMap))
.then(function () { return providerMap; }); .then(function () {
return providerMap;
});
} }
PersistenceAggregator.prototype.listSpaces = function () { PersistenceAggregator.prototype.listSpaces = function () {

View File

@ -70,7 +70,9 @@ define(
mockQ.all.andCallFake(function (fakePromises) { mockQ.all.andCallFake(function (fakePromises) {
var result = []; var result = [];
fakePromises.forEach(function (p) { fakePromises.forEach(function (p) {
p.then(function (v) { result.push(v); }); p.then(function (v) {
result.push(v);
});
}); });
return fakePromise(result); return fakePromise(result);
}); });

View File

@ -57,7 +57,9 @@ define(
// Pull out a list of document IDs from CouchDB's // Pull out a list of document IDs from CouchDB's
// _all_docs response // _all_docs response
function getIdsFromAllDocs(allDocs) { function getIdsFromAllDocs(allDocs) {
return allDocs.rows.map(function (r) { return r.id; }); return allDocs.rows.map(function (r) {
return r.id;
});
} }
// Check the response to a create/update/delete request; // Check the response to a create/update/delete request;

View File

@ -84,7 +84,9 @@ define(
var model = models[failure.id]; var model = models[failure.id];
return failure.domainObject.useCapability( return failure.domainObject.useCapability(
"mutation", "mutation",
function () { return model; }, function () {
return model;
},
model.modified model.modified
); );
} }

View File

@ -43,7 +43,9 @@ define(
]; ];
mockPolicies = testPolicies.map(function (p) { mockPolicies = testPolicies.map(function (p) {
var mockPolicy = jasmine.createSpyObj("policy", ['allow']); var mockPolicy = jasmine.createSpyObj("policy", ['allow']);
mockPolicy.allow.andCallFake(function () { return p.result; }); mockPolicy.allow.andCallFake(function () {
return p.result;
});
return mockPolicy; return mockPolicy;
}); });
mockPolicyConstructors = testPolicies.map(function (p, i) { mockPolicyConstructors = testPolicies.map(function (p, i) {

View File

@ -59,8 +59,12 @@ define(
this.agentService = agentService; this.agentService = agentService;
this.actionContext = actionContext; this.actionContext = actionContext;
this.popupService = popupService; this.popupService = popupService;
this.getDocument = function () { return $document; }; this.getDocument = function () {
this.getRootScope = function () { return $rootScope; }; return $document;
};
this.getRootScope = function () {
return $rootScope;
};
} }
ContextMenuAction.prototype.perform = function () { ContextMenuAction.prototype.perform = function () {

View File

@ -35,7 +35,9 @@ define(
it("allows setting of arbitrary objects", function () { it("allows setting of arbitrary objects", function () {
var foo = { var foo = {
bar: function () { return 42; } bar: function () {
return 42;
}
}; };
service.setData('xyz', foo); service.setData('xyz', foo);

View File

@ -27,7 +27,9 @@ define(
[], [],
function () { function () {
var ZERO = function () { return 0; }, var ZERO = function () {
return 0;
},
EMPTY_SERIES = { EMPTY_SERIES = {
getPointCount: ZERO, getPointCount: ZERO,
getDomainValue: ZERO, getDomainValue: ZERO,

View File

@ -119,7 +119,9 @@ define(
it("provides an empty series when telemetry is missing", function () { it("provides an empty series when telemetry is missing", function () {
var series; var series;
mockTelemetryService.requestTelemetry.andReturn(mockPromise({})); mockTelemetryService.requestTelemetry.andReturn(mockPromise({}));
telemetry.requestData({}).then(function (s) { series = s; }); telemetry.requestData({}).then(function (s) {
series = s;
});
expect(series.getPointCount()).toEqual(0); expect(series.getPointCount()).toEqual(0);
}); });
@ -147,7 +149,9 @@ define(
it("warns if no telemetry service can be injected", function () { it("warns if no telemetry service can be injected", function () {
mockInjector.get.andCallFake(function () { throw ""; }); mockInjector.get.andCallFake(function () {
throw "";
});
// Verify precondition // Verify precondition
expect(mockLog.warn).not.toHaveBeenCalled(); expect(mockLog.warn).not.toHaveBeenCalled();

View File

@ -71,7 +71,9 @@ define(
mockQ.all.andCallFake(function (values) { mockQ.all.andCallFake(function (values) {
return values.map(function (v) { return values.map(function (v) {
var r; var r;
asPromise(v).then(function (value) { r = value; }); asPromise(v).then(function (value) {
r = value;
});
return r; return r;
}); });
}); });