[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",
"implementation": "capabilities/MutationCapability.js",
"depends": [ "now" ]
"depends": [ "topic", "now" ]
},
{
"key": "delegation",
@ -202,4 +202,4 @@
}
]
}
}
}

View File

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

View File

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