Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / datetimelocal-multiple-fields / resources / preserve-value-after-history-back-frame.html
blob02451ba95fbc2cfb5ab36d633bb8f27b2ae06c63
1 <!DOCTYPE html>
2 <body>
3 <input type="datetime-local" id="test1">
4 <input type="datetime-local" id="test2" min="1999-01-01T00:00" max="2000-12-31T23:59">
5 <script>
6 function fieldsText(input) {
7 return window.internals.oldestShadowRoot(input).textContent;
10 // On Linux/Android with a newer ICU, date and time are separated by ','.
11 function insertCommaIfNecessary(expected, input) {
12 return (fieldsText(input).indexOf(', ') == -1) ? expected :
13 expected.replace(' ', ', ');
16 function back(newState) {
17 parent.state = newState;
18 history.back();
21 function forward(newState) {
22 parent.state = newState;
23 history.forward();
26 function keyDown(key) {
27 eventSender.keyDown(key);
30 var testInput1 = document.getElementById('test1');
31 var testInput2 = document.getElementById('test2');
32 var pageName = location.search || '?page1';
34 window.onload = function() {
35 switch (pageName) {
36 case '?page1':
37 switch (parent.state) {
38 case 'direct': {
39 testInput1.value = '12012-10-09T01:23';
40 testInput2.focus();
41 keyDown('upArrow'); // -> [01]/dd/yyyy --:-- --
42 keyDown('\t'); // -> 01/[dd]/yyyy --:-- --
43 keyDown('\t'); // -> 01/dd/[yyyy] --:-- --
44 keyDown('upArrow'); // -> 01/dd/[1999] --:-- --
45 keyDown('\t'); // -> 01/dd/1999 [--]:-- --
46 keyDown('\t'); // -> 01/dd/1999 --:[--] --
47 keyDown('upArrow'); // -> 01/dd/1999 --:[00] --
49 var nextUri = location.toString().replace('?page1', '?page2');
50 setTimeout(function() { window.location.href = nextUri; }, 0);
51 break;
53 case 'backTo1':
54 parent.testCases.push(
56 'description' : 'Went back to a page. Checking a form control which had a full value',
57 'actual' : testInput1.value,
58 'expected' : '12012-10-09T01:23' },
60 'description' : 'Went back to a page. Checking a form control which had a partial value',
61 'actual' : fieldsText(testInput2),
62 'expected' : insertCommaIfNecessary('01/dd/1999 --:00 --', testInput1)
63 });
64 forward('forwardTo2');
65 break;
66 case 'backTo1Second':
67 parent.finishTest();
68 break;
69 default:
70 parent.failed('Unexpected state(' + parent.state + ')');
71 break;
73 break;
75 case '?page2':
76 switch (parent.state) {
77 case 'direct':
78 testInput1.value = '0001-11-17T23:55';
79 testInput2.focus();
80 keyDown('\t'); // -> mm/[dd]/yyyy --:-- --
81 keyDown('downArrow'); // -> mm/[31]/yyyy --:-- --
82 keyDown('\t'); // -> mm/31/[yyyy] --:-- --
83 keyDown('\t'); // -> mm/31/yyyy [--]:-- --
84 keyDown('downArrow'); // -> mm/31/yyyy [12]:-- --
85 keyDown('\t'); // -> mm/31/yyyy 12:[--] --
86 keyDown('\t'); // -> mm/31/yyyy 12:-- [--]
87 keyDown('downArrow'); // -> mm/31/yyyy 12:-- [PM]
88 back('backTo1');
89 break;
90 case 'forwardTo2':
91 parent.testCases.push(
93 'description' : 'Went forward to a page. Checking a form control which had a full value',
94 'actual' : testInput1.value,
95 'expected' : '0001-11-17T23:55'
98 'description' : 'Went forward to a page. Checking a form control which had a partial value',
99 'actual' : fieldsText(testInput2),
100 'expected' : insertCommaIfNecessary('mm/31/yyyy 12:-- PM', testInput1)
102 back('backTo1Second');
103 break;
104 default:
105 parent.failed('Unexpected state(' + parent.state + ')');
106 break;
108 break;
110 default:
111 parent.failed('Unexpected page(' + pageName + ')');
112 break;
115 </script>
116 </body>