[Core] Remove dependency

Remove  dependency from the mutation capability;
it recognizes and handles promises internally, instead.
WTD-931.
This commit is contained in:
Victor Woeltjen 2015-03-11 17:38:40 -07:00
parent 00daa32f56
commit 222aa55dd7
3 changed files with 3 additions and 17 deletions

View File

@ -151,8 +151,7 @@
},
{
"key": "mutation",
"implementation": "capabilities/MutationCapability.js",
"depends": [ "$q" ]
"implementation": "capabilities/MutationCapability.js"
},
{
"key": "delegation",

View File

@ -46,12 +46,11 @@ define(
* });
* ```
*
* @param $q Angular's $q service, for promises
* @param {DomainObject} domainObject the domain object
* which will expose this capability
* @constructor
*/
function MutationCapability($q, domainObject) {
function MutationCapability(domainObject) {
function mutate(mutator) {
// Get the object's model and clone it, so the

View File

@ -13,21 +13,9 @@ define(
domainObject = { getModel: function () { return testModel; } },
mutation;
function mockPromise(value) {
return {
then: function (callback) {
return (value && value.then) ?
value : mockPromise(callback(value));
}
};
}
beforeEach(function () {
testModel = { number: 6 };
mutation = new MutationCapability(
{ when: mockPromise }, // $q
domainObject
);
mutation = new MutationCapability(domainObject);
});
it("allows mutation of a model", function () {