Fixed jslint issues

This commit is contained in:
Andrew Henry 2015-11-04 20:48:22 -08:00
parent b73f9fc19e
commit 863c3f1720
5 changed files with 33 additions and 35 deletions

View File

@ -222,7 +222,7 @@ define(
* functions to dismiss or minimize
*/
NotificationService.prototype.info = function (model) {
var notificationModel = typeof model === "string" ? {title: model} : model
var notificationModel = typeof model === "string" ? {title: model} : model;
notificationModel.autoDismiss = notificationModel.autoDismiss || true;
notificationModel.severity = "info";
return this.notify(notificationModel);

View File

@ -68,7 +68,7 @@ define(
this.dialog = this.dialogService.showBlockingMessage({
title: "Preparing to copy objects",
unknownProgress: true,
severity: "info",
severity: "info"
});
} else if (phase.toLowerCase() === "copying") {
this.dialogService.dismiss();
@ -84,7 +84,7 @@ define(
this.notification.model.title = ["Copied ", processed, "of ",
totalObjects, "objects"].join(" ");
}
}
};
/**
* Executes the CopyAction. The CopyAction uses the default behaviour of
@ -100,18 +100,18 @@ define(
self.notification.dismiss();
self.notificationService.info("Copying complete.");
},
function error(error){
self.$log.error("Error copying objects. ", error);
function error(errorDetails){
self.$log.error("Error copying objects. ", errorDetails);
//Show more general error message
self.notificationService.notify({
title: "Error copying objects.",
severity: "error",
hint: error.message
hint: errorDetails.message
});
},
function notification(notification){
self.progress(notification.phase, notification.totalObjects, notification.processed);
function notification(details){
self.progress(details.phase, details.totalObjects, details.processed);
}
);
};

View File

@ -93,7 +93,7 @@ define(
id: uuid(),
model: makeClone(originalObject.getModel()),
persistenceSpace: originalParent.getCapability('persistence')
}
};
delete modelClone.model.composition;
delete modelClone.model.persisted;
delete modelClone.model.modified;
@ -123,7 +123,7 @@ define(
return modelClone;
});
});
};
}
return copy(domainObject, parent).then(function(domainObjectClone){
//If the domain object being cloned is not a link, set its
@ -133,7 +133,7 @@ define(
}
return clones;
});
}
};
/**
* Will persist a list of {@link objectClones}. It will persist all
@ -152,13 +152,13 @@ define(
clone.model.persisted = self.now();
return self.persistenceService.createObject(clone.persistenceSpace, clone.id, clone.model)
.then(function(){
progress && progress({phase: "copying", totalObjects: objectClones.length, processed: ++persisted});
return progress && progress({phase: "copying", totalObjects: objectClones.length, processed: ++persisted});
});
})).then(function(){
return objectClones
return objectClones;
});
}
}
};
};
/**
* Will add a list of clones to the specified parent's composition
@ -177,12 +177,12 @@ define(
return self.persistenceService
.updateObject(parentClone.persistenceSpace, parentClone.id, parentClone.model)
.then(function(){return parent.getCapability("composition").add(parentClone.id)})
.then(function(){return parent.getCapability("persistence").persist()})
.then(function(){return parentClone});
.then(function(){return parent.getCapability("composition").add(parentClone.id);})
.then(function(){return parent.getCapability("persistence").persist();})
.then(function(){return parentClone;});
// Ensure the clone of the original domainObject is returned
}
}
};
};
/**
* Creates a duplicate of the object tree starting at domainObject to
@ -207,7 +207,7 @@ define(
"Tried to copy objects without validating first."
);
}
}
};
return CopyService;
}

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,beforeEach,it,jasmine,expect */
/*global define,describe,beforeEach,it,jasmine,expect,spyOn */
define(
[
@ -101,10 +101,9 @@ define(
);
abstractComposePromise.then.andCallFake(function(success, error, notify){
notify(progress);
success();
}
)
notify(progress);
success();
});
locationServicePromise.then.andCallFake(function(callback){
callback(newParent);

View File

@ -137,7 +137,8 @@ define(
copyResult,
copyFinished,
persistObjectPromise,
parentPersistenceCapability;
parentPersistenceCapability,
resolvedValue;
beforeEach(function () {
creationService = jasmine.createSpyObj(
@ -167,18 +168,16 @@ define(
mockNow = jasmine.createSpyObj("mockNow", ["now"]);
mockNow.now.andCallFake(function(){
return 1234;
})
var resolvedValue;
});
mockDeferred = jasmine.createSpyObj('mockDeferred', ['notify', 'resolve']);
mockDeferred.notify.andCallFake(function(notification){});
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value})
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;});
mockDeferred.promise = {
then: function(callback){
return synchronousPromise(callback(resolvedValue));
}
}
};
mockQ = jasmine.createSpyObj('mockQ', ['when', 'all', 'reject', 'defer']);
mockQ.when.andCallFake(synchronousPromise);
@ -330,8 +329,8 @@ define(
it("copies object and children in a bottom-up" +
" fashion", function () {
expect(mockPersistenceService.createObject.calls[0].args[2].name).toEqual(childObject.model.name)
expect(mockPersistenceService.createObject.calls[1].args[2].name).toEqual(object.model.name)
expect(mockPersistenceService.createObject.calls[0].args[2].name).toEqual(childObject.model.name);
expect(mockPersistenceService.createObject.calls[1].args[2].name).toEqual(object.model.name);
});
it("returns a promise", function () {
@ -355,7 +354,7 @@ define(
Preserves links
*/
it ("correctly locates cloned objects", function() {
expect(mockPersistenceService.createObject.calls[0].args[2].location).toEqual(mockPersistenceService.createObject.calls[1].args[1])
expect(mockPersistenceService.createObject.calls[0].args[2].location).toEqual(mockPersistenceService.createObject.calls[1].args[1]);
});
});