-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Cartesian subplot fixes #1049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cartesian subplot fixes #1049
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ var Lib = require('@src/lib'); | |
var createGraphDiv = require('../assets/create_graph_div'); | ||
var destroyGraphDiv = require('../assets/destroy_graph_div'); | ||
var mouseEvent = require('../assets/mouse_event'); | ||
var click = require('../assets/click'); | ||
var doubleClick = require('../assets/double_click'); | ||
|
||
describe('hover info', function() { | ||
|
@@ -630,6 +631,16 @@ describe('hover after resizing', function() { | |
|
||
afterEach(destroyGraphDiv); | ||
|
||
function _click(pos) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 for fixing via testing! |
||
return new Promise(function(resolve) { | ||
click(pos[0], pos[1]); | ||
|
||
setTimeout(function() { | ||
resolve(); | ||
}, constants.HOVERMINTIME); | ||
}); | ||
} | ||
|
||
function assertLabelCount(pos, cnt, msg) { | ||
return new Promise(function(resolve) { | ||
mouseEvent('mousemove', pos[0], pos[1]); | ||
|
@@ -652,22 +663,36 @@ describe('hover after resizing', function() { | |
pos1 = [401, 122]; | ||
|
||
Plotly.plot(gd, data, layout).then(function() { | ||
|
||
// to test https://github.com/plotly/plotly.js/issues/1044 | ||
|
||
return _click(pos0); | ||
}) | ||
.then(function() { | ||
return assertLabelCount(pos0, 1, 'before resize, showing pt label'); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return assertLabelCount(pos1, 0, 'before resize, not showing blank spot'); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return Plotly.relayout(gd, 'width', 500); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return assertLabelCount(pos0, 0, 'after resize, not showing blank spot'); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return assertLabelCount(pos1, 1, 'after resize, showing pt label'); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return Plotly.relayout(gd, 'width', 600); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return assertLabelCount(pos0, 1, 'back to initial, showing pt label'); | ||
}).then(function() { | ||
}) | ||
.then(function() { | ||
return assertLabelCount(pos1, 0, 'back to initial, not showing blank spot'); | ||
}).then(done); | ||
}) | ||
.then(done); | ||
}); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,7 +248,7 @@ describe('Test Plots', function() { | |
describe('Plots.resize', function() { | ||
var gd; | ||
|
||
beforeEach(function(done) { | ||
beforeAll(function(done) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm… There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, this is on purpose. This particular |
||
gd = createGraphDiv(); | ||
|
||
Plotly.plot(gd, [{ x: [1, 2, 3], y: [2, 3, 4] }], {}) | ||
|
@@ -287,6 +287,17 @@ describe('Test Plots', function() { | |
expect(svgHeight).toBe(400); | ||
} | ||
}); | ||
|
||
it('should update the axis scales', function() { | ||
var fullLayout = gd._fullLayout, | ||
plotinfo = fullLayout._plots.xy; | ||
|
||
expect(fullLayout.xaxis._length).toEqual(240); | ||
expect(fullLayout.yaxis._length).toEqual(220); | ||
|
||
expect(plotinfo.xaxis._length).toEqual(240); | ||
expect(plotinfo.yaxis._length).toEqual(220); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Sounds good! I once misunderstood |
||
}); | ||
}); | ||
|
||
describe('Plots.purge', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so it was that the axes were outdated? That seems consistent with what was observed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.