mozilla :: #devtools

13 May 2017
08:57ruturajvHi... I'm trying to write a testcase associated with a ReactCompononent, I'm unable to simulate Keyboard Events.. I'm trying to do something like this..
08:58ruturajv // ArrowDown $(".devtools-searchinput").dispatchEvent( new KeyboardEvent("keydown", {key: "ArrowDown"}) ); $(".devtools-searchinput").dispatchEvent( new KeyboardEvent("keydown", {key: "PageUp", keyCode: KeyboardEvent.DOM_VK_PAGE_UP}) );
10:23ruturajvntim: I added <script src=&quot;chrome://mochikit/content/tests/SimpleTest/EventUtils.js&quot;></script>, yet it gives me EventUtils is not defined..
10:24ntimruturajv: Hi! Have you tried BrowserTestUtils.synthesizeKey or simply synthesizeKey with the same arguments ?
10:27ruturajvI tried using EventUtils., but even BrowserTestUtils.synthesizeKey is returning BrowserTestUtils is not defined
10:28ruturajvo.. just synthesizeKey seemed to have gone thru..!
10:33ruturajvntim: Yet, the selectionIndex isn&#39;t getting updated - - have I done it right ?
10:34ntimruturajv: it should be synthesizeKey(&quot;ArrowDown&quot;, {});
10:34ntimalso, make sure you&#39;ve focused the search input
10:37ruturajvntim: - This fails, the .focus() does exist before..
10:38ntimruturajv: oh yeah, it should be VK_DOWN instead of ArrowDown
10:39ntimruturajv: you can search for synthesizeKey on to see how it&#39;s used currently
10:40ruturajvYa I have that open, yes.. VK_DOWN worked... thanks a lot ntim:
14 May 2017
No messages
Last message: 71 days and 10 hours ago