Skip to content
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

V4 without jquery: fix tests #23981

Merged
merged 1 commit into from Sep 18, 2017

Conversation

alekitto
Copy link
Contributor

Related to #23586 (comment)
There were a couple of buggy tests for IE 11:

  • trying to fire a click on an element not added to the DOM does not produce any effect
  • defaultPrevented does not work for code-generated events

var evt = new CustomEvent('click', {
bubbles: true,
cancelable: true
})
Copy link
Member

@Johann-S Johann-S Sep 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why previously I asked you to use EventHandler in our unit test 😉 which correct the buggy preventDefault from IE, can you give it a try please ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to use EventHandler.trigger instead of creating a CustomEvent object, but preventDefault produces the same buggy result. Trying to replace the preventDefault in an HTMLEvents object works on IE, but breaks in phantom. This is the only working solution for all the browsers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's weird I didn't see that issue in our other plugins without jQuery

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the only test for the defaultPrevented property for a non-jQuery event by now. In other tests trigger is used to emit the event (which works correctly), but the Event object is discarded and never checked. 

@Johann-S Johann-S merged commit c342396 into twbs:v4-without-jquery Sep 18, 2017
@alekitto
Copy link
Contributor Author

@Johann-S Now Edge is broken.. workin' on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants