[Core] Add dependency to mutation

Add the 'topic' dependency to the mutation capability,
WTD-1329.
This commit is contained in:
Victor Woeltjen 2015-06-24 12:08:47 -07:00
parent 1a6d92ee4e
commit 877461c4a4
3 changed files with 15 additions and 6 deletions

View File

@ -172,7 +172,7 @@
{ {
"key": "mutation", "key": "mutation",
"implementation": "capabilities/MutationCapability.js", "implementation": "capabilities/MutationCapability.js",
"depends": [ "now" ] "depends": [ "topic", "now" ]
}, },
{ {
"key": "delegation", "key": "delegation",
@ -202,4 +202,4 @@
} }
] ]
} }
} }

View File

@ -71,7 +71,7 @@ define(
* which will expose this capability * which will expose this capability
* @constructor * @constructor
*/ */
function MutationCapability(now, domainObject) { function MutationCapability(topic, now, domainObject) {
var listeners = []; var listeners = [];
function notifyListeners(model) { function notifyListeners(model) {

View File

@ -25,21 +25,30 @@
* MutationCapabilitySpec. Created by vwoeltje on 11/6/14. * MutationCapabilitySpec. Created by vwoeltje on 11/6/14.
*/ */
define( define(
["../../src/capabilities/MutationCapability"], [
function (MutationCapability) { "../../src/capabilities/MutationCapability",
"../../src/services/Topic"
],
function (MutationCapability, Topic) {
"use strict"; "use strict";
describe("The mutation capability", function () { describe("The mutation capability", function () {
var testModel, var testModel,
topic,
mockNow, mockNow,
domainObject = { getModel: function () { return testModel; } }, domainObject = { getModel: function () { return testModel; } },
mutation; mutation;
beforeEach(function () { beforeEach(function () {
testModel = { number: 6 }; testModel = { number: 6 };
topic = new Topic();
mockNow = jasmine.createSpy('now'); mockNow = jasmine.createSpy('now');
mockNow.andReturn(12321); mockNow.andReturn(12321);
mutation = new MutationCapability(mockNow, domainObject); mutation = new MutationCapability(
topic,
mockNow,
domainObject
);
}); });
it("allows mutation of a model", function () { it("allows mutation of a model", function () {