blob: 5af5ecf6ce425ddb9ce4557f6e4146a009a66fb4 [file] [log] [blame]
<!DOCTYPE html>
<body>
<input type="month" id="test1">
<input type="month" id="test2" min="1998-01" max="1999-12">
<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 = '12012-10';
testInput2.focus();
keyDown('ArrowUp'); // -> [October] 12012
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' : '12012-10' },
{
'description' : 'Went back to a page. Checking a form control which had a partial value',
'actual' : fieldsText(testInput2),
'expected' : 'January ----'
});
forward('forwardTo2');
break;
case 'backTo1Second':
parent.finishTest();
break;
default:
parent.failed('Unexpected state(' + parent.state + ')');
break;
}
break;
case '?page2':
switch (parent.state) {
case 'direct':
testInput1.value = '0001-11';
testInput2.focus();
keyDown('\t'); // -> --------- [yyyy]
keyDown('ArrowDown'); // -> --------- [1999]
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' : '0001-11'
},
{
'description' : 'Went forward to a page. Checking a form control which had a partial value',
'actual' : fieldsText(testInput2),
'expected' : '--------- 1999'
});
back('backTo1Second');
break;
default:
parent.failed('Unexpected state(' + parent.state + ')');
break;
}
break;
default:
parent.failed('Unexpected page(' + pageName + ')');
break;
}
}, 1); };
</script>
</body>