Added tests
This commit is contained in:
@@ -236,7 +236,7 @@ define(
|
||||
expect(mockLog.warn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("clears out obsolete peroperties from scope", function () {
|
||||
it("clears out obsolete properties from scope", function () {
|
||||
mockScope.key = "def";
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
mockDomainObject.useCapability.andReturn("some value");
|
||||
@@ -253,6 +253,21 @@ define(
|
||||
expect(mockScope.testCapability).toBeUndefined();
|
||||
});
|
||||
|
||||
it("registers a status change listener", function () {
|
||||
mockScope.$watch.calls[2].args[1](mockDomainObject);
|
||||
expect(mockStatusCapability.listen).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("unlistens for status change on scope destruction", function () {
|
||||
var mockUnlistener = jasmine.createSpy("unlisten");
|
||||
mockStatusCapability.listen.andReturn(mockUnlistener);
|
||||
mockScope.$watch.calls[2].args[1](mockDomainObject);
|
||||
expect(mockStatusCapability.listen).toHaveBeenCalled();
|
||||
|
||||
mockScope.$on.calls[1].args[1]();
|
||||
expect(mockUnlistener).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("when a domain object has been observed", function () {
|
||||
var mockContext,
|
||||
mockContext2,
|
||||
@@ -314,6 +329,7 @@ define(
|
||||
mockScope.$watch.calls[0].args[1]();
|
||||
expect(mockChangeTemplate.calls.length).toEqual(callCount);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user