-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Annotations offline #2046
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
Annotations offline #2046
Changes from 6 commits
a47ab4c
05107ed
ec1787a
ef0bf88
0410669
6447bd7
78f5222
97cea60
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 |
---|---|---|
|
@@ -37,16 +37,28 @@ exports.assertStyle = function(dims, color, opacity) { | |
.toEqual(dims[i], 'to have correct number of pts in trace ' + i); | ||
|
||
points.each(function() { | ||
var point = d3.select(this); | ||
|
||
expect(point.style('fill')) | ||
expect(this.style.fill) | ||
.toEqual(color[i], 'to have correct pt color'); | ||
expect(+point.style('opacity')) | ||
var op = this.style.opacity; | ||
expect(op === undefined ? 1 : +op) | ||
.toEqual(opacity[i], 'to have correct pt opacity'); | ||
}); | ||
}); | ||
}; | ||
|
||
exports.assertHoverLabelStyle = function(g, expectation, msg, textSelector) { | ||
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. 🎉 |
||
if(!msg) msg = ''; | ||
|
||
var path = g.select('path').node(); | ||
expect(getComputedStyle(path).fill).toBe(expectation.bgcolor, msg + ': bgcolor'); | ||
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. ... but this is in a test file. I don't care about that as much. Your call. 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. |
||
expect(getComputedStyle(path).stroke).toBe(expectation.bordercolor, msg + ': bordercolor'); | ||
|
||
var text = g.select(textSelector || 'text.nums').node(); | ||
expect(getComputedStyle(text).fontFamily.split(',')[0]).toBe(expectation.fontFamily, msg + ': font.family'); | ||
expect(parseInt(getComputedStyle(text).fontSize)).toBe(expectation.fontSize, msg + ': font.size'); | ||
expect(getComputedStyle(text).fill).toBe(expectation.fontColor, msg + ': font.color'); | ||
}; | ||
|
||
exports.assertClip = function(sel, isClipped, size, msg) { | ||
expect(sel.size()).toBe(size, msg + ' clip path (selection size)'); | ||
|
||
|
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.
I'd prefer
window.getComputedStyle
here.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.
... in an effort to make plotly.js work in jsdom
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.
and readability (I think).