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); + }); }); } );