These are chat archives for ractivejs/ractive

30th
Mar 2018
Bruce Tu
@brtu
Mar 30 2018 19:14

so in migrating from ractive .8 to .9 specifically, i am seeing some issues with my unit tests. i have a bunch of jasmine tests that simulate click events via jquery, using this following function
function click(el, document) {
el = jqueryObjectToDomElement(el);

var clickEvent;
clickEvent = document.createEvent("HTMLEvents");
clickEvent.initEvent("click", false, true);
return el.dispatchEvent(clickEvent);
};

it seems like the clicks are now not registering in ractive .9. i am still pretty new to JS, so i am suspecting that maybe jquery changes the DOM but not the VDOM and maybe ractive needs some kind of model update or something to get the click to register (?) not really sure
hoping someone can point me in the right direction of what references i should read or maybe a sample of how unit tests are done in ractive .9 with jquery
Joseph
@fskreuz
Mar 30 2018 20:30
If you could create a minimal example over at https://ractive.js.org/playground , that would simplify debugging for everyone.
Chris Reeves
@evs-chris
Mar 30 2018 20:41
@brtu you're probably running into event delegation, which probably doesn't play well with jquery clicks
you can disable delegation for the tests or use something like simulant, which I believe works with delegation