From 93d969ad671636ff9b81d2ad7d71fb556dc4044f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 10 Nov 2015 16:17:43 -0800 Subject: [PATCH] [Plot] Add tests ...to verify that data is requeried when user changes domain or range selection. --- .../features/plot/test/PlotControllerSpec.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/features/plot/test/PlotControllerSpec.js b/platform/features/plot/test/PlotControllerSpec.js index addbdf5032..8edab2fc6d 100644 --- a/platform/features/plot/test/PlotControllerSpec.js +++ b/platform/features/plot/test/PlotControllerSpec.js @@ -53,6 +53,14 @@ define( }); } + function fireWatch(expr, value) { + mockScope.$watch.calls.forEach(function (call) { + if (call.args[0] === expr) { + call.args[1].apply(null, [value]); + } + }); + } + beforeEach(function () { mockScope = jasmine.createSpyObj( @@ -263,6 +271,20 @@ define( ]); expect(mockHandle.request.calls.length).toEqual(2); }); + + it("requeries when user changes domain selection", function () { + mockScope.$watch.mostRecentCall.args[1](mockDomainObject); + expect(mockHandle.request.calls.length).toEqual(1); + fireWatch("axes[0].active.key", 'someNewKey'); + expect(mockHandle.request.calls.length).toEqual(2); + }); + + it("requeries when user changes range selection", function () { + mockScope.$watch.mostRecentCall.args[1](mockDomainObject); + expect(mockHandle.request.calls.length).toEqual(1); + fireWatch("axes[1].active.key", 'someNewKey'); + expect(mockHandle.request.calls.length).toEqual(2); + }); }); } );