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

Unified Diff: LayoutTests/fast/forms/label/labels-contenteditable.html

Issue 14985009: <label> element should send key and focus events if it has contenteditable attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 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/forms/label/labels-contenteditable-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/label/labels-contenteditable.html
diff --git a/LayoutTests/fast/forms/label/labels-contenteditable.html b/LayoutTests/fast/forms/label/labels-contenteditable.html
new file mode 100644
index 0000000000000000000000000000000000000000..4040be6a2439b76d1b951f06e42a8a25789753f4
--- /dev/null
+++ b/LayoutTests/fast/forms/label/labels-contenteditable.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+<script src="../resources/label-test-util.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description('Test that labels with contenteditable attribute send focus and key events. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<label id="label1" for="input1">text</label><input id="input1"> <label id="label2" contenteditable for="input2">text</label><input id="input2">';
+document.body.appendChild(parent);
+var label1 = document.getElementById('label1');
+var input1 = document.getElementById('input1');
+var label2 = document.getElementById('label2');
+var input2 = document.getElementById('input2');
+
+label1.addEventListener('keydown', function () { alert("FAIL: keydown should not be sent if the label does not have contenteditable attribute"); });
+label1.addEventListener('keypress', function () { alert("FAIL: keypress should not be sent if the label does not have contenteditable attribute"); });
+label1.addEventListener('keyup', function () { alert("FAIL: keyup should not be sent if the label does not have contenteditable attribute"); });
+label1.addEventListener('focus', function () { alert("FAIL: focus should not be sent if the label does not have contenteditable attribute"); });
+label1.addEventListener('blur', function () { alert("FAIL: blur should not be sent if the label does not have contenteditable attribute"); });
+input1.addEventListener('focus', function () { alert("PASS: label passed the focus to the corresponding control"); });
+label2.addEventListener('keydown', function () { alert("PASS: keydown should be sent if the label has contenteditable attribute"); });
+label2.addEventListener('keypress', function () { alert("PASS: keypress should be sent if the label has contenteditable attribute"); });
+label2.addEventListener('keyup', function () { alert("PASS: keyup should be sent if the label has contenteditable attribute"); });
+label2.addEventListener('focus', function () { alert("PASS: focus should be sent if the label has contenteditable attribute"); });
+label2.addEventListener('blur', function () { alert("PASS: blur should be sent if the label has contenteditable attribute"); });
+input2.addEventListener('focus', function () { alert("PASS: label passed the focus to the corresponding control"); });
+
+if (window.eventSender) {
+ eventSender.dragMode = false;
+ mouseMoveToLabel("label1");
+ eventSender.mouseDown();
+ eventSender.keyDown("A");
+ eventSender.mouseUp();
+
+ mouseMoveToLabel("label2");
+ eventSender.mouseDown();
+ eventSender.keyDown("A");
+ eventSender.mouseUp();
+}
+
+</script>
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/forms/label/labels-contenteditable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698