From c9300e8611d4c2e6470fd2d6ca664b234e4d2c69 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 1 Dec 2014 16:44:16 -0800 Subject: [PATCH] [Plot] Initial spec for PlotController Add initial spec for PlotController, the main controller to support the plot view. WTD-533. --- platform/features/plot/src/PlotController.js | 6 ++-- .../features/plot/test/PlotControllerSpec.js | 33 +++++++++++++++++++ platform/features/plot/test/suite.json | 4 +++ 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 platform/features/plot/test/PlotControllerSpec.js create mode 100644 platform/features/plot/test/suite.json diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index df424984b1..c33619a1f0 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -84,10 +84,8 @@ define( tickGenerator.generateRangeTicks(RANGE_TICKS); } - function plotTelemetry() { - var telemetry, prepared, data; - - telemetry = $scope.telemetry; + function plotTelemetry(telemetry) { + var prepared, data; if (!telemetry) { return; diff --git a/platform/features/plot/test/PlotControllerSpec.js b/platform/features/plot/test/PlotControllerSpec.js new file mode 100644 index 0000000000..e01b158f4f --- /dev/null +++ b/platform/features/plot/test/PlotControllerSpec.js @@ -0,0 +1,33 @@ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +/** + * MergeModelsSpec. Created by vwoeltje on 11/6/14. + */ +define( + ["../src/PlotController"], + function (PlotController) { + "use strict"; + + describe("The plot controller", function () { + var mockScope, + controller; + + beforeEach(function () { + mockScope = jasmine.createSpyObj( + "$scope", + [ "$watch", "$on" ] + ); + controller = new PlotController(mockScope); + }); + + it("listens for telemetry updates", function () { + expect(mockScope.$on).toHaveBeenCalledWith( + "telemetryUpdate", + jasmine.any(Function) + ); + }); + + + }); + } +); \ No newline at end of file diff --git a/platform/features/plot/test/suite.json b/platform/features/plot/test/suite.json new file mode 100644 index 0000000000..fa100f3e4c --- /dev/null +++ b/platform/features/plot/test/suite.json @@ -0,0 +1,4 @@ +[ + "PlotController" +] +