samedi 6 août 2016

TextEvent not always working

In my Web Component Tester tests I'm setting value of an <input> programmatically so that it emits the appropriate event.

var input = document.querySelector('input');
var e = document.createEvent('TextEvent');
  e.initTextEvent(
    'textInput',
    true,
    true,
    null,
    'Bob'
  );
  input.dispatchEvent(e);

Weirdly enough, this technique only works about 50%-60% of the times I run the tests. Why is that?

Aucun commentaire:

Enregistrer un commentaire