Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / textinput-not-fired-on-enter-in-input.html
blob421bbd3b68ac83de1e16021a9b8ef40429eba8a4
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>This test checks that typing Enter into an input element does not fire input or textInput.<br>
5 To run manually, type enter in the input element below.</p>
6 <form id="form">
7 <input id="el">
8 </form>
9 <br>
10 <div id="result"></div>
11 <pre id="console"></pre>
12 <script>
13 function log(msg) {
14 document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
17 var unexpectedEvents = 0;
18 var enterChar = '\r'.charCodeAt(0);
19 function fail(event) {
20 if (lastKeyPressed != enterChar) {
21 log(event.type + ' fired.');
22 return;
25 unexpectedEvents++;
26 log('Unexpected ' + event.type + ' fired.');
27 result.innerHTML = '<span style="padding: 5px; background-color: red">FAIL</span>';
30 var lastKeyPressed = 0;
31 el.addEventListener('keypress', function(event) { lastKeyPressed = event.keyCode; });
32 el.addEventListener('input', fail);
33 el.addEventListener('textInput', fail);
35 // If the form is submitted on enter and no unexpected event has been fired, success!
36 form.addEventListener('submit', function(event) {
37 if (!unexpectedEvents && !result.hasChildNodes())
38 result.innerHTML = '<span style="padding: 5px; background-color: green">SUCCESS</span>';
40 event.preventDefault();
41 });
43 if (window.testRunner)
44 testRunner.dumpAsText();
46 el.focus();
47 if (window.eventSender) {
48 log('\nSending Enter to input element');
49 eventSender.keyDown('\r', []);
50 } else if (window.testRunner)
51 log('This test requires eventSender to run in LayoutTests.');
53 </script>
54 </body>
55 </html>