3 <input type=
"date" id=
"test1">
4 <input type=
"date" id=
"test2" min=
"1999-01-01" max=
"2000-12-31">
6 function fieldsText(input
) {
7 return window
.internals
.oldestShadowRoot(input
).textContent
;
10 function back(newState
) {
11 parent
.state
= newState
;
15 function forward(newState
) {
16 parent
.state
= newState
;
20 function keyDown(key
) {
21 eventSender
.keyDown(key
);
24 var testInput1
= document
.getElementById('test1');
25 var testInput2
= document
.getElementById('test2');
26 var pageName
= location
.search
|| '?page1';
28 window
.onload = function() {
31 switch (parent
.state
) {
33 testInput1
.value
= '12012-10-09';
35 keyDown('upArrow'); // -> [01]/dd/yyyy
36 keyDown('\t'); // -> 01/[dd]/yyyy
37 keyDown('\t'); // -> 01/dd/[yyyy]
38 keyDown('upArrow'); // -> 01/dd/[1999]
39 var nextUri
= location
.toString().replace('?page1', '?page2');
40 setTimeout(function() { window
.location
.href
= nextUri
; }, 0);
44 parent
.testCases
.push(
46 'description' : 'Went back to a page. Checking a form control which had a full value',
47 'actual' : testInput1
.value
,
48 'expected' : '12012-10-09' },
50 'description' : 'Went back to a page. Checking a form control which had a partial value',
51 'actual' : fieldsText(testInput2
),
52 'expected' : '01/dd/1999'
54 forward('forwardTo2');
60 parent
.failed('Unexpected state(' + parent
.state
+ ')');
66 switch (parent
.state
) {
68 testInput1
.value
= '0001-11-17';
70 keyDown('\t'); // -> mm/[dd]/yyyy
71 keyDown('downArrow'); // -> mm/[31]/yyyy
75 parent
.testCases
.push(
77 'description' : 'Went forward to a page. Checking a form control which had a full value',
78 'actual' : testInput1
.value
,
79 'expected' : '0001-11-17'
82 'description' : 'Went forward to a page. Checking a form control which had a partial value',
83 'actual' : fieldsText(testInput2
),
84 'expected' : 'mm/31/yyyy'
86 back('backTo1Second');
89 parent
.failed('Unexpected state(' + parent
.state
+ ')');
95 parent
.failed('Unexpected page(' + pageName
+ ')');