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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/textfield-to-password-on-focus.html

Issue 1437813002: Set selection to INPUT/TEXTAREA before dispatching 'focus' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve selection-functions.html Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script> 5 <script>
6 if (window.testRunner) { 6 if (window.testRunner) {
7 window.testRunner.waitUntilDone(); 7 window.testRunner.waitUntilDone();
8 window.testRunner.dumpAsText(); 8 window.testRunner.dumpAsText();
9 } 9 }
10 10
11 function changeToPasswordField(textField) 11 function changeToPasswordField(textField)
12 { 12 {
13 textField.setAttribute("type", "password"); 13 textField.setAttribute("type", "password");
14 } 14 }
15 15
16 function test() 16 function test()
17 { 17 {
18 if (window.testRunner) { 18 if (!window.testRunner)
19 var field = document.getElementById("field").focus(); 19 return;
20 20 var field = document.getElementById("field").focus();
21 // Need short delay because changing input type doesn't set selection in the
22 // input element immediately becasue layout is dirty.
23 setTimeout(function() {
21 eventSender.keyDown("p"); 24 eventSender.keyDown("p");
22 eventSender.keyDown("a"); 25 eventSender.keyDown("a");
23 eventSender.keyDown("s"); 26 eventSender.keyDown("s");
24 eventSender.keyDown("s"); 27 eventSender.keyDown("s");
25 28
26 shouldBe('field.value', "'pass'"); 29 shouldBe('field.value', "'pass'");
27 isSuccessfullyParsed(); 30 isSuccessfullyParsed();
28 31
29 window.testRunner.notifyDone(); 32 window.testRunner.notifyDone();
30 } 33 }, 0);
31 } 34 }
32 </script> 35 </script>
33 </head> 36 </head>
34 <body onload="test()"> 37 <body onload="test()">
35 <ol><li>Hit Tab key to focus input field.</li><li>Type some text.</li></ol> 38 <ol><li>Hit Tab key to focus input field.</li><li>Type some text.</li></ol>
36 <input type="text" id="field" onfocus="changeToPasswordField(this)"> 39 <input type="text" id="field" onfocus="changeToPasswordField(this)">
37 <hr> 40 <hr>
38 <p id="description"></p> 41 <p id="description"></p>
39 <div id="console"></div> 42 <div id="console"></div>
40 <script> 43 <script>
41 description("Test for <a href=\"https://bugs.webkit.org/show_bug.cgi?id=18900\"> Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)< /a>"); 44 description("Test for <a href=\"https://bugs.webkit.org/show_bug.cgi?id=18900\"> Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)< /a>");
42 </script> 45 </script>
43 </body> 46 </body>
44 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698