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

Side by Side Diff: LayoutTests/fast/events/click-focus-control.html

Issue 16194013: Mouse press should focus on any types of form controls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/events/click-focus-control-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../js/resources/js-test-pre.js"></script>
5
6 <script type="text/javascript">
7
8 var numberOfFocusedElements = 0;
9 function test()
10 {
11 if (!window.testRunner)
12 return;
13
14 for (var i = 1; i <= 5; i++) {
15 var aElement = document.getElementById('a' + i);
16 aElement.onfocus = handleFocus;
17 eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offset Top + 2);
18 eventSender.mouseDown();
19 eventSender.mouseUp();
20 }
21
22 if(numberOfFocusedElements == 5)
23 testPassed("All form elements got focus");
24 else
25 testFailed("Some form elements didn't get focus");
26
27 var tc = document.getElementById('test-container');
28 tc.parentNode.removeChild(tc);
29 };
30
31 function handleFocus(e)
32 {
33 var el = e.target;
34 debug(el.id + ' received focus (' + el.title + ')');
35 numberOfFocusedElements = numberOfFocusedElements + 1;
36 }
37
38 if (window.testRunner) {
39 testRunner.dumpAsText();
40 }
41
42 </script>
43 </head>
44
45 <body onLoad="test()">
46
47 <p>This test ensures that we can click to focus an a element.
48 Click on the element below.
49
50 <p>The expected result is platform specific. Mac doesn't allow some form control s to be
51 mouse focusable.
52
53 <div id=test-container>
54 <form id="form1">
55 <p>
56 <strong>This is form1</strong><br/>
57
58 First name here<br/>
59 <input type="text" name="name" title="input name" size="6" maxlength="10"/><br/>
60
61 Password:<br/>
62 <input type="password" name="password" size="6" maxlength="10"/><br/>
63
64 comments:<br/>
65 <textarea name="comments" title="textarea comments" rows="2" cols="20">anything form1 goes here</textarea><br/>
66
67 Select 1:<br/>
68 <input id=a1 type="radio" name="radio1" value="radio1a"/><br/>
69 <input id=a2 type="radio" name="radio1" value="radio1b"/><br/>
70
71 Check it:<br/>
72 <input id=a3 type="checkbox" name="checkbox1" value="checkbox1"/><br/>
73
74 Select 1:<br/>
75 <select id=a4 name="Select" size="2">
76 <option>1</option>
77 <option>2</option>
78 <option selected="selected">3</option>
79 <option>4</option>
80 </select><br/>
81 <input id=a5 type="button" name="button" value="Button 1"/>
82 </p></form><p><strong>End form1</strong></p>
83 </div>
84
85 <p>Result
86
87 <pre id=console></pre>
88
89 </body>
90 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/events/click-focus-control-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698