jQuery provides a isTrigger
property which allows us to know if the event was a "real event" or was it only "triggered".
$(ele).on("click", function(e){
if(e.isTrigger){
// this event was only triggered, not a real event
}else{
// this was a real event
}
})
For unit-testing purposes, is there a way to trigger
a event and somehow overwrite the isTrigger
property.. and in the event callback still behave (by having isTrigger === false
) as if it was a real click event..
Was trying the following code:
var triggerClick = jQuery.Event("click", {
isTrigger:false,
data:{
isTrigger:false
}
but it doesn't seem to pass it correctly..