From d6a31dcef38bb213ff7723820f061dc397594741 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 23 Jun 2015 14:17:28 -0700 Subject: [PATCH] [Plot] Update failing specs Update failing specs for changes related to fixed duration plots, WTD-1273. --- .../general/test/directives/MCTDragSpec.js | 19 ++++++++++++------- platform/features/plot/src/SubPlot.js | 2 +- platform/features/plot/test/SubPlotSpec.js | 10 +++++----- .../plot/test/elements/PlotLineBufferSpec.js | 5 +---- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/platform/commonUI/general/test/directives/MCTDragSpec.js b/platform/commonUI/general/test/directives/MCTDragSpec.js index 3f4f1dcadf..1d4568f72b 100644 --- a/platform/commonUI/general/test/directives/MCTDragSpec.js +++ b/platform/commonUI/general/test/directives/MCTDragSpec.js @@ -81,10 +81,11 @@ define( }); it("invokes mctDragDown when dragging begins", function () { - mockElement.on.mostRecentCall.args[1](testEvent(42, 60)); + var event = testEvent(42, 60); + mockElement.on.mostRecentCall.args[1](event); expect(mockScope.$eval).toHaveBeenCalledWith( testAttrs.mctDragDown, - { delta: [0, 0] } + { delta: [0, 0], $event: event } ); }); @@ -101,23 +102,27 @@ define( }); it("invokes mctDrag expression during drag", function () { + var event; + mockElement.on.mostRecentCall.args[1](testEvent(42, 60)); // Find and invoke the mousemove listener mockBody.on.calls.forEach(function (call) { if (call.args[0] === 'mousemove') { - call.args[1](testEvent(52, 200)); + call.args[1](event = testEvent(52, 200)); } }); // Should have passed that delta to mct-drag expression expect(mockScope.$eval).toHaveBeenCalledWith( testAttrs.mctDrag, - { delta: [10, 140] } + { delta: [10, 140], $event: event } ); }); it("invokes mctDragUp expression after drag", function () { + var event; + mockElement.on.mostRecentCall.args[1](testEvent(42, 60)); // Find and invoke the mousemove listener @@ -129,7 +134,7 @@ define( // Find and invoke the mousemove listener mockBody.on.calls.forEach(function (call) { if (call.args[0] === 'mouseup') { - call.args[1](testEvent(40, 71)); + call.args[1](event = testEvent(40, 71)); } }); @@ -138,7 +143,7 @@ define( // initial position expect(mockScope.$eval).toHaveBeenCalledWith( testAttrs.mctDragUp, - { delta: [-2, 11] } + { delta: [-2, 11], $event: event } ); // Should also have unregistered listeners @@ -147,4 +152,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/SubPlot.js b/platform/features/plot/src/SubPlot.js index a762e4fd81..7c74751b27 100644 --- a/platform/features/plot/src/SubPlot.js +++ b/platform/features/plot/src/SubPlot.js @@ -297,7 +297,7 @@ define( subPlotBounds = $event.target.getBoundingClientRect(); mousePosition = toMousePosition($event); // Treat any modifier key as a pan - if (event.altKey || event.shiftKey || event.ctrlKey) { + if ($event.altKey || $event.shiftKey || $event.ctrlKey) { // Start panning panStart = mousePosition; panStartBounds = panZoomStack.getPanZoom(); diff --git a/platform/features/plot/test/SubPlotSpec.js b/platform/features/plot/test/SubPlotSpec.js index a093b9e289..58cd19faab 100644 --- a/platform/features/plot/test/SubPlotSpec.js +++ b/platform/features/plot/test/SubPlotSpec.js @@ -127,7 +127,7 @@ define( // Simulate a marquee zoom. Note that the mockElement // is 100 by 100 and starts at 10,20 - subplot.startMarquee({ + subplot.startDrag({ target: mockElement, clientX: 60, clientY: 45 @@ -137,7 +137,7 @@ define( clientX: 75, clientY: 85 }); - subplot.endMarquee({ + subplot.endDrag({ target: mockElement, clientX: 80, clientY: 95 @@ -162,7 +162,7 @@ define( // Simulate a marquee zoom. Note that the mockElement // is 100 by 100 and starts at 10,20 - subplot.startMarquee({ + subplot.startDrag({ target: mockElement, clientX: 60, clientY: 45 @@ -172,7 +172,7 @@ define( clientX: 75, clientY: 85 }); - subplot.endMarquee({ + subplot.endDrag({ target: mockElement, clientX: 60, clientY: 45 @@ -198,4 +198,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotLineBufferSpec.js b/platform/features/plot/test/elements/PlotLineBufferSpec.js index 1066d12d2d..54c0c04c77 100644 --- a/platform/features/plot/test/elements/PlotLineBufferSpec.js +++ b/platform/features/plot/test/elements/PlotLineBufferSpec.js @@ -83,9 +83,6 @@ define( expect(buffer.findInsertionIndex(10)).toEqual(4); expect(buffer.findInsertionIndex(14.5)).toEqual(5); expect(buffer.findInsertionIndex(20)).toEqual(6); - - // 9 is already in there, disallow insertion - expect(buffer.findInsertionIndex(9)).toEqual(-1); }); it("allows insertion in the middle", function () { @@ -169,4 +166,4 @@ define( }); } -); \ No newline at end of file +);