Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / enter-clicks-buttons.html
blob1f9776d21a8c4c47edd028992ad4777066be64ce
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <body>
4 <p>Test for &lt;<a href="rdar://5483519">rdar://5483519</a>&gt; Pressing Enter on selected buttons should fire onclick</p>
5 <div id="console"></div>
6 <div id="container">
7 <p>In a form:</p>
8 <form onsubmit="logEvent(event); return false">
9 <button type="button" onclick="logEvent(event)">button type="button"</button>
10 <button type="submit" onclick="logEvent(event)">button type="submit"</button>
11 <button type="reset" onclick="logEvent(event)">button type="reset"</button>
12 <input type="checkbox" onclick="logEvent(event)" value="input type='checkbox'">
13 <input type="button" onclick="logEvent(event)" value="input type='button'">
14 <input type="submit" onclick="logEvent(event)" value="input type='submit'">
15 <input type="reset" onclick="logEvent(event)" value="input type='reset'">
16 </form>
17 <p>Outside a form:</p>
18 <button type="button" onclick="logEvent(event)">button type="button"</button>
19 <button type="submit" onclick="logEvent(event)">button type="submit"</button>
20 <button type="reset" onclick="logEvent(event)">button type="reset"</button>
21 <input type="checkbox" onclick="logEvent(event)" value="input type='checkbox'">
22 <input type="button" onclick="logEvent(event)" value="input type='button'">
23 <input type="submit" onclick="logEvent(event)" value="input type='submit'">
24 <input type="reset" onclick="logEvent(event)" value="input type='reset'">
25 </div>
26 <script>
27 function nodeIsChildOfForm(node)
29 return node.parentNode && node.parentNode.tagName == 'FORM';
32 function targetDescription(node)
34 return node.nodeName + (node.type ? ' type=' + node.type : '') + (nodeIsChildOfForm(node) ? ' in form' : '');
37 function logEvent(event)
39 debug(event.type + ': ' + targetDescription(event.target));
42 var keys = ['\r', ' '];
43 var keyNames = ['Enter', 'U+0020'];
44 var tagNames = ['button', 'input'];
46 for (var i in keys) {
47 debug('');
48 debug('');
49 debug('Sending ' + keyNames[i] + ' keypresses...');
50 debug('');
51 for (var j in tagNames) {
52 var elements = document.getElementsByTagName(tagNames[j]);
53 debug('');
54 debug('Looping over ' + elements.length + ' ' + tagNames[j] + ' elements...');
55 debug('');
56 for (var k = 0; k < elements.length; ++k) {
57 elements[k].focus();
58 eventSender.keyDown(keys[i], []);
62 document.querySelector('#container').remove();
63 </script>
64 </body>