Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Unified Diff: LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link.html

Issue 619613005: The link should be activated by enter key on focusing the child element inside the anchor(relanding) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link.html
diff --git a/LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link.html b/LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link.html
new file mode 100644
index 0000000000000000000000000000000000000000..21aadcc301119dc0f2a0011afbfba2d1bca9a174
--- /dev/null
+++ b/LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<a id="link" href="#" tabindex="-1" onclick="debug(eventInfo(event))">
+ <h1 tabindex="1" id="focus0"
+ onkeydown="debug(eventInfo(event))"
+ onkeypress="debug(eventInfo(event))"
+ onkeyup="debug(eventInfo(event))">EnterMe</h1>
+ <textarea tabindex="2" id="focus1"
+ onkeydown="debug(eventInfo(event))"
+ onkeypress="debug(eventInfo(event))"
+ onkeyup="debug(eventInfo(event))">TypeHere</textarea>
+</a>
+<svg width="200" height="50" onclick="debug(eventInfo(event))">>
robwu 2014/10/13 21:57:04 Remove the trailing >.
+ <a xlink:href="#">
+ <text font-size="18px" y="20" tabindex="3"
+ onkeydown="debug(eventInfo(event))"
+ onkeypress="debug(eventInfo(event))"
+ onkeyup="debug(eventInfo(event))">SVG anchor with tabindex</text>
+ </a>
+</svg>
+<div id="console"></div>
+<script>
+ description('This test ensures that the link is activated by enter key on focusing the child element inside the anchor');
+
+ function test(eventType) {
robwu 2014/10/13 21:57:04 Next time, please choose a more descriptive name t
+ var event = document.createEvent('KeyboardEvents');
+ event.initKeyboardEvent(eventType, true, true, window, 'Enter', 0, 0, 0, 0, 0, false);
+ document.activeElement.dispatchEvent(event);
+ }
+ function eventInfo(event) {
+ target = event.srcElement ? event.srcElement : event.target;
robwu 2014/10/13 21:57:04 `srcElement` is a non-standard property and only n
+ if (event.type == "keydown" || event.type == "keypress" || event.type == "keyup")
robwu 2014/10/13 21:57:04 Nit: Try to be consistent with quotes. Either use
+ return event.keyIdentifier == "U+0009" ? "" : target.tagName + " - " + event.type + ' - ' + event.keyIdentifier;
+ else if (event.type == "click")
+ return target.tagName + " - " + event.type;
+ else
+ return "unexpected event - " + target.tagName + " - " + event.type;
+
+ }
+ if (window.eventSender)
+ eventSender.keyDown("\t");
+ test('keydown');
+ test('keypress');
+ test('keyup');
+ if (window.eventSender) {
+ eventSender.keyDown("\t");
+ eventSender.keyDown("\n");
+ eventSender.keyDown("\t");
+ }
+ test('keydown');
+ test('keypress');
+ test('keyup');
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698