| <!DOCTYPE html> |
| <body> |
| <input type=time id=test1> |
| <input type=time id=test2 step=1> |
| <script> |
| function fieldsText(input) { |
| return internals.shadowRoot(input).textContent; |
| } |
| |
| function back(newState) { |
| parent.state = newState; |
| history.back(); |
| } |
| |
| function forward(newState) { |
| parent.state = newState; |
| history.forward(); |
| } |
| |
| function keyDown(key) { |
| eventSender.keyDown(key); |
| } |
| |
| var testInput1 = document.getElementById('test1'); |
| var testInput2 = document.getElementById('test2'); |
| var pageName = location.search || '?page1'; |
| |
| window.onload = function() { setTimeout(function() { |
| switch (pageName) { |
| case '?page1': |
| switch (parent.state) { |
| case 'direct': { |
| testInput1.value = '01:01'; |
| testInput2.focus(); |
| keyDown('ArrowUp'); |
| keyDown('\t'); |
| keyDown('\t'); |
| keyDown('\t'); |
| keyDown('ArrowUp'); |
| var nextUri = location.toString().replace('?page1', '?page2'); |
| setTimeout(function() { window.location.href = nextUri; }, 0); |
| break; |
| } |
| case 'backTo1': |
| parent.testCases.push( |
| { |
| 'description' : 'Went back to a page. Checking a form control which had a full value', |
| 'actual' : testInput1.value, |
| 'expected' : '01:01' }, |
| { |
| 'description' : 'Went back to a page. Checking a form control which had a partial value', |
| 'actual' : fieldsText(testInput2), |
| 'expected' : '01:--:-- AM' |
| }); |
| forward('forwardTo2'); |
| break; |
| case 'backTo1Second': |
| parent.finishTest(); |
| break; |
| default: |
| parent.failed('Unsupported state(' + parent.state + ')'); |
| break; |
| } |
| break; |
| case '?page2': |
| switch (parent.state) { |
| case 'direct': |
| testInput1.value = '02:02'; |
| testInput2.focus(); |
| keyDown('\t'); |
| keyDown('ArrowDown'); |
| back('backTo1'); |
| break; |
| case 'forwardTo2': |
| parent.testCases.push( |
| { |
| 'description' : 'Went forward to a page. Checking a form control which had a full value', |
| 'actual' : testInput1.value, |
| 'expected' : '02:02' |
| }, |
| { |
| 'description' : 'Went forward to a page. Checking a form control which had a partial value', |
| 'actual' : fieldsText(testInput2), |
| 'expected' : '--:59:-- --' |
| }); |
| back('backTo1Second'); |
| break; |
| default: |
| parent.failed('Unsupported state(' + parent.state + ')'); |
| break; |
| } |
| break; |
| default: |
| parent.failed('Unsupported page(' + pageName + ')'); |
| break; |
| } |
| }, 1); }; |
| </script> |
| <body> |
| |