gecko-dev/testing/web-platform/tests/html/interaction/focus/focus-02.html

38 строки
1.4 KiB
HTML
Исходник Обычный вид История

<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focus - key events</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
Bug 1097230 - Update web-platform-tests to revision 9840b559b10e05f659932a835c11832db9e01c42, a=testonly --HG-- rename : testing/web-platform/meta/websockets/interfaces/WebSocket/events/011.html.ini => testing/web-platform/meta/IndexedDB/idbcursor_update_index5.htm.ini rename : testing/web-platform/meta/websockets/interfaces/WebSocket/events/011.html.ini => testing/web-platform/meta/IndexedDB/idbindex_get7.htm.ini rename : testing/web-platform/meta/websockets/interfaces/WebSocket/events/011.html.ini => testing/web-platform/meta/IndexedDB/idbindex_openCursor2.htm.ini rename : testing/web-platform/meta/websockets/interfaces/WebSocket/events/011.html.ini => testing/web-platform/meta/IndexedDB/idbindex_openKeyCursor3.htm.ini rename : testing/web-platform/moz.build => testing/web-platform/mozilla/tests/placeholder rename : testing/web-platform/moz.build => testing/web-platform/outbound/tests/placeholder rename : testing/web-platform/tests/dom/nodes/Document-createProcessingInstruction-literal-1.xhtml => testing/web-platform/tests/dom/nodes/ProcessingInstruction-literal-1.xhtml rename : testing/web-platform/tests/dom/nodes/Document-createProcessingInstruction-literal-2.xhtml => testing/web-platform/tests/dom/nodes/ProcessingInstruction-literal-2.xhtml rename : testing/web-platform/tests/pointerevents/pointerevent_lostpointercapture_for_disconnected_node.html => testing/web-platform/tests/pointerevents/pointerevent_lostpointercapture_for_disconnected_node-manual.html rename : testing/web-platform/tests/pointerevents/pointerevent_pointerleave_after_pointercancel_touch.html => testing/web-platform/tests/pointerevents/pointerevent_pointerleave_after_pointercancel_touch-manual.html rename : testing/web-platform/tests/pointerevents/pointerevent_pointerleave_after_pointerup_nohover.html => testing/web-platform/tests/pointerevents/pointerevent_pointerleave_after_pointerup_nohover-manual.html rename : testing/web-platform/tests/pointerevents/pointerevent_pointerout_after_pointercancel_touch.html => testing/web-platform/tests/pointerevents/pointerevent_pointerout_after_pointercancel_touch-manual.html rename : testing/web-platform/tests/pointerevents/pointerevent_pointerout_after_pointerup_nohover.html => testing/web-platform/tests/pointerevents/pointerevent_pointerout_after_pointerup_nohover-manual.html rename : testing/web-platform/tests/pointerevents/pointerevent_pointerout_pen.html => testing/web-platform/tests/pointerevents/pointerevent_pointerout_pen-manual.html rename : testing/web-platform/tests/pointerevents/pointerevent_setpointercapture_disconnected.html => testing/web-platform/tests/pointerevents/pointerevent_setpointercapture_disconnected-manual.html rename : testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.html => testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.html extra : rebase_source : 1fb6206eb45537037d28bebf5bc9de02791c4a17
2014-11-20 19:30:01 +03:00
<link rel="help" href="https://html.spec.whatwg.org/multipage/#focus">
<meta assert="flag" content="interact">
<meta assert="assert" content="Check if the key events received by document are targeted at the element when no element is focused">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<div id="log"></div>
<script>
var t1 = async_test("The keydown event must be targeted at the body element"),
t2 = async_test("The keypress event must be targeted at the body element"),
t3 = async_test("The keyup event must be targeted at the body element");
setup({timeout: 10000});
document.onkeydown = t1.step_func_done(function(evt){
assert_equals(evt.target, document.body, "The keydown events must be targeted at the document's body.");
});
document.onkeypress = t2.step_func_done(function(evt){
assert_equals(evt.target, document.body, "The keypress events must be targeted at the document's body.");
});
document.onkeyup = t3.step_func_done(function(evt){
assert_equals(evt.target, document.body, "The keyup events must be targeted at the document's body.");
});
t1.step(function() {
test_driver.send_keys(document.body, "a");
});
</script>