WebKit Bugzilla
Attachment 348975 Details for
Bug 189325
: [iOS] uiController.typeCharacterUsingHardwareKeyboard("`", ...) dispatches DOM key events for ~
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test case
test.html (text/html), 2.44 KB, created by
Daniel Bates
on 2018-09-05 16:05:07 PDT
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2018-09-05 16:05:07 PDT
Size:
2.44 KB
patch
obsolete
><!DOCTYPE html> ><html> ><head> ><meta name="viewport" content="width=device-width"> ><script> >if (window.testRunner) { > testRunner.dumpAsText(); > testRunner.waitUntilDone(); >} ></script> ></head> ><body> ><p>This tests can be used to verify that the property key of DOM key events dispatched when the ` key on the keyboard is pressed is `. This test PASSED if the following messages are emitted when you focus the text field below and press the ` key on the keyboard:</p> ><pre>type: keydown, key: `, code: Backquote, keyIdentifier: U+0060, keyCode: 192, charCode: 0, keyCode: 192, which: 192 >type: keypress, key: `, code: Backquote, keyIdentifier: , keyCode: 96, charCode: 96, keyCode: 96, which: 96 >type: keyup, key: `, code: Backquote, keyIdentifier: U+0060, keyCode: 192, charCode: 0, keyCode: 192, which: 192 ></pre> ><input type="text" id="input" onkeydown="logKeyEvent(event)" onkeyup="logKeyEvent(event)" onkeypress="logKeyEvent(event)"> ><hr> ><pre id="console"></pre> ><script> > >var numberOfFiredKeyEvents = 0; >var numberOfFiredKeyEventsForTestComplete = 3; > >async function activateFormControl(element) >{ > const x = element.offsetLeft + element.offsetWidth / 2; > const y = element.offsetTop + element.offsetHeight / 2; > > return new Promise(resolve => { > testRunner.runUIScript(` > (function() { > uiController.didStartFormControlInteractionCallback = function() { > uiController.uiScriptComplete("Done"); > }; > uiController.singleTapAtPoint(${x}, ${y}, function() { }); > })()`, resolve); > }); >} > >function log(message) >{ > document.getElementById("console").appendChild(document.createTextNode(message + "\n")); >} > >function logKeyEvent(event) >{ > let pieces = []; > for (let propertyName of ["type", "key", "code", "keyIdentifier", "keyCode", "charCode", "keyCode", "which"]) > pieces.push(`${propertyName}: ${event[propertyName]}`); > log(pieces.join(", ")); > if (++numberOfFiredKeyEvents >= numberOfFiredKeyEventsForTestComplete && window.testRunner) > testRunner.notifyDone(); >} > >async function runTest() >{ > if (!window.testRunner) > return; > let input = document.getElementById("input"); > await activateFormControl(input); > let uiScript = 'uiController.typeCharacterUsingHardwareKeyboard("`", () => uiController.uiScriptComplete())'; > await new Promise(resolve => testRunner.runUIScript(uiScript, resolve)); >} > >runTest(); ></script> ></body> ></html>
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width"> <script> if (window.testRunner) { testRunner.dumpAsText(); testRunner.waitUntilDone(); } </script> </head> <body> <p>This tests can be used to verify that the property key of DOM key events dispatched when the ` key on the keyboard is pressed is `. This test PASSED if the following messages are emitted when you focus the text field below and press the ` key on the keyboard:</p> <pre>type: keydown, key: `, code: Backquote, keyIdentifier: U+0060, keyCode: 192, charCode: 0, keyCode: 192, which: 192 type: keypress, key: `, code: Backquote, keyIdentifier: , keyCode: 96, charCode: 96, keyCode: 96, which: 96 type: keyup, key: `, code: Backquote, keyIdentifier: U+0060, keyCode: 192, charCode: 0, keyCode: 192, which: 192 </pre> <input type="text" id="input" onkeydown="logKeyEvent(event)" onkeyup="logKeyEvent(event)" onkeypress="logKeyEvent(event)"> <hr> <pre id="console"></pre> <script> var numberOfFiredKeyEvents = 0; var numberOfFiredKeyEventsForTestComplete = 3; async function activateFormControl(element) { const x = element.offsetLeft + element.offsetWidth / 2; const y = element.offsetTop + element.offsetHeight / 2; return new Promise(resolve => { testRunner.runUIScript(` (function() { uiController.didStartFormControlInteractionCallback = function() { uiController.uiScriptComplete("Done"); }; uiController.singleTapAtPoint(${x}, ${y}, function() { }); })()`, resolve); }); } function log(message) { document.getElementById("console").appendChild(document.createTextNode(message + "\n")); } function logKeyEvent(event) { let pieces = []; for (let propertyName of ["type", "key", "code", "keyIdentifier", "keyCode", "charCode", "keyCode", "which"]) pieces.push(`${propertyName}: ${event[propertyName]}`); log(pieces.join(", ")); if (++numberOfFiredKeyEvents >= numberOfFiredKeyEventsForTestComplete && window.testRunner) testRunner.notifyDone(); } async function runTest() { if (!window.testRunner) return; let input = document.getElementById("input"); await activateFormControl(input); let uiScript = 'uiController.typeCharacterUsingHardwareKeyboard("`", () => uiController.uiScriptComplete())'; await new Promise(resolve => testRunner.runUIScript(uiScript, resolve)); } runTest(); </script> </body> </html>
View Attachment As Raw
Actions:
View
Attachments on
bug 189325
: 348975 |
349210