tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / forms / input-number-blur-twice.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description">There was a bug that moving focus with TAB from a number input with an invalid string dispatched an extra focus event and an extra blur event.</p>
8 <div id="console"></div>
9
10 <input type=number id=number>
11 <input type=text>
12
13 <script>
14 function handleFocus() {
15     numOfFocus++;
16 }
17
18 function handleBlur() {
19     numOfBlur++;
20 }
21
22 var numOfFocus = 0;
23 var numOfBlur = 0;
24 var num = document.getElementById('number');
25 num.addEventListener('focus', handleFocus);
26 num.addEventListener('blur', handleBlur);
27 num.focus();
28 document.execCommand('InsertText', false, '123');
29 document.execCommand('InsertText', false, 'a');
30 var tabEvent = document.createEvent('KeyboardEvent');
31 tabEvent.initKeyboardEvent('keydown', true, true, document.defaultView, 'U+0009');
32 num.dispatchEvent(tabEvent);
33
34 shouldBe('numOfFocus', '1');
35 shouldBe('numOfBlur', '1');
36 </script>
37 <script src="../../fast/js/resources/js-test-post.js"></script>
38 </body>
39 </html>