[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

@@ -32,7 +32,7 @@ define(
aggregator;
function createMockActionProvider(actions, i) {
var spy = jasmine.createSpyObj("agg" + i, [ "getActions" ]);
var spy = jasmine.createSpyObj("agg" + i, ["getActions"]);
spy.getActions.andReturn(actions);
return spy;
}
@@ -69,4 +69,4 @@ define(
});
});
}
);
);

View File

@@ -37,19 +37,19 @@ define(
beforeEach(function () {
mockAction = jasmine.createSpyObj(
"action",
[ "perform", "getMetadata" ]
["perform", "getMetadata"]
);
mockActionService = jasmine.createSpyObj(
"actionService",
[ "getActions" ]
["getActions"]
);
mockQ = jasmine.createSpyObj(
"$q",
[ "when" ]
["when"]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ]
["getId", "getModel", "getCapability", "hasCapability", "useCapability"]
);
mockActionService.getActions.andReturn([mockAction, {}]);
@@ -76,7 +76,7 @@ define(
});
it("promises the result of performed actions", function () {
var mockPromise = jasmine.createSpyObj("promise", [ "then" ]);
var mockPromise = jasmine.createSpyObj("promise", ["then"]);
mockQ.when.andReturn(mockPromise);
mockAction.perform.andReturn("the action's result");

View File

@@ -33,29 +33,41 @@ define(
actionProvider;
function SimpleAction() {
return { perform: function () { return "simple"; } };
return { perform: function () {
return "simple";
} };
}
function CategorizedAction() {
return { perform: function () { return "categorized"; } };
return { perform: function () {
return "categorized";
} };
}
CategorizedAction.category = "someCategory";
function KeyedAction() {
return { perform: function () { return "keyed"; } };
return { perform: function () {
return "keyed";
} };
}
KeyedAction.key = "someKey";
function CategorizedKeyedAction() {
return { perform: function () { return "both"; } };
return { perform: function () {
return "both";
} };
}
CategorizedKeyedAction.key = "someKey";
CategorizedKeyedAction.category = "someCategory";
function MetadataAction() {
return {
perform: function () { return "metadata"; },
getMetadata: function () { return "custom metadata"; }
perform: function () {
return "metadata";
},
getMetadata: function () {
return "custom metadata";
}
};
}
MetadataAction.key = "metadata";
@@ -152,7 +164,7 @@ define(
}
provided = new ActionProvider(
[ SimpleAction, BadAction ],
[SimpleAction, BadAction],
mockLog
).getActions();
});

View File

@@ -36,15 +36,15 @@ define(
beforeEach(function () {
mockAction = jasmine.createSpyObj(
"action",
[ "perform", "getMetadata" ]
["perform", "getMetadata"]
);
mockActionService = jasmine.createSpyObj(
"actionService",
[ "getActions" ]
["getActions"]
);
mockLog = jasmine.createSpyObj(
"$log",
[ "error", "warn", "info", "debug" ]
["error", "warn", "info", "debug"]
);
mockActionService.getActions.andReturn([mockAction]);
@@ -70,4 +70,4 @@ define(
});
}
);
);

View File

@@ -64,7 +64,7 @@ define(
mockObjectService = jasmine.createSpyObj(
"objectService",
[ "getObjects" ]
["getObjects"]
);
mockInjector = {
@@ -97,7 +97,7 @@ define(
});
it("requests ids found in model's composition from the object service", function () {
var ids = [ "a", "b", "c", "xyz" ];
var ids = ["a", "b", "c", "xyz"];
mockDomainObject.getModel.andReturn({ composition: ids });
@@ -114,7 +114,9 @@ define(
mockObjectService.getObjects.andReturn(mockPromise({x: mockChild}));
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
expect(result[0].getCapability('context')).toBeDefined();
@@ -153,7 +155,7 @@ define(
it("does not re-add IDs which are already present", function () {
var result,
testModel = { composition: [ 'a' ] },
testModel = { composition: ['a'] },
mockChild = jasmine.createSpyObj("child", DOMAIN_OBJECT_METHODS);
mockDomainObject.getModel.andReturn(testModel);
@@ -184,7 +186,7 @@ define(
it("can add objects at a specified index", function () {
var result,
testModel = { composition: [ 'a', 'b', 'c' ] },
testModel = { composition: ['a', 'b', 'c'] },
mockChild = jasmine.createSpyObj("child", DOMAIN_OBJECT_METHODS);
mockDomainObject.getModel.andReturn(testModel);

View File

@@ -46,7 +46,7 @@ define(
mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS);
mockParent = jasmine.createSpyObj("parent", DOMAIN_OBJECT_METHODS);
mockGrandparent = jasmine.createSpyObj("grandparent", DOMAIN_OBJECT_METHODS);
mockContext = jasmine.createSpyObj("context", [ "getParent", "getRoot", "getPath" ]);
mockContext = jasmine.createSpyObj("context", ["getParent", "getRoot", "getPath"]);
mockParent.getCapability.andReturn(mockContext);
mockContext.getParent.andReturn(mockGrandparent);
@@ -77,4 +77,4 @@ define(
});
}
);
);

View File

@@ -79,4 +79,4 @@ define(
});
}
);
);

View File

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

View File

@@ -36,7 +36,11 @@ define(
object = {},
delegation;
function capture(k) { return function (v) { captured[k] = v; }; }
function capture(k) {
return function (v) {
captured[k] = v;
};
}
function TestDomainObject(caps, id) {
return {
getId: function () {
@@ -67,12 +71,16 @@ define(
beforeEach(function () {
captured = {};
typeDef = {};
typeDef.delegates = [ "foo" ];
type = { getDefinition: function () { return typeDef; } };
typeDef.delegates = ["foo"];
type = { getDefinition: function () {
return typeDef;
} };
children = [];
capabilities = {
type: type,
composition: { invoke: function () { return mockPromise(children); } }
composition: { invoke: function () {
return mockPromise(children);
} }
};
object = new TestDomainObject(capabilities);
@@ -95,4 +103,4 @@ define(
});
});
}
);
);

View File

@@ -38,15 +38,15 @@ define(
mockInstantiate = jasmine.createSpy("instantiate");
mockIdentifierService = jasmine.createSpyObj(
'identifierService',
[ 'parse', 'generate' ]
['parse', 'generate']
);
mockIdentifier = jasmine.createSpyObj(
'identifier',
[ 'getSpace', 'getKey', 'getDefinedSpace' ]
['getSpace', 'getKey', 'getDefinedSpace']
);
mockDomainObject = jasmine.createSpyObj(
'domainObject',
[ 'getId', 'getCapability', 'getModel' ]
['getId', 'getCapability', 'getModel']
);
mockInjector.get.andCallFake(function (key) {

View File

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

View File

@@ -46,10 +46,10 @@ define(
then: function (callback) {
return asPromise(callback(value));
},
catch: function(callback) {
catch: function (callback) {
//Define a default 'happy' catch, that skips over the
// catch callback
return doCatch ? asPromise(callback(value)): asPromise(value);
return doCatch ? asPromise(callback(value)) : asPromise(value);
}
};
}
@@ -60,16 +60,16 @@ define(
mockPersistenceService = jasmine.createSpyObj(
"persistenceService",
[ "updateObject", "readObject", "createObject", "deleteObject" ]
["updateObject", "readObject", "createObject", "deleteObject"]
);
mockIdentifierService = jasmine.createSpyObj(
'identifierService',
[ 'parse', 'generate' ]
['parse', 'generate']
);
mockIdentifier = jasmine.createSpyObj(
'identifier',
[ 'getSpace', 'getKey', 'getDefinedSpace' ]
['getSpace', 'getKey', 'getDefinedSpace']
);
mockQ = jasmine.createSpyObj(
"$q",
@@ -81,12 +81,16 @@ define(
);
mockCacheService = jasmine.createSpyObj(
"cacheService",
[ "get", "put", "remove", "all" ]
["get", "put", "remove", "all"]
);
mockDomainObject = {
getId: function () { return id; },
getModel: function () { return model; },
getId: function () {
return id;
},
getModel: function () {
return model;
},
useCapability: jasmine.createSpy()
};
// Simulate mutation capability
@@ -107,7 +111,7 @@ define(
);
});
describe("successful persistence", function() {
describe("successful persistence", function () {
beforeEach(function () {
mockPersistenceService.updateObject.andReturn(happyPromise);
mockPersistenceService.createObject.andReturn(happyPromise);
@@ -163,9 +167,9 @@ define(
});
});
describe("unsuccessful persistence", function() {
describe("unsuccessful persistence", function () {
var sadPromise = {
then: function(callback){
then: function (callback) {
return asPromise(callback(0), true);
}
};

View File

@@ -60,7 +60,7 @@ define(
mockObjectService = jasmine.createSpyObj(
"objectService",
[ "getObjects" ]
["getObjects"]
);
mockInjector = {
@@ -85,7 +85,7 @@ define(
});
it("requests ids found in model's composition from the object service", function () {
var ids = [ "a", "b", "c", "xyz" ];
var ids = ["a", "b", "c", "xyz"];
mockDomainObject.getModel.andReturn({ relationships: { xyz: ids } });
@@ -96,7 +96,7 @@ define(
it("provides a list of relationship types", function () {
mockDomainObject.getModel.andReturn({ relationships: {
abc: [ 'a', 'b' ],
abc: ['a', 'b'],
def: "not an array, should be ignored",
xyz: []
} });
@@ -139,4 +139,4 @@ define(
});
}
);
);

View File

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

View File

@@ -37,18 +37,20 @@ define(
aggregator;
beforeEach(function () {
mockQ = jasmine.createSpyObj("$q", [ "all" ]);
mockQ = jasmine.createSpyObj("$q", ["all"]);
mockProviders = modelList.map(function (models, i) {
var mockProvider = jasmine.createSpyObj(
"mockProvider" + i,
[ "getModels" ]
["getModels"]
);
mockProvider.getModels.andReturn(models);
return mockProvider;
});
mockQ.all.andReturn({
then: function (c) { return c(modelList); }
then: function (c) {
return c(modelList);
}
});
aggregator = new ModelAggregator(mockQ, mockProviders);
@@ -72,4 +74,4 @@ define(
});
}
);
);

View File

@@ -27,7 +27,7 @@ define(['../../src/models/ModelCacheService'], function (ModelCacheService) {
cacheService;
beforeEach(function () {
testIds = [ 'a', 'b', 'c', 'd' ];
testIds = ['a', 'b', 'c', 'd'];
testModels = testIds.reduce(function (models, id) {
models[id] = { someKey: "some value for " + id };
return models;

View File

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

View File

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

View File

@@ -49,7 +49,7 @@ define(
beforeEach(function () {
mockModelService = jasmine.createSpyObj(
"modelService",
[ "getModels" ]
["getModels"]
);
mockInstantiate = jasmine.createSpy("instantiate");
@@ -64,7 +64,7 @@ define(
});
it("requests models from the model service", function () {
var ids = [ "a", "b", "c" ];
var ids = ["a", "b", "c"];
mockModelService.getModels.andReturn(mockPromise({}));
provider.getObjects(ids);
expect(mockModelService.getModels).toHaveBeenCalledWith(ids);
@@ -72,7 +72,7 @@ define(
it("instantiates objects with provided models", function () {
var ids = [ "a", "b", "c"],
var ids = ["a", "b", "c"],
model = { someKey: "some value"},
result;
mockModelService.getModels.andReturn(mockPromise({ a: model }));

View File

@@ -84,4 +84,4 @@ define(
});
}
);
);

View File

@@ -44,7 +44,7 @@ define(
mockLog = jasmine.createSpyObj(
"$log",
[ "error", "warn", "info", "debug" ]
["error", "warn", "info", "debug"]
);
mockDomainObject =

View File

@@ -45,7 +45,7 @@ define(
);
mockIdentifierService = jasmine.createSpyObj(
'identifierService',
[ 'parse', 'generate' ]
['parse', 'generate']
);
mockCapabilityConstructor = jasmine.createSpy('capability');
mockCapabilityInstance = {};
@@ -61,7 +61,7 @@ define(
mockCacheService = jasmine.createSpyObj(
'cacheService',
[ 'get', 'put', 'remove', 'all' ]
['get', 'put', 'remove', 'all']
);
testModel = { someKey: "some value" };

View File

@@ -44,4 +44,4 @@ define(
});
}
);
);

View File

@@ -34,7 +34,7 @@ define(
testMessage = { someKey: "some value"};
mockLog = jasmine.createSpyObj(
'$log',
[ 'error', 'warn', 'info', 'debug' ]
['error', 'warn', 'info', 'debug']
);
mockCallback = jasmine.createSpy('callback');
topic = new Topic(mockLog);

View File

@@ -32,32 +32,32 @@ define(
expect(mergeModels(
{
"a": "property a",
"b": [ 1, 2, 3 ],
"b": [1, 2, 3],
"c": {
x: 42,
z: [ 0 ]
z: [0]
},
"d": "should be ignored"
},
{
"b": [ 4 ],
"b": [4],
"c": {
y: "property y",
z: [ "h" ]
z: ["h"]
},
"d": "property d"
}
)).toEqual({
"a": "property a",
"b": [ 1, 2, 3, 4 ],
"b": [1, 2, 3, 4],
"c": {
x: 42,
y: "property y",
z: [ 0, "h" ]
z: [0, "h"]
},
"d": "property d"
});
});
});
}
);
);

View File

@@ -36,11 +36,11 @@ define(
beforeEach(function () {
mockTypeService = jasmine.createSpyObj(
"typeService",
[ "getType" ]
["getType"]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getModel", "getCapability" ]
["getId", "getModel", "getCapability"]
);
mockType = { someKey: "some value" };
@@ -57,4 +57,4 @@ define(
});
}
);
);

View File

@@ -36,7 +36,7 @@ define(
glyph: 't',
inherits: ['test-parent-1', 'test-parent-2'],
features: ['test-feature-1'],
properties: [ {} ],
properties: [{}],
model: {someKey: "some value"}
};
type = new TypeImpl(testTypeDef);
@@ -74,10 +74,14 @@ define(
it("supports instance-of checks by type object", function () {
expect(type.instanceOf({
getKey: function () { return 'test-parent-1'; }
getKey: function () {
return 'test-parent-1';
}
})).toBeTruthy();
expect(type.instanceOf({
getKey: function () { return 'some-other-type'; }
getKey: function () {
return 'some-other-type';
}
})).toBeFalsy();
});
@@ -110,4 +114,4 @@ define(
});
});
}
);
);

View File

@@ -28,7 +28,7 @@ define(
it("allows non-conversion when parameter is 'identity'", function () {
var conversion = new TypePropertyConversion("identity");
[ 42, "42", { a: 42 } ].forEach(function (v) {
[42, "42", { a: 42 }].forEach(function (v) {
expect(conversion.toFormValue(v)).toBe(v);
expect(conversion.toModelValue(v)).toBe(v);
});
@@ -61,4 +61,4 @@ define(
});
}
);
);

View File

@@ -57,7 +57,7 @@ define(
it("sets properties by path", function () {
var definition = {
key: "someKey",
property: [ "some", "property" ]
property: ["some", "property"]
},
model = {},
property = new TypeProperty(definition);
@@ -68,7 +68,7 @@ define(
it("gets properties by path", function () {
var definition = {
key: "someKey",
property: [ "some", "property" ]
property: ["some", "property"]
},
model = { some: { property: "some value" } },
property = new TypeProperty(definition);
@@ -78,7 +78,7 @@ define(
it("stops looking for properties when a path is invalid", function () {
var definition = {
key: "someKey",
property: [ "some", "property" ]
property: ["some", "property"]
},
property = new TypeProperty(definition);
expect(property.getValue(undefined)).toBeUndefined();
@@ -97,7 +97,7 @@ define(
it("provides empty arrays for values that are array-like", function () {
var definition = {
property: "someProperty",
items: [ {}, {}, {} ]
items: [{}, {}, {}]
},
model = {},
property = new TypeProperty(definition);
@@ -108,7 +108,7 @@ define(
it("detects and ignores empty arrays on setValue", function () {
var definition = {
property: "someProperty",
items: [ {}, {}, {} ]
items: [{}, {}, {}]
},
model = {},
property = new TypeProperty(definition);
@@ -123,4 +123,4 @@ define(
});
}
);
);

View File

@@ -146,4 +146,4 @@ define(
});
}
);
);

View File

@@ -30,17 +30,17 @@ define(
describe("A view capability", function () {
var mockViewService,
mockDomainObject,
views = [ {key: "someView"} ],
views = [{key: "someView"}],
view;
beforeEach(function () {
mockViewService = jasmine.createSpyObj(
"viewService",
[ "getViews" ]
["getViews"]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getModel", "getCapability" ]
["getId", "getModel", "getCapability"]
);
mockViewService.getViews.andReturn(views);
view = new ViewCapability(mockViewService, mockDomainObject);
@@ -55,4 +55,4 @@ define(
});
}
);
);

View File

@@ -33,11 +33,11 @@ define(
},
viewB = {
key: "b",
needs: [ "someCapability" ]
needs: ["someCapability"]
},
viewC = {
key: "c",
needs: [ "someCapability" ],
needs: ["someCapability"],
delegation: true
},
capabilities = {},
@@ -158,4 +158,4 @@ define(
});
}
);
);