From c436bcce0a405ea01e7debefe967b5fc712c3809 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 30 Dec 2015 09:29:24 -0800 Subject: [PATCH] [Time Conductor] Test updated fixed position behavior Verify interactions from FixedControllers on events issued by the time conductor. --- .../layout/test/FixedControllerSpec.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/platform/features/layout/test/FixedControllerSpec.js b/platform/features/layout/test/FixedControllerSpec.js index 31d5e06659..0be6fec4f3 100644 --- a/platform/features/layout/test/FixedControllerSpec.js +++ b/platform/features/layout/test/FixedControllerSpec.js @@ -423,6 +423,59 @@ define( // Style should have been updated expect(controller.selected().style).not.toEqual(oldStyle); }); + + describe("on display bounds changes", function () { + var testBounds; + + beforeEach(function () { + testBounds = { start: 123, end: 321 }; + mockScope.domainObject = mockDomainObject; + mockScope.model = testModel; + findWatch("domainObject")(mockDomainObject); + findWatch("model.modified")(testModel.modified); + findWatch("model.composition")(mockScope.model.composition); + findOn('telemetry:display:bounds')({}, testBounds); + }); + + it("issues new requests", function () { + expect(mockHandle.request).toHaveBeenCalled(); + }); + + it("requests only a single point", function () { + expect(mockHandle.request.mostRecentCall.args[0].size) + .toEqual(1); + }); + + describe("and after data has been received", function () { + var mockSeries, + testValue; + + beforeEach(function () { + testValue = 12321; + + mockSeries = jasmine.createSpyObj('series', [ + 'getPointCount', + 'getDomainValue', + 'getRangeValue' + ]); + mockSeries.getPointCount.andReturn(1); + mockSeries.getRangeValue.andReturn(testValue); + + // Fire the callback associated with the request + mockHandle.request.mostRecentCall.args[1]( + mockHandle.getTelemetryObjects()[0], + mockSeries + ); + }); + + it("updates displayed values", function () { + expect(controller.getElements()[0].value) + .toEqual("Formatted " + testValue); + }); + }); + + }); + }); } );