Remove SnowLeopard expected results.
[WebKit-https.git] / LayoutTests / fast / forms / time-multiple-fields / time-multiple-fields-stepup-stepdown-from-renderer.html
index 2e8a81e..5d73429 100644 (file)
@@ -2,10 +2,13 @@
 <html>
 <head>
 <script src="../../js/resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
 </head>
 <body>
 <script>
 description('Check stepping-up and -down for time input fields from renderer. No cases of empty initial values.');
+if (!window.internals)
+    testFailed('This test requires window.internals.');
 
 var input = document.createElement('input');
 var invalidStateErr = '"Error: InvalidStateError: DOM Exception 11"';
@@ -19,6 +22,11 @@ function keyDown(key, modifiers)
     eventSender.keyDown(key, modifiers);
 }
 
+function setDateTimeFormat(pattern) {
+    getElementByPseudoId(internals.youngestShadowRoot(input), '-webkit-datetime-edit').setAttribute('pattern', pattern);
+    input.value = '';  // Updates the element for new format
+}
+
 function setInputAttributes(value, min, max, step) {
     input.value = value;
     input.min = min;
@@ -77,6 +85,16 @@ shouldBeEqualToString('test("07:13:00.500", 0.100, null, null, ["delete", "upArr
 shouldBeEqualToString('test("07:13:00.500", 0.100, null, null, ["delete", "downArrow"])', '07:13:00.900');
 shouldBeEqualToString('test("07:13:00.500", 0.100, "00:00:00.050", null, ["delete", "upArrow"])', '07:13:00.050');
 shouldBeEqualToString('test("07:13:00.500", 0.100, "00:00:00.050", null, ["delete", "downArrow"])', '07:13:00.950');
+shouldBeEqualToString('stepUp("07:13:00.010", 0.001, "07:13:00.005", "07:13:00.010")', '07:13:00.005');
+shouldBeEqualToString('stepDown("07:13:00.005", 0.001, "07:13:00.005", "07:13:00.010")', '07:13:00.010');
+shouldBeEqualToString('stepUp("07:13:00.005", 0.001, "07:13:00.010", "07:13:00.020")', '07:13:00.010');
+shouldBeEqualToString('stepDown("07:13:00.005", 0.001, "07:13:00.010", "07:13:00.020")', '07:13:00.020');
+shouldBeEqualToString('stepUp("07:13:00.005", 0.001, "07:13:00.002", "07:13:00.002")', '07:13:00.002');
+shouldBeEqualToString('stepDown("07:13:00.005", 0.001, "07:13:00.002", "07:13:00.002")', '07:13:00.002');
+shouldBeEqualToString('stepUp("07:13:00.035", 0.01, "07:13:00.010", "07:13:00.035")', '07:13:00.010');
+shouldBeEqualToString('stepDown("07:13:00.035", 0.01, "07:13:00.010", "07:13:00.035")', '07:13:00.030');
+shouldBeEqualToString('stepUp("07:13:00.010", 0.001, "07:13:00.010", "07:13:01.020")', '07:13:00.011');
+shouldBeEqualToString('stepDown("07:13:00.010", 0.001, "07:13:00.010", "07:13:01.020")', '07:13:00.009');
 
 debug('Seconds');
 keyDown('leftArrow');
@@ -104,6 +122,16 @@ shouldBeEqualToString('test("07:13:30", 10, null, null, ["delete", "upArrow"])',
 shouldBeEqualToString('test("07:13:30", 10, null, null, ["delete", "downArrow"])', '07:13:50');
 shouldBeEqualToString('test("07:13:30", 10, "00:00:05", null, ["delete", "upArrow"])', '07:13:05');
 shouldBeEqualToString('test("07:13:30", 10, "00:00:05", null, ["delete", "downArrow"])', '07:13:55');
+shouldBeEqualToString('stepUp("07:13:10", 1, "07:13:05", "07:13:10")', '07:13:05');
+shouldBeEqualToString('stepDown("07:13:05", 1, "07:13:05", "07:13:10")', '07:13:10');
+shouldBeEqualToString('stepUp("07:13:05", 1, "07:13:10", "07:13:20")', '07:13:10');
+shouldBeEqualToString('stepDown("07:13:05", 1, "07:13:10", "07:13:20")', '07:13:20');
+shouldBeEqualToString('stepUp("07:13:05", 1, "07:13:02", "07:13:02")', '07:13:02');
+shouldBeEqualToString('stepDown("07:13:05", 1, "07:13:02", "07:13:02")', '07:13:02');
+shouldBeEqualToString('stepUp("07:13:35", 10, "07:13:10", "07:13:35")', '07:13:10');
+shouldBeEqualToString('stepDown("07:13:35", 10, "07:13:10", "07:13:35")', '07:13:30');
+shouldBeEqualToString('stepUp("07:13:10", 1, "07:13:10", "07:14:20")', '07:13:11');
+shouldBeEqualToString('stepDown("07:13:10", 1, "07:13:10", "07:14:20")', '07:13:09');
 
 debug('Minutes');
 keyDown('leftArrow');
@@ -131,7 +159,188 @@ shouldBeEqualToString('test("07:13", 600, null, null, ["delete", "upArrow"])', '
 shouldBeEqualToString('test("07:13", 600, null, null, ["delete", "downArrow"])', '07:50');
 shouldBeEqualToString('test("07:13", 600, "00:05", null, ["delete", "upArrow"])', '07:05');
 shouldBeEqualToString('test("07:13", 600, "00:05", null, ["delete", "downArrow"])', '07:55');
+shouldBeEqualToString('stepUp("07:10", 1, "07:05", "07:10")', '07:05');
+shouldBeEqualToString('stepDown("07:05", 1, "07:05", "07:10")', '07:10');
+shouldBeEqualToString('stepUp("07:05", 1, "07:10", "07:20")', '07:10');
+shouldBeEqualToString('stepDown("07:05", 1, "07:10", "07:20")', '07:20');
+shouldBeEqualToString('stepUp("07:05", 1, "07:00", "07:00")', '07:00');
+shouldBeEqualToString('stepDown("07:05", 1, "07:00", "07:00")', '07:00');
+shouldBeEqualToString('stepUp("07:35", 600, "07:10", "07:35")', '07:10');
+shouldBeEqualToString('stepDown("07:35", 600, "07:10", "07:35")', '07:30');
+shouldBeEqualToString('stepUp("07:10", 1, "07:10", "08:20")', '07:11');
+shouldBeEqualToString('stepDown("07:10", 1, "07:10", "08:20")', '07:09');
+
+debug('Hours, 1-12');
+keyDown('leftArrow');
+shouldBeEqualToString('stepUp("07:00", 1, null, null)', '08:00');
+shouldBeEqualToString('stepDown("07:00", 1, null, null)', '06:00');
+shouldBeEqualToString('stepUp("11:00", 1, null, null)', '00:00');
+shouldBeEqualToString('stepDown("00:00", 1, null, null)', '11:00');
+shouldBeEqualToString('stepUp("06:00", 7200, null, null)', '08:00');
+shouldBeEqualToString('stepDown("06:00", 7200, null, null)', '04:00');
+shouldBeEqualToString('stepUp("10:00", 7200, null, null)', '00:00');
+shouldBeEqualToString('stepDown("00:00", 7200, null, null)', '10:00');
+shouldBeEqualToString('stepUp("07:00", 7200, null, null)', '08:00');
+shouldBeEqualToString('stepDown("07:00", 7200, null, null)', '06:00');
+shouldBeEqualToString('stepUp("06:00", 3601, null, null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 3601, null, null)', '05:00');
+shouldBeEqualToString('stepUp("06:00", 0, null, null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 0, null, null)', '05:00');
+shouldBeEqualToString('stepUp("06:00", 86400, null, null)', '00:00');
+shouldBeEqualToString('stepDown("06:00", 86400, null, null)', '00:00');
+shouldBeEqualToString('stepUp("06:00", 36000, null, null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 36000, null, null)', '05:00');
+shouldBeEqualToString('stepUp("06:00", 7200, "01:00", null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 7200, "01:00", null)', '05:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "upArrow"])', '02:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "downArrow"])', '00:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '12:00 AM');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "upArrow"])', '01:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "downArrow"])', '11:00');
+shouldBeEqualToString('stepUp("17:00", 1, "17:00", "20:00")', '18:00');
+shouldBeEqualToString('stepDown("17:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("17:00", 1, "15:00", "17:00")', '15:00');
+shouldBeEqualToString('stepDown("17:00", 1, "15:00", "17:00")', '16:00');
+shouldBeEqualToString('stepUp("15:00", 1, "17:00", "20:00")', '17:00');
+shouldBeEqualToString('stepDown("15:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepDown("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepUp("12:00", 1, "12:00", "15:00")', '13:00');
+shouldBeEqualToString('stepDown("12:00", 1, "12:00", "15:00")', '23:00');
+shouldBeEqualToString('stepUp("15:00", 1, "12:00", "15:00")', '16:00');
+shouldBeEqualToString('stepDown("15:00", 1, "12:00", "15:00")', '14:00');
+shouldBeEqualToString('stepUp("12:00", 1, "10:00", "12:00")', '13:00');
+shouldBeEqualToString('stepDown("12:00", 1, "10:00", "12:00")', '23:00');
+shouldBeEqualToString('stepUp("00:00", 1, "00:00", "03:00")', '01:00');
+shouldBeEqualToString('stepDown("00:00", 1, "00:00", "03:00")', '11:00');
+shouldBeEqualToString('stepUp("15:00", 1, "10:00", "15:00")', '16:00');
+shouldBeEqualToString('stepDown("10:00", 1, "10:00", "15:00")', '09:00');
+shouldBeEqualToString('stepUp("17:00", 7200, "17:00", "20:00")', '19:00');
+shouldBeEqualToString('stepDown("17:00", 7200, "17:00", "20:00")', '19:00');
+shouldBeEqualToString('stepUp("17:00", 7200, "17:00", "18:00")', '17:00');
+shouldBeEqualToString('stepDown("17:00", 7200, "17:00", "18:00")', '17:00');
+
+debug('Hours, 0-11');
+setDateTimeFormat('KK:mm a');
+shouldBeEqualToString('stepUp("11:00", 1, null, null)', '00:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '00:00 AM');
+shouldBeEqualToString('stepDown("00:00", 1, null, null)', '11:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '11:00 AM');
+shouldBeEqualToString('stepUp("23:00", 1, null, null)', '12:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '00:00 PM');
+shouldBeEqualToString('stepDown("12:00", 1, null, null)', '23:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '11:00 PM');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "upArrow"])', '00:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "downArrow"])', '10:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "upArrow"])', '01:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "downArrow"])', '11:00');
+shouldBeEqualToString('stepUp("17:00", 1, "17:00", "20:00")', '18:00');
+shouldBeEqualToString('stepDown("17:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("17:00", 1, "15:00", "17:00")', '15:00');
+shouldBeEqualToString('stepDown("17:00", 1, "15:00", "17:00")', '16:00');
+shouldBeEqualToString('stepUp("15:00", 1, "17:00", "20:00")', '17:00');
+shouldBeEqualToString('stepDown("15:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepDown("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepUp("12:00", 1, "12:00", "15:00")', '13:00');
+shouldBeEqualToString('stepDown("12:00", 1, "12:00", "15:00")', '15:00');
+shouldBeEqualToString('stepUp("15:00", 1, "12:00", "15:00")', '12:00');
+shouldBeEqualToString('stepDown("15:00", 1, "12:00", "15:00")', '14:00');
+shouldBeEqualToString('stepUp("12:00", 1, "10:00", "12:00")', '13:00');
+shouldBeEqualToString('stepDown("12:00", 1, "10:00", "12:00")', '23:00');
+shouldBeEqualToString('stepUp("00:00", 1, "00:00", "03:00")', '01:00');
+shouldBeEqualToString('stepDown("00:00", 1, "00:00", "03:00")', '03:00');
+shouldBeEqualToString('stepUp("15:00", 1, "10:00", "15:00")', '16:00');
+shouldBeEqualToString('stepDown("10:00", 1, "10:00", "15:00")', '09:00');
+shouldBeEqualToString('stepUp("20:00", 7200, "17:00", "20:00")', '17:00');
+shouldBeEqualToString('stepDown("20:00", 7200, "17:00", "20:00")', '19:00');
+
+debug('Hours, 0-23');
+setDateTimeFormat('HH:mm');
+shouldBeEqualToString('stepUp("07:00", 1, null, null)', '08:00');
+shouldBeEqualToString('stepDown("07:00", 1, null, null)', '06:00');
+shouldBeEqualToString('stepUp("23:00", 1, null, null)', '00:00');
+shouldBeEqualToString('stepDown("00:00", 1, null, null)', '23:00');
+shouldBeEqualToString('stepUp("06:00", 7200, null, null)', '08:00');
+shouldBeEqualToString('stepDown("06:00", 7200, null, null)', '04:00');
+shouldBeEqualToString('stepUp("22:00", 7200, null, null)', '00:00');
+shouldBeEqualToString('stepDown("00:00", 7200, null, null)', '22:00');
+shouldBeEqualToString('stepUp("07:00", 7200, null, null)', '08:00');
+shouldBeEqualToString('stepDown("07:00", 7200, null, null)', '06:00');
+shouldBeEqualToString('stepUp("06:00", 3601, null, null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 3601, null, null)', '05:00');
+shouldBeEqualToString('stepUp("06:00", 0, null, null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 0, null, null)', '05:00');
+shouldBeEqualToString('stepUp("06:00", 86400, null, null)', '00:00');
+shouldBeEqualToString('stepDown("06:00", 86400, null, null)', '00:00');
+shouldBeEqualToString('stepUp("06:00", 36000, null, null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 36000, null, null)', '05:00');
+shouldBeEqualToString('stepUp("06:00", 7200, "01:00", null)', '07:00');
+shouldBeEqualToString('stepDown("06:00", 7200, "01:00", null)', '05:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "upArrow"])', '00:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '00:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "downArrow"])', '22:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "upArrow"])', '01:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "downArrow"])', '23:00');
+shouldBeEqualToString('stepUp("17:00", 1, "17:00", "20:00")', '18:00');
+shouldBeEqualToString('stepDown("17:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("17:00", 1, "15:00", "17:00")', '15:00');
+shouldBeEqualToString('stepDown("17:00", 1, "15:00", "17:00")', '16:00');
+shouldBeEqualToString('stepUp("15:00", 1, "17:00", "20:00")', '17:00');
+shouldBeEqualToString('stepDown("15:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepDown("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepUp("00:00", 1, "00:00", "03:00")', '01:00');
+shouldBeEqualToString('stepDown("00:00", 1, "00:00", "03:00")', '03:00');
+shouldBeEqualToString('stepUp("03:00", 1, "00:00", "03:00")', '00:00');
+shouldBeEqualToString('stepDown("03:00", 1, "00:00", "03:00")', '02:00');
+shouldBeEqualToString('stepUp("12:00", 1, "10:00", "12:00")', '10:00');
+shouldBeEqualToString('stepDown("12:00", 1, "10:00", "12:00")', '11:00');
+shouldBeEqualToString('stepUp("00:00", 1, "00:00", "03:00")', '01:00');
+shouldBeEqualToString('stepDown("00:00", 1, "00:00", "03:00")', '03:00');
+shouldBeEqualToString('stepUp("15:00", 1, "10:00", "15:00")', '10:00');
+shouldBeEqualToString('stepDown("10:00", 1, "10:00", "15:00")', '15:00');
+shouldBeEqualToString('stepUp("20:00", 7200, "17:00", "20:00")', '17:00');
+shouldBeEqualToString('stepDown("20:00", 7200, "17:00", "20:00")', '19:00');
+
+debug('Hours, 1-24');
+setDateTimeFormat('kk:mm');
+shouldBeEqualToString('stepUp("11:00", 1, null, null)', '12:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '12:00');
+shouldBeEqualToString('stepDown("00:00", 1, null, null)', '23:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '23:00');
+shouldBeEqualToString('stepUp("23:00", 1, null, null)', '00:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '24:00');
+shouldBeEqualToString('stepDown("12:00", 1, null, null)', '11:00');
+shouldBeEqualToString('getUserAgentShadowTextContent(input)', '11:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "upArrow"])', '02:00');
+shouldBeEqualToString('test("06:00", 7200, null, null, ["delete", "downArrow"])', '00:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "upArrow"])', '01:00');
+shouldBeEqualToString('test("06:00", 7200, "01:00", null, ["delete", "downArrow"])', '23:00');
+shouldBeEqualToString('stepUp("17:00", 1, "17:00", "20:00")', '18:00');
+shouldBeEqualToString('stepDown("17:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("17:00", 1, "15:00", "17:00")', '15:00');
+shouldBeEqualToString('stepDown("17:00", 1, "15:00", "17:00")', '16:00');
+shouldBeEqualToString('stepUp("15:00", 1, "17:00", "20:00")', '17:00');
+shouldBeEqualToString('stepDown("15:00", 1, "17:00", "20:00")', '20:00');
+shouldBeEqualToString('stepUp("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepDown("15:00", 1, "13:00", "13:00")', '13:00');
+shouldBeEqualToString('stepUp("00:00", 1, "00:00", "03:00")', '01:00');
+shouldBeEqualToString('stepDown("00:00", 1, "00:00", "03:00")', '23:00');
+shouldBeEqualToString('stepUp("03:00", 1, "00:00", "03:00")', '04:00');
+shouldBeEqualToString('stepDown("03:00", 1, "00:00", "03:00")', '02:00');
+shouldBeEqualToString('stepUp("12:00", 1, "10:00", "12:00")', '10:00');
+shouldBeEqualToString('stepDown("12:00", 1, "10:00", "12:00")', '11:00');
+shouldBeEqualToString('stepUp("00:00", 1, "00:00", "03:00")', '01:00');
+shouldBeEqualToString('stepDown("00:00", 1, "00:00", "03:00")', '23:00');
+shouldBeEqualToString('stepUp("15:00", 1, "10:00", "15:00")', '10:00');
+shouldBeEqualToString('stepDown("10:00", 1, "10:00", "15:00")', '15:00');
+shouldBeEqualToString('stepUp("17:00", 7200, "17:00", "20:00")', '19:00');
+shouldBeEqualToString('stepDown("17:00", 7200, "17:00", "20:00")', '19:00');
+shouldBeEqualToString('stepUp("17:00", 7200, "17:00", "18:00")', '17:00');
+shouldBeEqualToString('stepDown("17:00", 7200, "17:00", "18:00")', '17:00');
 
+setDateTimeFormat('');
 debug('');
 document.body.removeChild(input);
 </script>