[Limits] Test limit usage from Fixed Position

WTD-1337
This commit is contained in:
Victor Woeltjen 2015-12-07 12:33:29 -08:00
parent ed7e0d8b0a
commit 33c372765f

View File

@ -423,6 +423,42 @@ define(
// Style should have been updated // Style should have been updated
expect(controller.selected().style).not.toEqual(oldStyle); expect(controller.selected().style).not.toEqual(oldStyle);
}); });
it("reflects limit status", function () {
var elements;
mockHandle.getDatum.andReturn({});
mockHandle.getTelemetryObjects().forEach(function (mockObject) {
var id = mockObject.getId(),
mockLimitCapability =
jasmine.createSpyObj('limit-' + id, ['evaluate']);
mockObject.getCapability.andCallFake(function (key) {
return (key === 'limit') && mockLimitCapability;
});
mockLimitCapability.evaluate
.andReturn({ cssClass: 'alarm-' + id });
});
// Initialize
mockScope.domainObject = mockDomainObject;
mockScope.model = testModel;
findWatch("domainObject")(mockDomainObject);
findWatch("model.modified")(1);
findWatch("model.composition")(mockScope.model.composition);
// Invoke the subscription callback
mockHandler.handle.mostRecentCall.args[1]();
// Get elements that controller is now exposing
elements = controller.getElements();
// Limit-based CSS classes should be available
expect(elements[0].cssClass).toEqual("alarm-a");
expect(elements[1].cssClass).toEqual("alarm-b");
expect(elements[2].cssClass).toEqual("alarm-c");
});
}); });
} }
); );