You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing tests around using the Menu component. I use enzyme and jsdom and my test looks like
it('will call the spy with the expected payload',function(){this.wrapper.find('.spec-role-menu').simulate('click');// Need to use document instead of enzyme because the menu renders at the body leveldocument.getElementsByClassName('spec-activate')[0].click();expect(this.spy.args[0][0]).to.deep.equal({active: 1});});
Expected Behavior
On this.wrapper.find('.spec-role-menu').simulate('click'); the menu should render at the top level of the document
Actual Behavior
I get an error. This is the top of the stack trace
TypeError: this.anchorStepRef.scrollIntoView is not a function
at DropContents.componentDidMount (node_modules/grommet/utils/Drop.js:90:30)
at ReactCompositeComponentWrapper.invokeComponentDidMountWithTimer (node_modules/react/lib/ReactCompositeComponent.js:60:18)
at CallbackQueue.notifyAll (node_modules/react/lib/CallbackQueue.js:67:22)
at ReactReconcileTransaction.close (node_modules/react/lib/ReactReconcileTransaction.js:81:26)
Operating System and version (desktop or mobile): MacOS Sierra
I was able to fix this by modifying grommet and adding some additional checks for the existence of scrollIntoView, but I thought I'd see what your thoughts are.
The text was updated successfully, but these errors were encountered:
Hmmm upon further investigation this may be a bug with jsdom (or they intentionally left it out for some reason). I added window.HTMLElement.prototype.scrollIntoView = function() {}; into my testHelper.js file and it works. I'm creating an issue there (jsdom/jsdom#1695). Feel free to close this out.
I am writing tests around using the Menu component. I use
enzyme
andjsdom
and my test looks likeExpected Behavior
On
this.wrapper.find('.spec-role-menu').simulate('click');
the menu should render at the top level of the documentActual Behavior
I get an error. This is the top of the stack trace
URL, screen shot, or Codepen exhibiting the issue
Here is a repo created from react static boilerplate with enzyme, jsdom, and grommet added
https://github.com/JakeDluhy/grommet-menu-error
Steps to Reproduce
git clone git@github.com:JakeDluhy/grommet-menu-error.git
cd grommet-menu-error
npm test
Tests should fail
Your Environment
I was able to fix this by modifying grommet and adding some additional checks for the existence of
scrollIntoView
, but I thought I'd see what your thoughts are.The text was updated successfully, but these errors were encountered: