Re: clickLink and default action

Anthon Pang <[email protected]>
Newsgroups gmane.comp.web.canoo.webtest
Message-ID <[email protected]>
Thanks, found the answer in the forum archive.

    WT-428 (loading iframe becomes the current response)

We'll disable the affected tests for the time being.

On Fri, Mar 18, 2011 at 12:29 PM, Anthon Pang <[email protected]> wrote:

> Sorry, I was wrong about not "triggering the default action".  I forgot
> that I use hidden iframes to direct the content of the default action, i.e.,
>
>     <iframe name="iframeA"></iframe>
> ...
>     <iframe name="iframeZ"></iframe>
>
>     <a id="clickA" href="http://example.org/A" target="iframeA">A</a>
> ...
>     <a id="clickZ" href="http://example.org/Z" target="iframeZ">Z</a>
>
> With real browsers, the content loads into the iframe.
>
> With WebTest, the simulated click changes the current response.  Is there a
> setting to disable following frames?
>
>
>
> On Thu, Mar 17, 2011 at 10:58 AM, Anthon Pang <[email protected]> wrote:
>
>> I searched the forum (and Jira is locked), so my apologies if this is a
>> dupe.
>>
>> We're using jQuery's QUnit for our JavaScript unit tests.  With a browser
>> (e.g., Firefox, IE, Safari, Chrome, etc.), the following code in QUnit can
>> be used to simulate mouse click events and test the click event handlers
>> without triggering the default action, e.g., QUnit.triggerEvent( elem,
>> 'click' );
>>
>>         triggerEvent: function( elem, type, event ) {
>>                 if ( document.createEvent ) {
>>                         event = document.createEvent("MouseEvents");
>>                         event.initMouseEvent(type, true, true,
>> elem.ownerDocument.defaultView,
>>                                 0, 0, 0, 0, 0, false, false, false, false,
>> 0, null);
>>                         elem.dispatchEvent( event );
>>
>>                 } else if ( elem.fireEvent ) {
>>                         elem.fireEvent("on"+type);
>>                 }
>>         },
>>
>> But with R_1810, the default action is also triggered.  Moreover, it
>> doesn't appear that I can stop this behavior using something like this in my
>> click event handler:
>>
>>     if(!e) var e = window.event;
>>     e.cancelBubble = true;
>>     e.returnValue = false;
>>     if (e.stopPropagation) {
>>         e.stopPropagation();
>>         e.preventDefault();
>>     }
>>     return false;
>>
>> I'd appreciate some tips.  Thanks.
>>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.