-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Replaces jQuery's $el.width()
with element.clientWidth
.
#180523
Conversation
Pinging @elastic/ml-ui (:ml) |
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.
LGTM
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.
LGTM
@@ -46,6 +46,7 @@ describe('ExplorerChart', () => { | |||
const originalGetBBox = SVGElement.prototype.getBBox; | |||
beforeEach(() => (SVGElement.prototype.getBBox = () => mockedGetBBox)); | |||
afterEach(() => (SVGElement.prototype.getBBox = originalGetBBox)); | |||
jest.spyOn(Element.prototype, 'clientWidth', 'get').mockImplementation(() => 500); |
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.
nit:
jest.spyOn(Element.prototype, 'clientWidth', 'get').mockImplementation(() => 500); | |
jest.spyOn(Element.prototype, 'clientWidth', 'get').mockReturnValue(500); |
Note for for operations/QA team about the review ping: I had to change some files to investigate a problem where jest assertions are not the same on my local machine vs. CI. I will revert the changes once the problem is solved. |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @walterra |
Summary
Gets rid of leftover usage of jQuery. Replaces jQuery
$el.width()
withelement.clientWidth
that was used in the Anomaly Explorer chart for rare detectors.I updated the jest test for the component to return timestamps that result in a reasonable amount of ticks. A jest
spy
was added to mockclientWidth
which is not available viajsdom
because it lacks a layout engine.Checklist