chromium/third_party/blink/web_tests/fast/forms/datetimelocal-multiple-fields/datetimelocal-multiple-fields-ax-aria-attributes.html

<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
</head>
<body>
<input id="test" type="datetime-local" step="0.001" value="2012-10-09T12:34:56.789" aria-label="TestLabel" title="TestTitle">
<script>
var testInput = document.getElementById('test');

test(function(t) {
    testInput.focus();
    assert_equals(focusedElementDescription(),
                  'Month TestLabel, mm, "10", TestTitle, intValue:10, range:1-12');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'Day TestLabel, dd, "09", TestTitle, intValue:9, range:1-31');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'Year TestLabel, yyyy, "2012", TestTitle, intValue:2012, range:1-275760');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'Hours TestLabel, --, "12", TestTitle, intValue:12, range:1-12');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'Minutes TestLabel, --, "34", TestTitle, intValue:34, range:0-59');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'Seconds TestLabel, --, "56", TestTitle, intValue:56, range:0-59');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'Milliseconds TestLabel, ---, "789", TestTitle, intValue:789, range:0-999');
    eventSender.keyDown('\t');
    assert_equals(focusedElementDescription(),
                  'AM/PM TestLabel, --, "PM", TestTitle, intValue:2, range:1-2');
}, 'Non-empty value');

test(function(t) {
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'AM/PM TestLabel, --, "", TestTitle, intValue:0, range:1-2');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Milliseconds TestLabel, ---, "", TestTitle, intValue:0, range:0-999');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Seconds TestLabel, --, "", TestTitle, intValue:0, range:0-59');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Minutes TestLabel, --, "", TestTitle, intValue:0, range:0-59');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Hours TestLabel, --, "", TestTitle, intValue:0, range:1-12');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Year TestLabel, yyyy, "", TestTitle, intValue:0, range:1-275760');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Day TestLabel, dd, "", TestTitle, intValue:0, range:1-31');
    eventSender.keyDown('\t', ['shiftKey']);
    eventSender.keyDown('Backspace');
    assert_equals(focusedElementDescription(),
                  'Month TestLabel, mm, "", TestTitle, intValue:0, range:1-12');
}, 'Empty value');

</script>
</body>
</html>