[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -39,8 +39,8 @@ define(
|
||||
* Resolve the promise, passing the supplied value to all resolve
|
||||
* handlers.
|
||||
*/
|
||||
ControlledPromise.prototype.resolve = function(value) {
|
||||
this.resolveHandlers.forEach(function(handler) {
|
||||
ControlledPromise.prototype.resolve = function (value) {
|
||||
this.resolveHandlers.forEach(function (handler) {
|
||||
handler(value);
|
||||
});
|
||||
};
|
||||
@@ -49,8 +49,8 @@ define(
|
||||
* Reject the promise, passing the supplied value to all rejection
|
||||
* handlers.
|
||||
*/
|
||||
ControlledPromise.prototype.reject = function(value) {
|
||||
this.rejectHandlers.forEach(function(handler) {
|
||||
ControlledPromise.prototype.reject = function (value) {
|
||||
this.rejectHandlers.forEach(function (handler) {
|
||||
handler(value);
|
||||
});
|
||||
};
|
||||
@@ -63,11 +63,11 @@ define(
|
||||
var returnPromise = new ControlledPromise();
|
||||
|
||||
if (onResolve) {
|
||||
this.resolveHandlers.push(function(resolveWith) {
|
||||
this.resolveHandlers.push(function (resolveWith) {
|
||||
var chainResult = onResolve(resolveWith);
|
||||
if (chainResult && chainResult.then) {
|
||||
// chainResult is a promise, resolve when it resolves.
|
||||
chainResult.then(function(pipedResult) {
|
||||
chainResult.then(function (pipedResult) {
|
||||
return returnPromise.resolve(pipedResult);
|
||||
});
|
||||
} else {
|
||||
@@ -77,10 +77,10 @@ define(
|
||||
}
|
||||
|
||||
if (onReject) {
|
||||
this.rejectHandlers.push(function(rejectWith) {
|
||||
this.rejectHandlers.push(function (rejectWith) {
|
||||
var chainResult = onReject(rejectWith);
|
||||
if (chainResult && chainResult.then) {
|
||||
chainResult.then(function(pipedResult) {
|
||||
chainResult.then(function (pipedResult) {
|
||||
returnPromise.reject(pipedResult);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -153,4 +153,4 @@ define(
|
||||
|
||||
return domainObjectFactory;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -45,7 +45,7 @@ define(
|
||||
beforeEach(function () {
|
||||
policyService = jasmine.createSpyObj(
|
||||
'policyService',
|
||||
[ 'allow' ]
|
||||
['allow']
|
||||
);
|
||||
|
||||
selectedObjectContextCapability = jasmine.createSpyObj(
|
||||
|
||||
@@ -51,7 +51,7 @@ define(
|
||||
beforeEach(function () {
|
||||
policyService = jasmine.createSpyObj(
|
||||
'policyService',
|
||||
[ 'allow' ]
|
||||
['allow']
|
||||
);
|
||||
policyService.allow.andReturn(true);
|
||||
|
||||
@@ -105,12 +105,12 @@ define(
|
||||
]
|
||||
);
|
||||
|
||||
abstractComposePromise.then.andCallFake(function(success, error, notify){
|
||||
abstractComposePromise.then.andCallFake(function (success, error, notify) {
|
||||
notify(progress);
|
||||
success();
|
||||
});
|
||||
|
||||
locationServicePromise.then.andCallFake(function(callback){
|
||||
locationServicePromise.then.andCallFake(function (callback) {
|
||||
callback(newParent);
|
||||
return abstractComposePromise;
|
||||
});
|
||||
@@ -191,7 +191,7 @@ define(
|
||||
.toHaveBeenCalledWith(selectedObject, newParent);
|
||||
});
|
||||
|
||||
it("notifies the user of progress", function(){
|
||||
it("notifies the user of progress", function () {
|
||||
expect(notificationService.info).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockLocationCapability = jasmine.createSpyObj(
|
||||
'location',
|
||||
[ 'isLink', 'isOriginal', 'getOriginal' ]
|
||||
['isLink', 'isOriginal', 'getOriginal']
|
||||
);
|
||||
mockOriginalActionCapability = jasmine.createSpyObj(
|
||||
'action',
|
||||
[ 'perform', 'getActions' ]
|
||||
['perform', 'getActions']
|
||||
);
|
||||
originalPromise = new ControlledPromise();
|
||||
mockLocationCapability.getOriginal.andReturn(originalPromise);
|
||||
|
||||
@@ -45,7 +45,7 @@ define(
|
||||
beforeEach(function () {
|
||||
policyService = jasmine.createSpyObj(
|
||||
'policyService',
|
||||
[ 'allow' ]
|
||||
['allow']
|
||||
);
|
||||
policyService.allow.andReturn(true);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ define(
|
||||
beforeEach(function () {
|
||||
policyService = jasmine.createSpyObj(
|
||||
'policyService',
|
||||
[ 'allow' ]
|
||||
['allow']
|
||||
);
|
||||
policyService.allow.andReturn(true);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ define(
|
||||
|
||||
mockLocationCapability = jasmine.createSpyObj(
|
||||
'location',
|
||||
[ 'setPrimaryLocation', 'getContextualLocation' ]
|
||||
['setPrimaryLocation', 'getContextualLocation']
|
||||
);
|
||||
|
||||
mockLocationCapability.getContextualLocation.andReturn(testId);
|
||||
|
||||
@@ -54,7 +54,7 @@ define(
|
||||
// only define those in mocks.
|
||||
mockAction = jasmine.createSpyObj(
|
||||
'action',
|
||||
[ 'getMetadata' ]
|
||||
['getMetadata']
|
||||
);
|
||||
mockAction.getMetadata.andReturn(testActionMetadata);
|
||||
|
||||
|
||||
@@ -145,12 +145,12 @@ define(
|
||||
|
||||
instantiationCapability = jasmine.createSpyObj(
|
||||
"instantiation",
|
||||
[ "invoke" ]
|
||||
["invoke"]
|
||||
);
|
||||
|
||||
persistenceCapability = jasmine.createSpyObj(
|
||||
"persistenceCapability",
|
||||
[ "persist", "getSpace" ]
|
||||
["persist", "getSpace"]
|
||||
);
|
||||
persistenceCapability.persist.andReturn(persistObjectPromise);
|
||||
|
||||
@@ -170,10 +170,12 @@ define(
|
||||
'mockDeferred',
|
||||
['notify', 'resolve', 'reject']
|
||||
);
|
||||
mockDeferred.notify.andCallFake(function(){});
|
||||
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;});
|
||||
mockDeferred.notify.andCallFake(function () {});
|
||||
mockDeferred.resolve.andCallFake(function (value) {
|
||||
resolvedValue = value;
|
||||
});
|
||||
mockDeferred.promise = {
|
||||
then: function(callback){
|
||||
then: function (callback) {
|
||||
return synchronousPromise(callback(resolvedValue));
|
||||
}
|
||||
};
|
||||
@@ -187,12 +189,14 @@ define(
|
||||
mockQ.all.andCallFake(function (promises) {
|
||||
var result = {};
|
||||
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);
|
||||
});
|
||||
mockQ.defer.andReturn(mockDeferred);
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe("on domain object without composition", function () {
|
||||
@@ -238,7 +242,7 @@ define(
|
||||
});
|
||||
|
||||
instantiationCapability.invoke.andCallFake(
|
||||
function(model){
|
||||
function (model) {
|
||||
objectCopy.model = model;
|
||||
return objectCopy;
|
||||
}
|
||||
@@ -254,7 +258,7 @@ define(
|
||||
expect(persistenceCapability.persist)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
it("deep clones object model", function () {
|
||||
var newModel = copyFinished.calls[0].args[0].getModel();
|
||||
expect(newModel).toEqual(object.model);
|
||||
@@ -279,7 +283,7 @@ define(
|
||||
objectClones;
|
||||
|
||||
instantiationCapability.invoke.andCallFake(
|
||||
function(model){
|
||||
function (model) {
|
||||
var cloneToReturn = objectClones[invocationCount++];
|
||||
cloneToReturn.model = model;
|
||||
return cloneToReturn;
|
||||
@@ -362,8 +366,8 @@ define(
|
||||
copyService = new CopyService(mockQ, policyService);
|
||||
});
|
||||
|
||||
describe("the cloning process", function(){
|
||||
beforeEach(function() {
|
||||
describe("the cloning process", function () {
|
||||
beforeEach(function () {
|
||||
copyResult = copyService.perform(object, newParent);
|
||||
copyFinished = jasmine.createSpy('copyFinished');
|
||||
copyResult.then(copyFinished);
|
||||
@@ -379,23 +383,23 @@ define(
|
||||
expect(copyFinished).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it ("correctly locates cloned objects", function() {
|
||||
it ("correctly locates cloned objects", function () {
|
||||
expect(childObjectClone.getModel().location).toEqual(objectClone.getId());
|
||||
});
|
||||
});
|
||||
|
||||
describe("when cloning non-creatable objects", function() {
|
||||
describe("when cloning non-creatable objects", function () {
|
||||
beforeEach(function () {
|
||||
policyService.allow.andCallFake(function(category){
|
||||
policyService.allow.andCallFake(function (category) {
|
||||
//Return false for 'creation' policy
|
||||
return category !== 'creation';
|
||||
return category !== 'creation';
|
||||
});
|
||||
|
||||
copyResult = copyService.perform(object, newParent);
|
||||
copyFinished = jasmine.createSpy('copyFinished');
|
||||
copyResult.then(copyFinished);
|
||||
});
|
||||
it ("creates link instead of clone", function() {
|
||||
it ("creates link instead of clone", function () {
|
||||
var copiedObject = copyFinished.calls[0].args[0];
|
||||
expect(copiedObject).toBe(object);
|
||||
expect(compositionCapability.add)
|
||||
@@ -412,7 +416,7 @@ define(
|
||||
}
|
||||
|
||||
it("does not create new instances of objects " +
|
||||
"rejected by the filter", function() {
|
||||
"rejected by the filter", function () {
|
||||
copyService.perform(object, newParent, reject)
|
||||
.then(copyFinished);
|
||||
expect(copyFinished.mostRecentCall.args[0])
|
||||
@@ -420,7 +424,7 @@ define(
|
||||
});
|
||||
|
||||
it("does create new instances of objects " +
|
||||
"accepted by the filter", function() {
|
||||
"accepted by the filter", function () {
|
||||
copyService.perform(object, newParent, accept)
|
||||
.then(copyFinished);
|
||||
expect(copyFinished.mostRecentCall.args[0])
|
||||
|
||||
@@ -100,11 +100,11 @@ define(
|
||||
cloneIds = {};
|
||||
|
||||
testModel = {
|
||||
composition: [ ID_A, ID_B ],
|
||||
composition: [ID_A, ID_B],
|
||||
someObj: {},
|
||||
someArr: [ ID_A, ID_B ],
|
||||
someArr: [ID_A, ID_B],
|
||||
objArr: [{"id": ID_A}, {"id": ID_B}],
|
||||
singleElementArr: [ ID_A ]
|
||||
singleElementArr: [ID_A]
|
||||
};
|
||||
testModel.someObj[ID_A] = "some value";
|
||||
testModel.someObj.someProperty = ID_B;
|
||||
@@ -120,7 +120,7 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when', 'defer', 'all']);
|
||||
mockDeferred = jasmine.createSpyObj(
|
||||
'deferred',
|
||||
[ 'notify', 'resolve', 'reject' ]
|
||||
['notify', 'resolve', 'reject']
|
||||
);
|
||||
|
||||
mockFilter.andReturn(true);
|
||||
@@ -130,7 +130,9 @@ define(
|
||||
mockQ.all.andCallFake(function (promises) {
|
||||
return synchronousPromise(promises.map(function (promise) {
|
||||
var value;
|
||||
promise.then(function (v) { value = v; });
|
||||
promise.then(function (v) {
|
||||
value = v;
|
||||
});
|
||||
return value;
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -76,7 +76,9 @@ define(
|
||||
mockQ.all.andCallFake(function (promises) {
|
||||
var result = {};
|
||||
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);
|
||||
});
|
||||
@@ -88,7 +90,7 @@ define(
|
||||
Object.keys(testModels).forEach(function (id) {
|
||||
testObjects[id] = jasmine.createSpyObj(
|
||||
"domainObject-" + id,
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
["getId", "getModel", "getCapability"]
|
||||
);
|
||||
testObjects[id].getId.andReturn(id);
|
||||
testObjects[id].getModel.andReturn(testModels[id]);
|
||||
|
||||
@@ -63,7 +63,9 @@ define(
|
||||
beforeEach(function () {
|
||||
title = "Get a location to do something";
|
||||
label = "a location";
|
||||
validate = function () { return true; };
|
||||
validate = function () {
|
||||
return true;
|
||||
};
|
||||
initialLocation = { key: "a key" };
|
||||
locationResult = locationService.getLocationFromUser(
|
||||
title,
|
||||
|
||||
Reference in New Issue
Block a user