vendredi 24 mars 2017

programmatically testing on interactive svg visualisations - how to click on svg elements?

I build an interactive visualisation, registering Hammer events to nodes elements - events will add new elements.

For the sake of testing, I would like to programmatically click on all the elements, and test how many the browser can handle.

My code is something like:

main : {

   graphic_object.elem( function(elem ) {
         ui = getElementUI(elem)
         Hammer(ui).on('tap', function (event) { 
              //.... do staff
       , false}

   }

}

For simplicity, I tried to register to window:

window.Hammer(ui).on('tap', function (event) { 
              //.... do staff
       , false}

So that (I thought) I could call:

window.Hammer( $('#myElement)[0] )

and loop through all elements I wanted.

It does not work but I can see the function:

window.Hammer($('#data-EFO_0000270')[0])
ia {options: Object, handlers: Object, session: Object, recognizers: Array[7], oldCssProps: Object…}

How can I call Hammers functions registered on window or make a loop on elements I want?

The idea is to lunch a script from console to automate interaction for n iterations.

Aucun commentaire:

Enregistrer un commentaire