[Plot] Switched to $watchCollection on form model

This commit is contained in:
Henry
2016-02-09 20:51:56 -08:00
parent 645bd5743f
commit ab1c79f25d
10 changed files with 30 additions and 70 deletions

View File

@ -28,21 +28,11 @@ define(
describe("The Plot Options form", function () {
var plotOptionsForm,
mockTopicFunction,
mockTopicObject,
listener;
beforeEach(function () {
mockTopicObject = jasmine.createSpyObj('Topic', [
'listen',
'notify'
]);
mockTopicFunction = function() {
return mockTopicObject;
};
plotOptionsForm = new PlotOptionsForm(mockTopicFunction);
plotOptionsForm = new PlotOptionsForm();
});
it("defines form specs for x-axis, y-axis, and series data", function () {
@ -55,19 +45,6 @@ define(
expect(plotOptionsForm.plotSeriesForm).toBeDefined();
});
it("uses a topic to register a listener and inform them when a" +
" form value changes", function () {
var changedValue = 'changedValue';
expect(plotOptionsForm.xAxisForm.onchange).toBeDefined();
plotOptionsForm.listen(listener);
expect(mockTopicObject.listen).toHaveBeenCalledWith(listener);
plotOptionsForm.xAxisForm.onchange(changedValue);
expect(mockTopicObject.notify).toHaveBeenCalledWith(changedValue);
});
});
}
);