test_bug1433073.html (2382B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test bug 1433073</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script src="/tests/SimpleTest/EventUtils.js"></script> 8 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 9 <script> 10 function synthesizeAccelKeyAndClickAt(aElementId) { 11 const element = document.getElementById(aElementId); 12 synthesizeMouseAtCenter(element, { accelKey: true }); 13 } 14 15 function synthesizeAccelKeyAndC() { 16 synthesizeKey("C", { accelKey: true }); 17 } 18 19 async function runTest() { 20 synthesizeAccelKeyAndClickAt("x"); 21 synthesizeAccelKeyAndClickAt("y"); 22 synthesizeAccelKeyAndClickAt("u"); 23 synthesizeAccelKeyAndClickAt("v"); 24 25 { 26 // Assert content contains the table. 27 // TODO: the `<meta>` element is missing; which is a defect in the 28 // test-code, see https://bugzilla.mozilla.org/show_bug.cgi?id=1632183. 29 const expectedString = "\ 30 <table>\ 31 <tbody>\ 32 <tr>\ 33 <td id=\"x\">x</td>\ 34 <td id=\"y\">y</td>\ 35 </tr>\ 36 <tr>\ 37 <td id=\"u\">u</td>\ 38 <td id=\"v\">v</td>\ 39 </tr>\ 40 </tbody>\ 41 </table>"; 42 43 const flavor = "text/html"; 44 await SimpleTest.promiseClipboardChange(expectedString, 45 synthesizeAccelKeyAndC, flavor); 46 } 47 48 { 49 // The key point of this check is that the string doesn't contain a 50 // `<tr>`. It's possible that `<tbody>` could be removed, but it's 51 // unknown if other applications rely on it being included. 52 const expectedString = "\ 53 <html>\ 54 <body onload=\"onLoad()\">\ 55 <div id=\"content\">\ 56 <table><tbody></tbody></table></div></body></html>"; 57 const flavor = "text/_moz_htmlcontext"; 58 await SimpleTest.promiseClipboardChange(expectedString, 59 synthesizeAccelKeyAndC, flavor); 60 } 61 62 SimpleTest.finish(); 63 } 64 65 function onLoad() { 66 SimpleTest.waitForExplicitFinish(); 67 SimpleTest.waitForFocus(runTest); 68 } 69 </script> 70 </head> 71 <body onLoad="onLoad()"> 72 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1433073">Mozilla Bug 1433073</a> 73 <p id="display"></p> 74 <div id="content"> 75 <table> 76 <tbody> 77 <tr> 78 <td id="x">x</td> 79 <td id="y">y</td> 80 </tr> 81 <tr> 82 <td id="u">u</td> 83 <td id="v">v</td> 84 </tr> 85 </tbody> 86 </table> 87 </div> 88 </body> 89 </html>