test_bug619278.html (1303B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=619278 5 --> 6 <head> 7 <title>Test for Bug 619278</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=619278">Mozilla Bug 619278</a> 14 <p id="display"></p> 15 <div id="content"> 16 <form> 17 <input required><button>submit</button> 18 </form> 19 </div> 20 <pre id="test"> 21 <script type="application/javascript"> 22 23 /** Test for Bug 619278 */ 24 25 function doElementMatchesSelector(aElement, aSelector) 26 { 27 ok(aElement.matches(aSelector), 28 aSelector + " should match for " + aElement); 29 } 30 31 var e = document.forms[0].elements[0]; 32 33 e.addEventListener("invalid", function(event) { 34 e.addEventListener("invalid", arguments.callee); 35 36 SimpleTest.executeSoon(function() { 37 doElementMatchesSelector(e, ":-moz-ui-invalid"); 38 SimpleTest.finish(); 39 }); 40 }); 41 42 e.addEventListener("focus", function() { 43 SimpleTest.executeSoon(function() { 44 synthesizeKey("KEY_Enter"); 45 }); 46 }, {once: true}); 47 48 SimpleTest.waitForExplicitFinish(); 49 SimpleTest.waitForFocus(function() { 50 e.focus(); 51 }); 52 53 </script> 54 </pre> 55 </body> 56 </html>