[Plot] Update failing specs

Update failing specs for changes related to fixed duration
plots, WTD-1273.
This commit is contained in:
Victor Woeltjen 2015-06-23 14:17:28 -07:00
parent e5b0af47e1
commit d6a31dcef3
4 changed files with 19 additions and 17 deletions

View File

@ -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(
});
}
);
);

View File

@ -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();

View File

@ -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(
});
}
);
);

View File

@ -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(
});
}
);
);