How to simulate an event with jQuery? - jquery-plugins

I am working with a third party plugin, that has a small bug. This bug happens when the control renders, and when I doubleclick on a header row inside the table it fixes my problem through this trigger inside the plugin:
$(".grid tr").live("dblclick",function() {
//code here
});
So, what I need is, knowing the exact <tr>, I want to simulate that double click, so I can fix the bug on the control onload callback.
Is this even possible?

$(".grid tr").trigger("dblclick");
This will trigger the double click event.
If there is indeed a bug with the plugin, you should create a bug report with them so hopefully they can (a) tell you are doing it wrong, here is how to do it right or (b) fix it in a future release.

$(".grid tr").trigger('dblclick');

Related

Popup on Eigen web page blocks content

For some reason the Eigen web page now has a popup blocking content. If you go to http://eigen.tuxfamily.org/dox/, the popup in the upper-left corner of the page doesn't want to go away. Help please! Seems to fail with both the latest Firefox and on Chrome.
Looks like the Eigen developers are aware of this (Issue 1918) and they just merged a fix about 5 minutes ago. I'm not sure how long it takes to update the website, but the documentation bug causing the issue should be fixed.
Apparently the issue was with the JavaScript in eigen_navtree_hacks.js which needed the load function (which is deprecated) to be changed to the on function
$(window).load(showRoot);
had to be changed to
$(window).on("load", showRoot);
and
$(window).load(resizeHeight);
had to be changed to
$(window).on("load", resizeHeight);
I'm not sure what actually triggered the menu to start behaving this way in the first place.

mouse over and click in Capybara

Got stuck in capybara coding. appreciate any help on this.
I need to mouseover on source element to click on the target element link.
Not finding a way to get it. need to use this in chrome browser only.
Tried the code below
source=ses.find('#source-link')
ses.driver.action.move_to(source).perform
ses.find('#child-link').click
If what you're trying to do is hover over #source-link and then click `#child-link' it should just be
sess.find('#source-link').hover
sess.find('#child-link').click
If that doesn't work for you then we need to know exactly what events are triggering the behavior you expect.

browser.click not working in safari

I have the following test in nightwatch:
browser.click('test')
The browser.click function works in chrome but not safari. Does anyone know why it doesn't work in safari?
I have experience this as well, but in your case my best guess is that you're not passing in a correct element, like a class. Example:
browser.click('.test')
What is the 'test' that you're trying to click?
I was having the same problem and apparently the element that I was trying to click on was not in the viewport yet.
I added browser.maximizeWindow() before triggering the click event.
browser.maximizeWindow();
I also included waitForElementVisible('.test',1000) before calling click().
I have had similar issues, a solution for me was to click using Xpath. You can uses Xpath text():
browser.useXpath()
.click('XpathToElement')
also i would inject JS to the browser and try to force a click.
browser.execute(function(){
document.getElementById("nodeId").click();
},[])
However be aware that this does not always solve the issue.

html select change not triggered on click in firefox 40.0.2

dropdown item click does not work in Firefox 40.0.2, but select a dropdown (using up/down arrow) and click enter trigger the change event.
There is no console error seen. The same works in all other browsers and firefox other versions.
The stranger thing noted here is, it works for a dropdown in a different page.
Looks like this is bug in firefox, anyone faced this issue? is there a temporary workaround someone applied.
Reference: https://support.mozilla.org/en-US/questions/1077858
We figured out that there was a 'mouseup' listener attached to document that did event.preventDefault which caused this problem in firefox 40.0.2.
$(document).on('mouseup', function(e) {
/** some code here */
e.preventDefault();
});
Luckily for us that e.preventDefault was unwanted, so removing it fixed the issue.
Found this Site compatibility for Firefox 40 where I found this particular bug. Could be fixed really soon.

Kendo Panelbar Error

I think i've found a problem with kendo panelbar.
In my project i have a kendo panelbar and sometimes i need all items to be disabled.
The problem is that when all items are disabled and you click anywhere inside the panelbar it raises a javascript error. If you click outside and inside again it raises another. I performed some testes and i guess it may be something related to the fact that kendo panelbar try to put focus in the first enabled item whenever you click in a disabled item.
I thought it was something related to the scripts i have in my project, but i found that this error also occurs in the official telerik panelbar example, but you have to open console in developer tools to see the error because the example runs in a frame of the telerik dojo. You can try it. The link is http://dojo.telerik.com/aXoni
I tried google but didn't find anyone with this problem.
I think its strange no one ever found this bug. Am i doing something wrong or is this really a bug in the telerik panelbar and i have to live with it?
Thanks
This definitely seems like a bug so I went ahead and reported it: https://github.com/telerik/kendo-ui-core/issues/307
In the meantime, you can hack around the problem with a mousedown listener during the capture phase: http://dojo.telerik.com/#tjvantoll/OdIj. It's a bit ugly but it'll avoid the error.

Resources