5 function keyDown(key, modifiers)
7 eventSender.keyDown(key, modifiers);
12 return 'blur=' + blurCounter + ' focus=' + focusCounter;
15 function beginTestCase(testCaseName)
22 function startTestFor(typeName)
24 description('Check blur and focus events for multiple fields ' + typeName + ' input UI');
25 document.getElementById('container').innerHTML = '<input id="before">'
26 + '<input id="test" type="' + typeName + '">'
27 + '<input id="after">';
29 testInput = document.getElementById('test');
30 testInput.addEventListener('blur', function () { ++blurCounter; });
31 testInput.addEventListener('focus', function () { ++focusCounter; });
33 beginTestCase('focus() and blur()');
34 shouldBeEqualToString('testInput.focus(); state()', 'blur=0 focus=1');
35 shouldBeEqualToString('testInput.blur(); state()', 'blur=1 focus=1');
37 if (window.eventSender) {
45 case 'datetime-local':
53 beginTestCase('focus and Tab key to blur');
54 document.getElementById("before").focus();
55 for (var i = 0; i < numberOfFields; i++)
56 shouldBeEqualToString('keyDown("\t"); state()', 'blur=0 focus=1');
57 shouldBeEqualToString('keyDown("\t"); state()', 'blur=1 focus=1');
59 debug('Please run in DumpRenderTree for focus and Tab-key test case');
62 document.body.removeChild(document.getElementById("container"));