Simulate ESC key event

81 views
Skip to first unread message

Guru MVG

unread,
Feb 18, 2014, 4:53:46 AM2/18/14
to yui-s...@googlegroups.com
Hi,

I'm trying to simulate `escape` key event for my unit test cases, but looks like it isn't working. Appreciate any inputs. Thanks!

Code that I tried with:

YUI().use('node', 'node-simulate', function (Y) {

var button = Y.one('#myButton');
button
.simulate('keyup', {
        keyCode
: 27
     
});


});




Damien Pobel

unread,
Feb 18, 2014, 5:12:25 AM2/18/14
to yui-s...@googlegroups.com
Hi,
 
node-simulate ? AFAIK, the correct module name is node-event-simulate and in my tests I do something like:

button.simulate('keyup', {charCode: 27});

even if according to the documentation, keyCode is the correct parameter:
http://yuilibrary.com/yui/docs/event/simulate.html#simulating-key-events

I hope that helps
--
Damien
http://damien.pobel.fr
 
Reply all
Reply to author
Forward
0 new messages