[Views] Update representations on mutation (#1312)
* [Core] Log errors from topic Log full error (including stack trace) when catching errors from the topic service. Aids debugging of #1303 (and should aid in future debugging of any similar issues.) * [API] Fix identifier usage in handleMutation To address console errors observed in the context of #1303 * [Views] Listen to mutation Listen for mutation instead of watching modified timestamp; more reliable due to recent API changes. Fixes #1303. * [Views] Update spec for mct-representation ...to reflect changes for #1303
This commit is contained in:
committed by
Pete Richards
parent
547696d797
commit
9578fb0cd8
@@ -36,7 +36,7 @@ define(
|
||||
testViews,
|
||||
testUrls,
|
||||
mockRepresenters,
|
||||
mockStatusCapability,
|
||||
mockMutationCapability,
|
||||
mockQ,
|
||||
mockLinker,
|
||||
mockLog,
|
||||
@@ -119,7 +119,8 @@ define(
|
||||
mockChangeTemplate = jasmine.createSpy('changeTemplate');
|
||||
mockLog = jasmine.createSpyObj("$log", LOG_FUNCTIONS);
|
||||
|
||||
mockStatusCapability = jasmine.createSpyObj("statusCapability", ["listen"]);
|
||||
mockMutationCapability =
|
||||
jasmine.createSpyObj("mutation", ["listen"]);
|
||||
|
||||
mockScope = jasmine.createSpyObj("scope", ["$watch", "$on"]);
|
||||
mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS);
|
||||
@@ -132,7 +133,7 @@ define(
|
||||
});
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
return c === 'status' && mockStatusCapability;
|
||||
return c === 'mutation' && mockMutationCapability;
|
||||
});
|
||||
|
||||
mctRepresentation = new MCTRepresentation(
|
||||
@@ -164,10 +165,6 @@ define(
|
||||
"domainObject",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
expect(mockScope.$watch).toHaveBeenCalledWith(
|
||||
"domainObject.getModel().modified",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
});
|
||||
|
||||
it("recognizes keys for representations", function () {
|
||||
@@ -272,10 +269,16 @@ define(
|
||||
);
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
return c === 'context' && mockContext;
|
||||
return {
|
||||
context: mockContext,
|
||||
mutation: mockMutationCapability
|
||||
}[c];
|
||||
});
|
||||
mockLink.getCapability.andCallFake(function (c) {
|
||||
return c === 'context' && mockContext2;
|
||||
return {
|
||||
context: mockContext2,
|
||||
mutation: mockMutationCapability
|
||||
}[c];
|
||||
});
|
||||
mockDomainObject.hasCapability.andCallFake(function (c) {
|
||||
return c === 'context';
|
||||
@@ -299,6 +302,11 @@ define(
|
||||
mockScope.$watch.calls[0].args[1]();
|
||||
});
|
||||
|
||||
it("listens for mutation of that object", function () {
|
||||
expect(mockMutationCapability.listen)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("detects subsequent changes among linked instances", function () {
|
||||
var callCount = mockChangeTemplate.calls.length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user