Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 9 additions & 27 deletions test/jasmine/tests/transform_sort_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ describe('Test sort transform interactions:', function() {
.then(done);
});

it('does not preserve hover/click `pointNumber` value', function(done) {
it('does not preserve event data `pointNumber` value', function(done) {
var gd = createGraphDiv();

function getPxPos(gd, id) {
Expand All @@ -273,32 +273,18 @@ describe('Test sort transform interactions:', function() {
}

function hover(gd, id) {
return new Promise(function(resolve) {
return new Promise(function(resolve, reject) {
gd.once('plotly_hover', function(eventData) {
delete gd._lastHoverTime;
resolve(eventData);
});

var pos = getPxPos(gd, id);
mouseEvent('mousemove', pos[0], pos[1]);
});
}

function click(gd, id) {
return new Promise(function(resolve) {
gd.once('plotly_click', function(eventData) {
resolve(eventData);
});

var pos = getPxPos(gd, id);
mouseEvent('mousemove', pos[0], pos[1]);
mouseEvent('mousedown', pos[0], pos[1]);
mouseEvent('mouseup', pos[0], pos[1]);
});
}

function wait() {
return new Promise(function(resolve) {
setTimeout(resolve, 100);
setTimeout(function() {
reject('plotly_hover did not get called!');
}, 100);
});
}

Expand Down Expand Up @@ -334,21 +320,18 @@ describe('Test sort transform interactions:', function() {
.then(function(eventData) {
assertPt(eventData, 0, 1, 3, 'D');
})
.then(wait)
.then(function() { return click(gd, 'G'); })
.then(function() { return hover(gd, 'G'); })
.then(function(eventData) {
assertPt(eventData, 1, 1, 6, 'G');
})
.then(wait)
.then(function() {
return Plotly.restyle(gd, 'transforms[0].enabled', true);
})
.then(function() { return hover(gd, 'D'); })
.then(function(eventData) {
assertPt(eventData, 0, 1, 1, 'D');
})
.then(wait)
.then(function() { return click(gd, 'G'); })
.then(function() { return hover(gd, 'G'); })
.then(function(eventData) {
assertPt(eventData, 1, 1, 5, 'G');
})
Expand All @@ -359,8 +342,7 @@ describe('Test sort transform interactions:', function() {
.then(function(eventData) {
assertPt(eventData, 0, 1, 1, 'D');
})
.then(wait)
.then(function() { return click(gd, 'G'); })
.then(function() { return hover(gd, 'G'); })
.then(function(eventData) {
assertPt(eventData, 1, 1, 5, 'G');
})
Expand Down