Changeset 92746 in webkit


Ignore:
Timestamp:
Aug 9, 2011 9:43:59 PM (13 years ago)
Author:
tkent@chromium.org
Message:

Move <input type=time> tests to fast/forms/time/
https://bugs.webkit.org/show_bug.cgi?id=65955

Reviewed by Hajime Morita.

  • fast/forms/ValidityState-rangeOverflow-expected.txt: Removed 'time' part.
  • fast/forms/ValidityState-rangeUnderflow-expected.txt: ditto.
  • fast/forms/ValidityState-stepMismatch-expected.txt: ditto.
  • fast/forms/ValidityState-typeMismatch-time-expected.txt: Removed.
  • fast/forms/ValidityState-typeMismatch-time.html: Removed.
  • fast/forms/input-stepup-stepdown-expected.txt: Removed 'time' part.
  • fast/forms/input-stepup-stepdown-from-renderer-expected.txt: ditto.
  • fast/forms/input-type-change3-expected.txt: ditto.
  • fast/forms/input-valueasdate-time-expected.txt: Removed.
  • fast/forms/input-valueasdate-time.html: Removed.
  • fast/forms/input-valueasnumber-time-expected.txt: Removed.
  • fast/forms/input-valueasnumber-time.html: Removed.
  • fast/forms/script-tests/ValidityState-rangeOverflow.js: Removed 'time' part.
  • fast/forms/script-tests/ValidityState-rangeUnderflow.js: ditto.
  • fast/forms/script-tests/ValidityState-stepMismatch.js: ditto.
  • fast/forms/script-tests/ValidityState-typeMismatch-time.js: Removed.
  • fast/forms/script-tests/input-stepup-stepdown-from-renderer.js: Removed 'time' part.
  • fast/forms/script-tests/input-stepup-stepdown.js: ditto.
  • fast/forms/script-tests/input-type-change3.js: ditto.
  • fast/forms/script-tests/input-valueasdate-time.js: Removed.
  • fast/forms/script-tests/input-valueasnumber-time.js: Removed.
  • fast/forms/time: Added.
  • fast/forms/time/ValidityState-rangeOverflow-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt.
  • fast/forms/time/ValidityState-rangeOverflow-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js.
  • fast/forms/time/ValidityState-rangeUnderflow-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt.
  • fast/forms/time/ValidityState-rangeUnderflow-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js.
  • fast/forms/time/ValidityState-stepMismatch-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt.
  • fast/forms/time/ValidityState-stepMismatch-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js.
  • fast/forms/time/ValidityState-typeMismatch-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt.
  • fast/forms/time/ValidityState-typeMismatch-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js.
  • fast/forms/time/input-valueasdate-time-expected.txt: Copied from LayoutTests/fast/forms/input-valueasdate-time-expected.txt.
  • fast/forms/time/input-valueasdate-time.html: Copied from LayoutTests/fast/forms/script-tests/input-valueasdate-time.js.
  • fast/forms/time/input-valueasnumber-time-expected.txt: Copied from LayoutTests/fast/forms/input-valueasnumber-time-expected.txt.
  • fast/forms/time/input-valueasnumber-time.html: Copied from LayoutTests/fast/forms/script-tests/input-valueasnumber-time.js.
  • fast/forms/time/time-input-type-expected.txt: Copied from LayoutTests/fast/forms/week/week-input-type-expected.txt.
  • fast/forms/time/time-input-type.html: Copied from LayoutTests/fast/forms/week/week-input-type.html.
  • fast/forms/time/time-input-visible-string-expected.txt: Copied from LayoutTests/fast/forms/week/week-input-visible-string-expected.txt.
  • fast/forms/time/time-input-visible-string.html: Copied from LayoutTests/fast/forms/week/week-input-visible-string.html.
  • fast/forms/time/time-stepup-stepdown-expected.txt: Copied from LayoutTests/fast/forms/input-stepup-stepdown-expected.txt.
  • fast/forms/time/time-stepup-stepdown-from-renderer-expected.txt: Copied from LayoutTests/fast/forms/input-stepup-stepdown-from-renderer-expected.txt.
  • fast/forms/time/time-stepup-stepdown-from-renderer.html: Copied from LayoutTests/fast/forms/script-tests/input-stepup-stepdown-from-renderer.js.
  • fast/forms/time/time-stepup-stepdown.html: Copied from LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js.
Location:
trunk/LayoutTests
Files:
1 added
3 deleted
13 edited
14 copied
6 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r92744 r92746  
     12011-08-09  Kent Tamura  <tkent@chromium.org>
     2
     3        Move <input type=time> tests to fast/forms/time/
     4        https://bugs.webkit.org/show_bug.cgi?id=65955
     5
     6        Reviewed by Hajime Morita.
     7
     8        * fast/forms/ValidityState-rangeOverflow-expected.txt: Removed 'time' part.
     9        * fast/forms/ValidityState-rangeUnderflow-expected.txt: ditto.
     10        * fast/forms/ValidityState-stepMismatch-expected.txt: ditto.
     11        * fast/forms/ValidityState-typeMismatch-time-expected.txt: Removed.
     12        * fast/forms/ValidityState-typeMismatch-time.html: Removed.
     13        * fast/forms/input-stepup-stepdown-expected.txt: Removed 'time' part.
     14        * fast/forms/input-stepup-stepdown-from-renderer-expected.txt: ditto.
     15        * fast/forms/input-type-change3-expected.txt: ditto.
     16        * fast/forms/input-valueasdate-time-expected.txt: Removed.
     17        * fast/forms/input-valueasdate-time.html: Removed.
     18        * fast/forms/input-valueasnumber-time-expected.txt: Removed.
     19        * fast/forms/input-valueasnumber-time.html: Removed.
     20        * fast/forms/script-tests/ValidityState-rangeOverflow.js: Removed 'time' part.
     21        * fast/forms/script-tests/ValidityState-rangeUnderflow.js: ditto.
     22        * fast/forms/script-tests/ValidityState-stepMismatch.js: ditto.
     23        * fast/forms/script-tests/ValidityState-typeMismatch-time.js: Removed.
     24        * fast/forms/script-tests/input-stepup-stepdown-from-renderer.js: Removed 'time' part.
     25        * fast/forms/script-tests/input-stepup-stepdown.js: ditto.
     26        * fast/forms/script-tests/input-type-change3.js: ditto.
     27        * fast/forms/script-tests/input-valueasdate-time.js: Removed.
     28        * fast/forms/script-tests/input-valueasnumber-time.js: Removed.
     29        * fast/forms/time: Added.
     30        * fast/forms/time/ValidityState-rangeOverflow-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt.
     31        * fast/forms/time/ValidityState-rangeOverflow-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js.
     32        * fast/forms/time/ValidityState-rangeUnderflow-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt.
     33        * fast/forms/time/ValidityState-rangeUnderflow-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js.
     34        * fast/forms/time/ValidityState-stepMismatch-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt.
     35        * fast/forms/time/ValidityState-stepMismatch-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js.
     36        * fast/forms/time/ValidityState-typeMismatch-time-expected.txt: Copied from LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt.
     37        * fast/forms/time/ValidityState-typeMismatch-time.html: Copied from LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js.
     38        * fast/forms/time/input-valueasdate-time-expected.txt: Copied from LayoutTests/fast/forms/input-valueasdate-time-expected.txt.
     39        * fast/forms/time/input-valueasdate-time.html: Copied from LayoutTests/fast/forms/script-tests/input-valueasdate-time.js.
     40        * fast/forms/time/input-valueasnumber-time-expected.txt: Copied from LayoutTests/fast/forms/input-valueasnumber-time-expected.txt.
     41        * fast/forms/time/input-valueasnumber-time.html: Copied from LayoutTests/fast/forms/script-tests/input-valueasnumber-time.js.
     42        * fast/forms/time/time-input-type-expected.txt: Copied from LayoutTests/fast/forms/week/week-input-type-expected.txt.
     43        * fast/forms/time/time-input-type.html: Copied from LayoutTests/fast/forms/week/week-input-type.html.
     44        * fast/forms/time/time-input-visible-string-expected.txt: Copied from LayoutTests/fast/forms/week/week-input-visible-string-expected.txt.
     45        * fast/forms/time/time-input-visible-string.html: Copied from LayoutTests/fast/forms/week/week-input-visible-string.html.
     46        * fast/forms/time/time-stepup-stepdown-expected.txt: Copied from LayoutTests/fast/forms/input-stepup-stepdown-expected.txt.
     47        * fast/forms/time/time-stepup-stepdown-from-renderer-expected.txt: Copied from LayoutTests/fast/forms/input-stepup-stepdown-from-renderer-expected.txt.
     48        * fast/forms/time/time-stepup-stepdown-from-renderer.html: Copied from LayoutTests/fast/forms/script-tests/input-stepup-stepdown-from-renderer.js.
     49        * fast/forms/time/time-stepup-stepdown.html: Copied from LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js.
     50
    1512011-08-09  Abhishek Arya  <inferno@chromium.org>
    252
  • trunk/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt

    r92728 r92746  
    6464PASS The value "101" overflows the maximum value "100".
    6565PASS The value "101" doesn't overflow the maximum value "1E+2" when disabled.
    66 
    67 Type=time
    68 PASS The value "13:16" doesn't overflow the maximum value "".
    69 PASS The value "13:16" doesn't overflow the maximum value "".
    70 PASS The value "13:16" doesn't overflow the maximum value "foo".
    71 PASS The value "13:16" doesn't overflow the maximum value "13:16".
    72 PASS The value "13:16" doesn't overflow the maximum value "13:17".
    73 PASS The value "13:16" doesn't overflow the maximum value "14:15".
    74 PASS The value "foo" doesn't overflow the maximum value "13:16".
    75 PASS The value "13:16" overflows the maximum value "13:15".
    76 PASS The value "23:59:59.999" overflows the maximum value "13:16".
    77 PASS The value "13:16" overflows the maximum value "12:00".
    78 PASS The value "23:59:59.999" doesn't overflow the maximum value "13:16" when disabled.
    7966PASS successfullyParsed is true
    8067
  • trunk/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt

    r92728 r92746  
    6464PASS The value "101" undeflows the minimum value "200".
    6565PASS The value "99" doesn't underflow the minimum value "1E+2" when disabled.
    66 
    67 Type=time
    68 PASS The value "13:16" doesn't underflow the minimum value "".
    69 PASS The value "13:16" doesn't underflow the minimum value "".
    70 PASS The value "13:16" doesn't underflow the minimum value "foo".
    71 PASS The value "00:00:00.000" doesn't underflow the minimum value "".
    72 PASS The value "23:59:59.999" doesn't underflow the minimum value "".
    73 PASS The value "13:16" doesn't underflow the minimum value "11:00".
    74 PASS The value "13:16" doesn't underflow the minimum value "13:16".
    75 PASS The value "foo" doesn't underflow the minimum value "11:00".
    76 PASS The value "13:16" undeflows the minimum value "13:17".
    77 PASS The value "23:59" undeflows the minimum value "23:59:30".
    78 PASS The value "13:16" undeflows the minimum value "14:00".
    79 PASS The value "23:59" doesn't underflow the minimum value "23:59:30" when disabled.
    8066PASS successfullyParsed is true
    8167
  • trunk/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt

    r92728 r92746  
    1 Check stepMismatch results for type=date, datetime, datetime-local, time.
     1Check stepMismatch results for type=date, datetime, datetime-local.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    155155PASS stepMismatchFor("1", "2", "0", true) is false
    156156
    157 Time type
    158 Empty values
    159 PASS stepMismatchFor("", null, null) is false
    160 PASS stepMismatchFor("", "2", "12:34:56") is false
    161 Normal step values
    162 PASS stepMismatchFor("12:34:55", "1", "12:34:56") is false
    163 PASS stepMismatchFor("12:34:55.001", "1", "12:34:56") is true
    164 PASS stepMismatchFor("12:34:56.001", "0.001", "12:34:56") is false
    165 PASS stepMismatchFor("12:34:55", "0.333", "12:34:56") is true
    166 PASS stepMismatchFor("12:34:55.001", "0.333", "12:34:56") is false
    167 PASS stepMismatchFor("12:34", "86400", "12:34") is false
    168 PASS stepMismatchFor("23:59:59.998", "86399.999", "00:00") is true
    169 PASS stepMismatchFor("23:59:59.999", "86399.999", "00:00") is false
    170 Implicit step base
    171 PASS stepMismatchFor("12:34", "120", null) is false
    172 PASS stepMismatchFor("12:35", "120", null) is true
    173 Small step values
    174 PASS stepMismatchFor("12:34:55.001", "0.0003", "12:34.55.000") is false
    175 PASS stepMismatchFor("12:34:55.001", "0.0019", "12:34.55.000") is true
    176 PASS stepMismatchFor("12:34:55.004", "0.0019", "12:34.55.000") is false
    177 Invalid or no step values
    178 PASS stepMismatchFor("12:34", null, "12:34") is false
    179 PASS stepMismatchFor("12:34:56", null, "12:34") is true
    180 PASS stepMismatchFor("12:34", "-1", "12:34") is false
    181 PASS stepMismatchFor("12:34", "foo", "12:34") is false
    182 Special step value
    183 PASS stepMismatchFor("12:35", "any", "12:34") is false
    184 Disabled
    185 PASS stepMismatchFor("12:34:55.001", "1", "12:34:56", true) is false
    186 
    187157Unsupported types
    188158PASS input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch is false
  • trunk/LayoutTests/fast/forms/input-stepup-stepdown-expected.txt

    r92728 r92746  
    1 Check stepUp() and stepDown() bahevior for type=date, datetime, datetime-local, time.
     1Check stepUp() and stepDown() bahevior for type=date, datetime, datetime-local.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    220220PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
    221221
    222 Time type
    223 Invalid value
    224 PASS stepUp("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    225 PASS stepDown("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    226 Non-number arguments
    227 PASS stepUp("20:13", null, null, "0") is "20:13"
    228 PASS stepDown("20:13", null, null, "0") is "20:13"
    229 PASS stepUp("20:13", null, null, "foo") is "20:13"
    230 PASS stepDown("20:13", null, null, "foo") is "20:13"
    231 PASS stepUp("20:13", null, null, null) is "20:13"
    232 PASS stepDown("20:13", null, null, null) is "20:13"
    233 Normal cases
    234 PASS stepUp("20:13", null, null) is "20:14"
    235 PASS stepDown("20:13", null, null) is "20:12"
    236 PASS stepUp("20:13", null, null, 10) is "20:23"
    237 PASS stepDown("20:13", null, null, 11) is "20:02"
    238 PASS stepUp("20:13", "4", null, 2) is "20:13:08"
    239 PASS stepDown("20:13", "4", null, 3) is "20:12:48"
    240 Step=any
    241 PASS stepUp("20:13", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    242 PASS stepDown("20:13", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    243 Overflow/underflow
    244 PASS stepUp("20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    245 PASS stepDown("20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    246 PASS stepUp("20:13", "1", "20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    247 PASS stepDown("20:13", "1", "20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    248 PASS stepUp("23:59", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    249 PASS stepDown("00:00", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    250 
    251222Unsupported type
    252223PASS input.step = "3"; input.min = ""; input.max = ""; input.value = "2"; input.stepDown() threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
  • trunk/LayoutTests/fast/forms/input-stepup-stepdown-from-renderer-expected.txt

    r92728 r92746  
    1 Check stepping-up and -down for  from renderer. No cases of empty initial values for type=date, datetime, datetime-local, time.
     1Check stepping-up and -down for  from renderer. No cases of empty initial values for type=date, datetime, datetime-local.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    206206PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
    207207
    208 Time type
    209 Function arguments are (value, step, {min or max}, [stepCount]).
    210 Normal cases
    211 PASS stepUp("20:13", null, null) is "20:14"
    212 PASS stepDown("20:13", null, null) is "20:12"
    213 PASS stepUp("20:13", null, null, 10) is "20:23"
    214 PASS stepDown("20:13", null, null, 11) is "20:02"
    215 PASS stepUp("20:13", "4", null, 2) is "20:13:08"
    216 PASS stepDown("20:13", "4", null, 3) is "20:12:48"
    217 Step=any
    218 PASS stepUp("20:13", "any", null) is "20:14"
    219 PASS stepDown("20:13", "any", null) is "20:12"
    220 Overflow/underflow
    221 PASS stepUp("20:13", "3.40282346e+38", null) is "23:59:59.999"
    222 PASS stepDown("20:13", "3.40282346e+38", null) is "00:00:00.000"
    223 PASS stepUp("20:13", "1", "20:13") is "20:13"
    224 PASS stepDown("20:13", "1", "20:13") is "20:13"
    225 PASS stepUp("23:59", null, null) is "23:59"
    226 PASS stepDown("00:00", null, null) is "00:00"
    227 stepDown()/stepUp() for stepMismatch values
    228 PASS stepDown("20:13", "3", "20:12:56") is "20:12:59"
    229 PASS stepUp("00:13", "7", "") is "00:13:04"
    230 
    231208PASS successfullyParsed is true
    232209
  • trunk/LayoutTests/fast/forms/input-type-change3-expected.txt

    r92728 r92746  
    3535PASS input.type for "tel" is correctly "tel".
    3636PASS input.type for "telephone" is correctly "text".
    37 PASS input.type for "time" is correctly "time".
    3837PASS input.type for "url" is correctly "url".
    3938PASS input.type for "uri" is correctly "text".
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js

    r92728 r92746  
    136136checkNotOverflow('101', '1E+2', true);
    137137
    138 // ----------------------------------------------------------------
    139 debug('');
    140 debug('Type=time');
    141 input.type = 'time';
    142 input.min = '';
    143 // No overflow cases
    144 checkNotOverflow('13:16', null);
    145 checkNotOverflow('13:16', '');
    146 checkNotOverflow('13:16', 'foo');
    147 checkNotOverflow('13:16', '13:16');
    148 checkNotOverflow('13:16', '13:17');
    149 checkNotOverflow('13:16', '14:15');
    150 checkNotOverflow('foo', '13:16');
    151 
    152 // Overflow cases
    153 checkOverflow('13:16', '13:15');
    154 checkOverflow('23:59:59.999', '13:16');
    155 input.min = '14:00';  // value < min && value > max
    156 checkOverflow('13:16', '12:00');
    157 
    158 // Disabled
    159 checkNotOverflow('23:59:59.999', '13:16', true);
    160 
    161138var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js

    r92728 r92746  
    144144checkNotUnderflow('99', '1E+2', true);
    145145
    146 // ----------------------------------------------------------------
    147 debug('');
    148 debug('Type=time');
    149 input.type = 'time';
    150 input.max = '';
    151 // No underflow cases
    152 checkNotUnderflow('13:16', null);
    153 checkNotUnderflow('13:16', '');
    154 checkNotUnderflow('13:16', 'foo');
    155 checkNotUnderflow('00:00:00.000', '');
    156 checkNotUnderflow('23:59:59.999', '');
    157 checkNotUnderflow('13:16', '11:00');
    158 checkNotUnderflow('13:16', '13:16');
    159 checkNotUnderflow('foo', '11:00');
    160 
    161 // Underflow cases
    162 checkUnderflow('13:16', '13:17');
    163 checkUnderflow('23:59', '23:59:30');
    164 input.max = '11:00';  // value < min && value > max
    165 checkUnderflow('13:16', '14:00');
    166 
    167 // Disabled
    168 checkNotUnderflow('23:59', '23:59:30', true);
    169 
    170146var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js

    r92728 r92746  
    1 description('Check stepMismatch results for type=date, datetime, datetime-local, time.');
     1description('Check stepMismatch results for type=date, datetime, datetime-local.');
    22
    33var input = document.createElement('input');
     
    177177
    178178debug('');
    179 debug('Time type');
    180 input.type = 'time';
    181 debug('Empty values');
    182 shouldBeFalse('stepMismatchFor("", null, null)');
    183 shouldBeFalse('stepMismatchFor("", "2", "12:34:56")');
    184 debug('Normal step values');
    185 shouldBeFalse('stepMismatchFor("12:34:55", "1", "12:34:56")');
    186 shouldBeTrue('stepMismatchFor("12:34:55.001", "1", "12:34:56")');
    187 shouldBeFalse('stepMismatchFor("12:34:56.001", "0.001", "12:34:56")');
    188 shouldBeTrue('stepMismatchFor("12:34:55", "0.333", "12:34:56")');
    189 shouldBeFalse('stepMismatchFor("12:34:55.001", "0.333", "12:34:56")');
    190 shouldBeFalse('stepMismatchFor("12:34", "86400", "12:34")');
    191 shouldBeTrue('stepMismatchFor("23:59:59.998", "86399.999", "00:00")');
    192 shouldBeFalse('stepMismatchFor("23:59:59.999", "86399.999", "00:00")');
    193 debug('Implicit step base');
    194 shouldBeFalse('stepMismatchFor("12:34", "120", null)');
    195 shouldBeTrue('stepMismatchFor("12:35", "120", null)');
    196 debug('Small step values');
    197 shouldBeFalse('stepMismatchFor("12:34:55.001", "0.0003", "12:34.55.000")');
    198 shouldBeTrue('stepMismatchFor("12:34:55.001", "0.0019", "12:34.55.000")');
    199 shouldBeFalse('stepMismatchFor("12:34:55.004", "0.0019", "12:34.55.000")');
    200 debug('Invalid or no step values');
    201 shouldBeFalse('stepMismatchFor("12:34", null, "12:34")');
    202 shouldBeTrue('stepMismatchFor("12:34:56", null, "12:34")');
    203 shouldBeFalse('stepMismatchFor("12:34", "-1", "12:34")');
    204 shouldBeFalse('stepMismatchFor("12:34", "foo", "12:34")');
    205 debug('Special step value');
    206 shouldBeFalse('stepMismatchFor("12:35", "any", "12:34")');
    207 debug('Disabled');
    208 shouldBeFalse('stepMismatchFor("12:34:55.001", "1", "12:34:56", true)');
    209 
    210 debug('');
    211179debug('Unsupported types');
    212180shouldBe('input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch', 'false');
  • trunk/LayoutTests/fast/forms/script-tests/input-stepup-stepdown-from-renderer.js

    r92728 r92746  
    1 description('Check stepping-up and -down for <input> from renderer. No cases of empty initial values for type=date, datetime, datetime-local, time.');
     1description('Check stepping-up and -down for <input> from renderer. No cases of empty initial values for type=date, datetime, datetime-local.');
    22
    33var input = document.createElement('input');
     
    290290
    291291debug('');
    292 debug('Time type');
    293 input.type = 'time';
    294 debug('Function arguments are (value, step, {min or max}, [stepCount]).');
    295 debug('Normal cases');
    296 shouldBe('stepUp("20:13", null, null)', '"20:14"');
    297 shouldBe('stepDown("20:13", null, null)', '"20:12"');
    298 shouldBe('stepUp("20:13", null, null, 10)', '"20:23"');
    299 shouldBe('stepDown("20:13", null, null, 11)', '"20:02"');
    300 shouldBe('stepUp("20:13", "4", null, 2)', '"20:13:08"');
    301 shouldBe('stepDown("20:13", "4", null, 3)', '"20:12:48"');
    302 debug('Step=any');
    303 shouldBe('stepUp("20:13", "any", null)', '"20:14"');
    304 shouldBe('stepDown("20:13", "any", null)', '"20:12"');
    305 debug('Overflow/underflow');
    306 shouldBe('stepUp("20:13", "3.40282346e+38", null)', '"23:59:59.999"');
    307 shouldBe('stepDown("20:13", "3.40282346e+38", null)', '"00:00:00.000"');
    308 shouldBe('stepUp("20:13", "1", "20:13")', '"20:13"');
    309 shouldBe('stepDown("20:13", "1", "20:13")', '"20:13"');
    310 shouldBe('stepUp("23:59", null, null)', '"23:59"');
    311 shouldBe('stepDown("00:00", null, null)', '"00:00"');
    312 debug('stepDown()/stepUp() for stepMismatch values');
    313 shouldBe('stepDown("20:13", "3", "20:12:56")', '"20:12:59"');
    314 shouldBe('stepUp("00:13", "7", "")', '"00:13:04"');
    315 
    316 debug('');
    317292var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js

    r92728 r92746  
    1 description('Check stepUp() and stepDown() bahevior for type=date, datetime, datetime-local, time.');
     1description('Check stepUp() and stepDown() bahevior for type=date, datetime, datetime-local.');
    22
    33var input = document.createElement('input');
     
    276276
    277277debug('');
    278 debug('Time type');
    279 input.type = 'time';
    280 debug('Invalid value');
    281 shouldThrow('stepUp("", null, null)', invalidStateErr);
    282 shouldThrow('stepDown("", null, null)', invalidStateErr);
    283 debug('Non-number arguments');
    284 shouldBe('stepUp("20:13", null, null, "0")', '"20:13"');
    285 shouldBe('stepDown("20:13", null, null, "0")', '"20:13"');
    286 shouldBe('stepUp("20:13", null, null, "foo")', '"20:13"');
    287 shouldBe('stepDown("20:13", null, null, "foo")', '"20:13"');
    288 shouldBe('stepUp("20:13", null, null, null)', '"20:13"');
    289 shouldBe('stepDown("20:13", null, null, null)', '"20:13"');
    290 debug('Normal cases');
    291 shouldBe('stepUp("20:13", null, null)', '"20:14"');
    292 shouldBe('stepDown("20:13", null, null)', '"20:12"');
    293 shouldBe('stepUp("20:13", null, null, 10)', '"20:23"');
    294 shouldBe('stepDown("20:13", null, null, 11)', '"20:02"');
    295 shouldBe('stepUp("20:13", "4", null, 2)', '"20:13:08"');
    296 shouldBe('stepDown("20:13", "4", null, 3)', '"20:12:48"');
    297 debug('Step=any');
    298 shouldThrow('stepUp("20:13", "any", null)', invalidStateErr);
    299 shouldThrow('stepDown("20:13", "any", null)', invalidStateErr);
    300 debug('Overflow/underflow');
    301 shouldThrow('stepUp("20:13", "3.40282346e+38", null)', invalidStateErr);
    302 shouldThrow('stepDown("20:13", "3.40282346e+38", null)', invalidStateErr);
    303 shouldThrow('stepUp("20:13", "1", "20:13")', invalidStateErr);
    304 shouldThrow('stepDown("20:13", "1", "20:13")', invalidStateErr);
    305 shouldThrow('stepUp("23:59", null, null)', invalidStateErr);
    306 shouldThrow('stepDown("00:00", null, null)', invalidStateErr);
    307 
    308 debug('');
    309278debug('Unsupported type');
     279input.type = 'text';
    310280shouldThrow('input.step = "3"; input.min = ""; input.max = ""; input.value = "2"; input.stepDown()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
    311281shouldThrow('input.stepDown(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
  • trunk/LayoutTests/fast/forms/script-tests/input-type-change3.js

    r92728 r92746  
    4949check("tel", "tel");
    5050check("telephone", "text");
    51 check("time", "time");
    5251check("url", "url");
    5352check("uri", "text");
  • trunk/LayoutTests/fast/forms/time/ValidityState-rangeOverflow-time-expected.txt

    r92745 r92746  
    1 This test aims to check for rangeOverflow flag with input fields
     1This test aims to check for rangeOverflow flag with time input fields
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 Type=text
    7 PASS The value "101" doesn't overflow the maximum value "100".
    8 
    9 Type=date
    10 PASS The value "2010-01-27" doesn't overflow the maximum value "".
    11 PASS The value "2010-01-27" doesn't overflow the maximum value "".
    12 PASS The value "2010-01-27" doesn't overflow the maximum value "foo".
    13 PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-27".
    14 PASS The value "2010-01-27" doesn't overflow the maximum value "2010-01-28".
    15 PASS The value "2010-01-27" doesn't overflow the maximum value "2011-01-26".
    16 PASS The value "foo" doesn't overflow the maximum value "2011-01-26".
    17 PASS The value "2010-01-27" doesn't overflow the maximum value "0000-01-01".
    18 PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
    19 PASS The value "9999-01-01" overflows the maximum value "2010-12-31".
    20 PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
    21 PASS The value "9999-01-01" doesn't overflow the maximum value "2010-12-31" when disabled.
    22 
    23 Type=datetime
    24 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "".
    25 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "".
    26 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "foo".
    27 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2010-01-27T12:34Z".
    28 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2010-01-27T12:34:56Z".
    29 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "2011-01-26T12:34Z".
    30 PASS The value "foo" doesn't overflow the maximum value "2011-01-26T12:34Z".
    31 PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "0000-01-01T00:00Z".
    32 PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:33:59.999Z".
    33 PASS The value "9999-01-01T23:59Z" overflows the maximum value "2010-12-31T00:00Z".
    34 PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:34Z".
    35 PASS The value "9999-01-01T23:59Z" doesn't overflow the maximum value "2010-12-31T00:00Z" when disabled.
    36 
    37 Type=datetime-local
    38 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "".
    39 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "".
    40 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "foo".
    41 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2010-01-27T12:34".
    42 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2010-01-27T12:34:56".
    43 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "2011-01-26T12:34".
    44 PASS The value "foo" doesn't overflow the maximum value "2011-01-26T12:34".
    45 PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "0000-01-01T00:00".
    46 PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:33:59.999".
    47 PASS The value "9999-01-01T23:59" overflows the maximum value "2010-12-31T00:00".
    48 PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:34".
    49 PASS The value "9999-01-01T23:59" doesn't overflow the maximum value "2010-12-31T00:00" when disabled.
    50 
    51 Type=number
    52 PASS The value "99" doesn't overflow the maximum value "100".
    53 PASS The value "-101" doesn't overflow the maximum value "-100".
    54 PASS The value "99" doesn't overflow the maximum value "1E+2".
    55 PASS The value "0.99" doesn't overflow the maximum value "1.00".
    56 PASS The value "" doesn't overflow the maximum value "100".
    57 PASS The value "" doesn't overflow the maximum value "-1".
    58 PASS The value "101" doesn't overflow the maximum value "".
    59 PASS The value "101" doesn't overflow the maximum value "xxx".
    60 PASS The value "0.999999999999999999999999999999999999999999" doesn't overflow the maximum value "0.999999999999999999999999999999999999999998".
    61 PASS The value "101" overflows the maximum value "100".
    62 PASS The value "-99" overflows the maximum value "-100".
    63 PASS The value "101" overflows the maximum value "1E+2".
    64 PASS The value "101" overflows the maximum value "100".
    65 PASS The value "101" doesn't overflow the maximum value "1E+2" when disabled.
    66 
    67 Type=time
    686PASS The value "13:16" doesn't overflow the maximum value "".
    697PASS The value "13:16" doesn't overflow the maximum value "".
  • trunk/LayoutTests/fast/forms/time/ValidityState-rangeOverflow-time.html

    r92745 r92746  
    1 description('This test aims to check for rangeOverflow flag with input fields');
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
     11description('This test aims to check for rangeOverflow flag with time input fields');
    212
    313var input = document.createElement('input');
     
    3343}
    3444
    35 // ----------------------------------------------------------------
    36 debug('Type=text');
    37 input.type = 'text';  // No overflow for type=text.
    38 checkNotOverflow('101', '100');
    39 
    40 // ----------------------------------------------------------------
    41 debug('');
    42 debug('Type=date');
    43 input.type = 'date';
    44 input.min = '';
    45 // No overflow cases
    46 checkNotOverflow('2010-01-27', null);
    47 checkNotOverflow('2010-01-27', '');
    48 checkNotOverflow('2010-01-27', 'foo');
    49 checkNotOverflow('2010-01-27', '2010-01-27');
    50 checkNotOverflow('2010-01-27', '2010-01-28');
    51 checkNotOverflow('2010-01-27', '2011-01-26');
    52 checkNotOverflow('foo', '2011-01-26');
    53 checkNotOverflow('2010-01-27', '0000-01-01'); // Too small max value.
    54 
    55 // Overflow cases
    56 checkOverflow('2010-01-27', '2010-01-26');
    57 checkOverflow('9999-01-01', '2010-12-31');
    58 input.min = '2010-01-28';  // value < min && value > max
    59 checkOverflow('2010-01-27', '2010-01-26');
    60 
    61 // Disabled
    62 checkNotOverflow('9999-01-01', '2010-12-31', true);
    63 
    64 // ----------------------------------------------------------------
    65 debug('');
    66 debug('Type=datetime');
    67 input.type = 'datetime';
    68 input.min = '';
    69 // No overflow cases
    70 checkNotOverflow('2010-01-27T12:34Z', null);
    71 checkNotOverflow('2010-01-27T12:34Z', '');
    72 checkNotOverflow('2010-01-27T12:34Z', 'foo');
    73 checkNotOverflow('2010-01-27T12:34Z', '2010-01-27T12:34Z');
    74 checkNotOverflow('2010-01-27T12:34Z', '2010-01-27T12:34:56Z');
    75 checkNotOverflow('2010-01-27T12:34Z', '2011-01-26T12:34Z');
    76 checkNotOverflow('foo', '2011-01-26T12:34Z');
    77 checkNotOverflow('2010-01-27T12:34Z', '0000-01-01T00:00Z'); // Too small max value.
    78 
    79 // Overflow cases
    80 checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:33:59.999Z');
    81 checkOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z');
    82 input.min = '2010-01-28T12:00Z';  // value < min && value > max
    83 checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:34Z');
    84 
    85 // Disabled
    86 checkNotOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z', true);
    87 
    88 // ----------------------------------------------------------------
    89 debug('');
    90 debug('Type=datetime-local');
    91 input.type = 'datetime-local';
    92 input.min = '';
    93 // No overflow cases
    94 checkNotOverflow('2010-01-27T12:34', null);
    95 checkNotOverflow('2010-01-27T12:34', '');
    96 checkNotOverflow('2010-01-27T12:34', 'foo');
    97 checkNotOverflow('2010-01-27T12:34', '2010-01-27T12:34');
    98 checkNotOverflow('2010-01-27T12:34', '2010-01-27T12:34:56');
    99 checkNotOverflow('2010-01-27T12:34', '2011-01-26T12:34');
    100 checkNotOverflow('foo', '2011-01-26T12:34');
    101 checkNotOverflow('2010-01-27T12:34', '0000-01-01T00:00'); // Too small max value.
    102 
    103 // Overflow cases
    104 checkOverflow('2010-01-27T12:34', '2010-01-26T12:33:59.999');
    105 checkOverflow('9999-01-01T23:59', '2010-12-31T00:00');
    106 input.min = '2010-01-28T12:00';  // value < min && value > max
    107 checkOverflow('2010-01-27T12:34', '2010-01-26T12:34');
    108 
    109 // Disabled
    110 checkNotOverflow('9999-01-01T23:59', '2010-12-31T00:00', true);
    111 
    112 // ----------------------------------------------------------------
    113 debug('');
    114 debug('Type=number');
    115 input.type = 'number';
    116 input.min = '';
    117 checkNotOverflow('99', '100');  // Very normal case.
    118 checkNotOverflow('-101', '-100');
    119 checkNotOverflow('99', '1E+2');
    120 checkNotOverflow('0.99', '1.00');
    121 checkNotOverflow('abc', '100');  // Invalid value.
    122 checkNotOverflow('', '-1');  // No value.
    123 checkNotOverflow('101', '');  // No max.
    124 checkNotOverflow('101', 'xxx');  // Invalid max.
    125 // The following case should be rangeOverflow==true ideally.  But the "double" type doesn't have enough precision.
    126 checkNotOverflow('0.999999999999999999999999999999999999999999', '0.999999999999999999999999999999999999999998');
    127 
    128 // Overflow cases
    129 checkOverflow('101', '100');
    130 checkOverflow('-99', '-100');
    131 checkOverflow('101', '1E+2');
    132 input.min = '200';  // value < min && value > max
    133 checkOverflow('101', '100');
    134 
    135 // Disabled
    136 checkNotOverflow('101', '1E+2', true);
    137 
    138 // ----------------------------------------------------------------
    139 debug('');
    140 debug('Type=time');
    14145input.type = 'time';
    14246input.min = '';
     
    16064
    16165var successfullyParsed = true;
     66</script>
     67<script src="../../js/resources/js-test-post.js"></script>
     68</body>
     69</html>
  • trunk/LayoutTests/fast/forms/time/ValidityState-rangeUnderflow-time-expected.txt

    r92745 r92746  
    1 This test aims to check for rangeUnderflow flag with input fields
     1This test aims to check for rangeUnderflow flag with time input fields
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 Type=text
    7 PASS The value "99" doesn't underflow the minimum value "100".
    8 
    9 Type=date
    10 PASS The value "2010-01-27" doesn't underflow the minimum value "".
    11 PASS The value "2010-01-27" doesn't underflow the minimum value "".
    12 PASS The value "2010-01-27" doesn't underflow the minimum value "foo".
    13 PASS The value "1000-01-01" doesn't underflow the minimum value "".
    14 PASS The value "1582-10-15" doesn't underflow the minimum value "".
    15 PASS The value "2010-01-27" doesn't underflow the minimum value "2010-01-26".
    16 PASS The value "2010-01-27" doesn't underflow the minimum value "2009-01-28".
    17 PASS The value "foo" doesn't underflow the minimum value "2011-01-26".
    18 PASS The value "2010-01-27" undeflows the minimum value "2010-01-28".
    19 PASS The value "9999-01-01" undeflows the minimum value "10000-12-31".
    20 PASS The value "2010-01-27" undeflows the minimum value "2010-02-01".
    21 PASS The value "9999-01-01" doesn't underflow the minimum value "10000-12-31" when disabled.
    22 
    23 Type=datetime
    24 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "".
    25 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "".
    26 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "foo".
    27 PASS The value "1000-01-01T12:34Z" doesn't underflow the minimum value "".
    28 PASS The value "1582-10-15T00:00Z" doesn't underflow the minimum value "".
    29 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "2010-01-26T00:00Z".
    30 PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "2009-01-28T00:00Z".
    31 PASS The value "foo" doesn't underflow the minimum value "2011-01-26T00:00Z".
    32 PASS The value "2010-01-27T12:34Z" undeflows the minimum value "2010-01-27T13:00Z".
    33 PASS The value "9999-01-01T12:00Z" undeflows the minimum value "10000-12-31T12:00Z".
    34 PASS The value "2010-01-27T12:00Z" undeflows the minimum value "2010-02-01T12:00Z".
    35 PASS The value "9999-01-01T12:00Z" doesn't underflow the minimum value "10000-12-31T12:00Z" when disabled.
    36 
    37 Type=datetime-local
    38 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "".
    39 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "".
    40 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "foo".
    41 PASS The value "1000-01-01T12:34" doesn't underflow the minimum value "".
    42 PASS The value "1582-10-15T00:00" doesn't underflow the minimum value "".
    43 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "2010-01-26T00:00".
    44 PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "2009-01-28T00:00".
    45 PASS The value "foo" doesn't underflow the minimum value "2011-01-26T00:00".
    46 PASS The value "2010-01-27T12:34" undeflows the minimum value "2010-01-27T13:00".
    47 PASS The value "9999-01-01T12:00" undeflows the minimum value "10000-12-31T12:00".
    48 PASS The value "2010-01-27T12:00" undeflows the minimum value "2010-02-01T12:00".
    49 PASS The value "9999-01-01T12:00" doesn't underflow the minimum value "10000-12-31T12:00" when disabled.
    50 
    51 Type=number
    52 PASS The value "101" doesn't underflow the minimum value "100".
    53 PASS The value "-99" doesn't underflow the minimum value "-100".
    54 PASS The value "101" doesn't underflow the minimum value "1E+2".
    55 PASS The value "1.01" doesn't underflow the minimum value "1.00".
    56 PASS The value "" doesn't underflow the minimum value "100".
    57 PASS The value "" doesn't underflow the minimum value "1".
    58 PASS The value "-1" doesn't underflow the minimum value "".
    59 PASS The value "-1" doesn't underflow the minimum value "xxx".
    60 PASS The value "0.999999999999999999999999999999999999999998" doesn't underflow the minimum value "0.999999999999999999999999999999999999999999".
    61 PASS The value "99" undeflows the minimum value "100".
    62 PASS The value "-101" undeflows the minimum value "-100".
    63 PASS The value "99" undeflows the minimum value "1E+2".
    64 PASS The value "101" undeflows the minimum value "200".
    65 PASS The value "99" doesn't underflow the minimum value "1E+2" when disabled.
    66 
    67 Type=time
    686PASS The value "13:16" doesn't underflow the minimum value "".
    697PASS The value "13:16" doesn't underflow the minimum value "".
  • trunk/LayoutTests/fast/forms/time/ValidityState-rangeUnderflow-time.html

    r92745 r92746  
    1 description('This test aims to check for rangeUnderflow flag with input fields');
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
     11description('This test aims to check for rangeUnderflow flag with time input fields');
    212
    313var input = document.createElement('input');
     
    3343}
    3444
    35 // ----------------------------------------------------------------
    36 debug('Type=text');
    37 input.type = 'text';  // No underflow for type=text.
    38 checkNotUnderflow('99', '100');
    39 
    40 // ----------------------------------------------------------------
    41 debug('');
    42 debug('Type=date');
    43 input.type = 'date';
    44 input.max = '';
    45 // No underflow cases
    46 checkNotUnderflow('2010-01-27', null);
    47 checkNotUnderflow('2010-01-27', '');
    48 checkNotUnderflow('2010-01-27', 'foo');
    49 // 1000-01-01 is smaller than the implicit minimum value.
    50 // But the date parser rejects it before comparing the minimum value.
    51 checkNotUnderflow('1000-01-01', '');
    52 checkNotUnderflow('1582-10-15', '');
    53 checkNotUnderflow('2010-01-27', '2010-01-26');
    54 checkNotUnderflow('2010-01-27', '2009-01-28');
    55 checkNotUnderflow('foo', '2011-01-26');
    56 
    57 // Underflow cases
    58 checkUnderflow('2010-01-27', '2010-01-28');
    59 checkUnderflow('9999-01-01', '10000-12-31');
    60 input.max = '2010-01-01';  // value < min && value > max
    61 checkUnderflow('2010-01-27', '2010-02-01');
    62 
    63 // Disabled
    64 checkNotUnderflow('9999-01-01', '10000-12-31', true);
    65 
    66 // ----------------------------------------------------------------
    67 debug('');
    68 debug('Type=datetime');
    69 input.type = 'datetime';
    70 input.max = '';
    71 // No underflow cases
    72 checkNotUnderflow('2010-01-27T12:34Z', null);
    73 checkNotUnderflow('2010-01-27T12:34Z', '');
    74 checkNotUnderflow('2010-01-27T12:34Z', 'foo');
    75 // 1000-01-01 is smaller than the implicit minimum value.
    76 // But the date parser rejects it before comparing the minimum value.
    77 checkNotUnderflow('1000-01-01T12:34Z', '');
    78 checkNotUnderflow('1582-10-15T00:00Z', '');
    79 checkNotUnderflow('2010-01-27T12:34Z', '2010-01-26T00:00Z');
    80 checkNotUnderflow('2010-01-27T12:34Z', '2009-01-28T00:00Z');
    81 checkNotUnderflow('foo', '2011-01-26T00:00Z');
    82 
    83 // Underflow cases
    84 checkUnderflow('2010-01-27T12:34Z', '2010-01-27T13:00Z');
    85 checkUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z');
    86 input.max = '2010-01-01T12:00Z';  // value < min && value > max
    87 checkUnderflow('2010-01-27T12:00Z', '2010-02-01T12:00Z');
    88 
    89 // Disabled
    90 checkNotUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z', true);
    91 
    92 // ----------------------------------------------------------------
    93 debug('');
    94 debug('Type=datetime-local');
    95 input.type = 'datetime-local';
    96 input.max = '';
    97 // No underflow cases
    98 checkNotUnderflow('2010-01-27T12:34', null);
    99 checkNotUnderflow('2010-01-27T12:34', '');
    100 checkNotUnderflow('2010-01-27T12:34', 'foo');
    101 // 1000-01-01 is smaller than the implicit minimum value.
    102 // But the date parser rejects it before comparing the minimum value.
    103 checkNotUnderflow('1000-01-01T12:34', '');
    104 checkNotUnderflow('1582-10-15T00:00', '');
    105 checkNotUnderflow('2010-01-27T12:34', '2010-01-26T00:00');
    106 checkNotUnderflow('2010-01-27T12:34', '2009-01-28T00:00');
    107 checkNotUnderflow('foo', '2011-01-26T00:00');
    108 
    109 // Underflow cases
    110 checkUnderflow('2010-01-27T12:34', '2010-01-27T13:00');
    111 checkUnderflow('9999-01-01T12:00', '10000-12-31T12:00');
    112 input.max = '2010-01-01T12:00';  // value < min && value > max
    113 checkUnderflow('2010-01-27T12:00', '2010-02-01T12:00');
    114 
    115 // Disabled
    116 checkNotUnderflow('9999-01-01T12:00', '10000-12-31T12:00', true);
    117 
    118 // ----------------------------------------------------------------
    119 debug('');
    120 debug('Type=number');
    121 input.type = 'number';
    122 input.max = '';
    123 // No underflow cases
    124 input.type = 'number';
    125 checkNotUnderflow('101', '100');  // Very normal case.
    126 checkNotUnderflow('-99', '-100');
    127 checkNotUnderflow('101', '1E+2');
    128 checkNotUnderflow('1.01', '1.00');
    129 checkNotUnderflow('abc', '100');  // Invalid value.
    130 checkNotUnderflow('', '1');  // No value.
    131 checkNotUnderflow('-1', '');  // No min.
    132 checkNotUnderflow('-1', 'xxx');  // Invalid min.
    133 // The following case should be rangeUnderflow==true ideally.  But the "double" type doesn't have enough precision.
    134 checkNotUnderflow('0.999999999999999999999999999999999999999998', '0.999999999999999999999999999999999999999999');
    135 
    136 // Underflow cases
    137 checkUnderflow('99', '100');
    138 checkUnderflow('-101', '-100');
    139 checkUnderflow('99', '1E+2');
    140 input.max = '100';  // value < min && value > max
    141 checkUnderflow('101', '200');
    142 
    143 // Disabled
    144 checkNotUnderflow('99', '1E+2', true);
    145 
    146 // ----------------------------------------------------------------
    147 debug('');
    148 debug('Type=time');
    14945input.type = 'time';
    15046input.max = '';
     
    16965
    17066var successfullyParsed = true;
     67</script>
     68<script src="../../js/resources/js-test-post.js"></script>
     69</body>
     70</html>
  • trunk/LayoutTests/fast/forms/time/ValidityState-stepMismatch-time-expected.txt

    r92745 r92746  
    1 Check stepMismatch results for type=date, datetime, datetime-local, time.
     1Check stepMismatch results for type=time.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 Date type
    7 Empty values
    8 PASS stepMismatchFor("", null, null) is false
    9 PASS stepMismatchFor("", "2", "1969-12-31") is false
    10 Normal step values
    11 PASS stepMismatchFor("2010-02-10", "2", "2010-02-09") is true
    12 PASS stepMismatchFor("2010-02-09", "2", "2010-02-09") is false
    13 PASS stepMismatchFor("2010-02-11", "2", "2010-02-09") is false
    14 PASS stepMismatchFor("1800-11-11", "3", "1800-11-09") is true
    15 PASS stepMismatchFor("1800-11-09", "3", "1800-11-09") is false
    16 PASS stepMismatchFor("1800-11-12", "3", "1800-11-09") is false
    17 PASS stepMismatchFor("275760-09-13", "3", "275760-09-11") is true
    18 PASS stepMismatchFor("275760-09-13", "2", "275760-09-11") is false
    19 Implicit step base
    20 PASS stepMismatchFor("1970-01-02", "2", null) is true
    21 PASS stepMismatchFor("1970-01-03", "2", null) is false
    22 Fractional step values
    23 PASS stepMismatchFor("2010-02-10", "0.1", "2010-02-09") is false
    24 PASS stepMismatchFor("2010-02-10", "1.1", "2010-02-09") is false
    25 PASS stepMismatchFor("2010-02-10", "1.9", "2010-02-09") is true
    26 Invalid or no step values
    27 PASS stepMismatchFor("2010-02-10", null, "2010-02-09") is false
    28 PASS stepMismatchFor("2010-02-10", "-1", "2010-02-09") is false
    29 PASS stepMismatchFor("2010-02-10", "foo", "2010-02-09") is false
    30 Special step value
    31 PASS stepMismatchFor("2010-02-10", "any", "2010-02-09") is false
    32 Disabled
    33 PASS stepMismatchFor("2010-02-10", "2", "2010-02-09", true) is false
    34 
    35 Datetime type
    36 Empty values
    37 PASS stepMismatchFor("", null, null) is false
    38 PASS stepMismatchFor("", "2", "1969-12-31T12:34:56Z") is false
    39 Normal step values
    40 PASS stepMismatchFor("2010-02-09T12:34:55Z", "1", "2010-02-09T12:34:56Z") is false
    41 PASS stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z") is true
    42 PASS stepMismatchFor("2010-02-09T12:34:56.001Z", "0.001", "2010-02-09T12:34:56Z") is false
    43 PASS stepMismatchFor("2010-02-09T12:34:55Z", "0.333", "2010-02-09T12:34:56Z") is true
    44 PASS stepMismatchFor("2010-02-09T12:34:55.001Z", "0.333", "2010-02-09T12:34:56Z") is false
    45 PASS stepMismatchFor("2010-02-09T12:34Z", "86400", "2010-02-08T12:34Z") is false
    46 PASS stepMismatchFor("2010-02-09T12:34:56Z", "86400", "2010-02-08T12:34Z") is true
    47 PASS stepMismatchFor("275760-09-13T00:00Z", "3", "275760-09-12T23:59:50Z") is true
    48 PASS stepMismatchFor("275760-09-13T00:00Z", "2", "275760-09-12T23:59:50Z") is false
    49 PASS stepMismatchFor("0001-01-01T00:00Z", "3", "0001-01-11T00:00:02Z") is true
    50 PASS stepMismatchFor("0001-01-01T00:00Z", "2", "0001-01-11T00:00:02Z") is false
    51 Implicit step base
    52 PASS stepMismatchFor("1970-01-01T12:34Z", "120", null) is false
    53 PASS stepMismatchFor("1970-01-01T12:35Z", "120", null) is true
    54 Small step values
    55 PASS stepMismatchFor("2010-02-10T12:34:56.000Z", "0.0003", "2010-02-10T12:34.55.000Z") is false
    56 PASS stepMismatchFor("2010-02-10T12:34:55.001Z", "0.0019", "2010-02-10T12:34.55.000Z") is true
    57 Invalid or no step values
    58 PASS stepMismatchFor("2010-02-10T12:34Z", null, "2010-02-09T12:34Z") is false
    59 PASS stepMismatchFor("2010-02-10T12:34:56Z", null, "2010-02-09T12:34Z") is true
    60 PASS stepMismatchFor("2010-02-10T12:34Z", "-1", "2010-02-09T12:34Z") is false
    61 PASS stepMismatchFor("2010-02-10T12:34Z", "foo", "2010-02-09T12:34Z") is false
    62 Special step value
    63 PASS stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z") is false
    64 Disabled
    65 PASS stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true) is false
    66 
    67 Datetime-local type
    68 Empty values
    69 PASS stepMismatchFor("", null, null) is false
    70 PASS stepMismatchFor("", "2", "1969-12-31T12:34:56") is false
    71 Normal step values
    72 PASS stepMismatchFor("2010-02-09T12:34:55", "1", "2010-02-09T12:34:56") is false
    73 PASS stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56") is true
    74 PASS stepMismatchFor("2010-02-09T12:34:56.001", "0.001", "2010-02-09T12:34:56") is false
    75 PASS stepMismatchFor("2010-02-09T12:34:55", "0.333", "2010-02-09T12:34:56") is true
    76 PASS stepMismatchFor("2010-02-09T12:34:55.001", "0.333", "2010-02-09T12:34:56") is false
    77 PASS stepMismatchFor("2010-02-09T12:34", "86400", "2010-02-08T12:34") is false
    78 PASS stepMismatchFor("2010-02-09T12:34:56", "86400", "2010-02-08T12:34") is true
    79 PASS stepMismatchFor("275760-09-13T00:00", "3", "275760-09-12T23:59:50") is true
    80 PASS stepMismatchFor("275760-09-13T00:00", "2", "275760-09-12T23:59:50") is false
    81 PASS stepMismatchFor("0001-01-01T00:00", "3", "0001-01-11T00:00:02") is true
    82 PASS stepMismatchFor("0001-01-01T00:00", "2", "0001-01-11T00:00:02") is false
    83 Implicit step base
    84 PASS stepMismatchFor("1970-01-01T12:34", "120", null) is false
    85 PASS stepMismatchFor("1970-01-01T12:35", "120", null) is true
    86 Small step values
    87 PASS stepMismatchFor("2010-02-10T12:34:56.000", "0.0003", "2010-02-10T12:34.55.000") is false
    88 PASS stepMismatchFor("2010-02-10T12:34:55.001", "0.0019", "2010-02-10T12:34.55.000") is true
    89 Invalid or no step values
    90 PASS stepMismatchFor("2010-02-10T12:34", null, "2010-02-09T12:34") is false
    91 PASS stepMismatchFor("2010-02-10T12:34:56", null, "2010-02-09T12:34") is true
    92 PASS stepMismatchFor("2010-02-10T12:34", "-1", "2010-02-09T12:34") is false
    93 PASS stepMismatchFor("2010-02-10T12:34", "foo", "2010-02-09T12:34") is false
    94 Special step value
    95 PASS stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34") is false
    96 Disabled
    97 PASS stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true) is false
    98 
    99 Number type
    100 Empty values
    101 PASS stepMismatchFor("", null, null) is false
    102 PASS stepMismatchFor("", "1.0", "0.1") is false
    103 Integers
    104 PASS stepMismatchFor("1", "2", "0") is true
    105 PASS stepMismatchFor("-3", "2", "-4") is true
    106 PASS input.max = "5"; stepMismatchFor("5", "3", "0") is true
    107 PASS input.value is "5"
    108 Invalid step values
    109 PASS stepMismatchFor("-3", "-2", "-4") is false
    110 PASS stepMismatchFor("-3", null, "-4") is false
    111 PASS stepMismatchFor("-3", undefined, "-4") is false
    112 Huge numbers and small step; uncomparable
    113 PASS stepMismatchFor("3.40282347e+38", "3", "") is false
    114 PASS stepMismatchFor("3.40282346e+38", "3", "") is false
    115 PASS stepMismatchFor("3.40282345e+38", "3", "") is false
    116 Huge numbers and huge step
    117 PASS stepMismatchFor("3.20e+38", "0.20e+38", "") is false
    118 PASS stepMismatchFor("3.20e+38", "0.22e+38", "") is true
    119 Fractional numbers
    120 PASS stepMismatchFor("0.9", "0.1", "") is false
    121 PASS stepMismatchFor("0.9", "0.1000001", "") is true
    122 PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false
    123 PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false
    124 Rounding
    125 PASS stepMismatchFor("5.005", "0.005", "4") is false
    126 Disabled
    127 PASS stepMismatchFor("1", "2", "0", true) is false
    128 
    129 Range type
    130 Empty values
    131 PASS stepMismatchFor("", null, null) is false
    132 PASS stepMismatchFor("", "1.0", "0.1") is false
    133 Integers
    134 PASS stepMismatchFor("1", "2", "0") is false
    135 PASS stepMismatchFor("-3", "2", "-4") is false
    136 PASS input.max = "5"; stepMismatchFor("5", "3", "0") is false
    137 PASS input.value is "3"
    138 Invalid step values
    139 PASS stepMismatchFor("-3", "-2", "-4") is false
    140 PASS stepMismatchFor("-3", null, "-4") is false
    141 PASS stepMismatchFor("-3", undefined, "-4") is false
    142 Huge numbers and small step; uncomparable
    143 PASS stepMismatchFor("3.40282347e+38", "3", "") is false
    144 PASS stepMismatchFor("3.40282346e+38", "3", "") is false
    145 PASS stepMismatchFor("3.40282345e+38", "3", "") is false
    146 Huge numbers and huge step
    147 PASS stepMismatchFor("3.20e+38", "0.20e+38", "") is false
    148 PASS stepMismatchFor("3.20e+38", "0.22e+38", "") is false
    149 Fractional numbers
    150 PASS stepMismatchFor("0.9", "0.1", "") is false
    151 PASS stepMismatchFor("0.9", "0.1000001", "") is false
    152 PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false
    153 PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false
    154 Disabled
    155 PASS stepMismatchFor("1", "2", "0", true) is false
    156 
    157 Time type
    1586Empty values
    1597PASS stepMismatchFor("", null, null) is false
     
    18533PASS stepMismatchFor("12:34:55.001", "1", "12:34:56", true) is false
    18634
    187 Unsupported types
    188 PASS input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch is false
    189 PASS input.type = "button"; input.validity.stepMismatch is false
    190 PASS input.type = "checkbox"; input.validity.stepMismatch is false
    191 PASS input.type = "color"; input.validity.stepMismatch is false
    192 PASS input.type = "email"; input.validity.stepMismatch is false
    193 PASS input.type = "hidden"; input.validity.stepMismatch is false
    194 PASS input.type = "image"; input.validity.stepMismatch is false
    195 PASS input.type = "khtml_isindex"; input.validity.stepMismatch is false
    196 PASS input.type = "passwd"; input.validity.stepMismatch is false
    197 PASS input.type = "radio"; input.validity.stepMismatch is false
    198 PASS input.type = "reset"; input.validity.stepMismatch is false
    199 PASS input.type = "search"; input.validity.stepMismatch is false
    200 PASS input.type = "submit"; input.validity.stepMismatch is false
    201 PASS input.type = "tel"; input.validity.stepMismatch is false
    202 PASS input.type = "url"; input.validity.stepMismatch is false
    203 PASS input.type = "file"; input.validity.stepMismatch is false
    20435PASS successfullyParsed is true
    20536
  • trunk/LayoutTests/fast/forms/time/ValidityState-stepMismatch-time.html

    r92745 r92746  
    1 description('Check stepMismatch results for type=date, datetime, datetime-local, time.');
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
     11description('Check stepMismatch results for type=time.');
    212
    313var input = document.createElement('input');
     
    1222}
    1323
    14 debug('Date type');
    15 input.type = 'date';
    16 debug('Empty values');
    17 shouldBeFalse('stepMismatchFor("", null, null)');
    18 shouldBeFalse('stepMismatchFor("", "2", "1969-12-31")');
    19 debug('Normal step values');
    20 shouldBeTrue('stepMismatchFor("2010-02-10", "2", "2010-02-09")');
    21 shouldBeFalse('stepMismatchFor("2010-02-09", "2", "2010-02-09")');
    22 shouldBeFalse('stepMismatchFor("2010-02-11", "2", "2010-02-09")');
    23 shouldBeTrue('stepMismatchFor("1800-11-11", "3", "1800-11-09")');
    24 shouldBeFalse('stepMismatchFor("1800-11-09", "3", "1800-11-09")');
    25 shouldBeFalse('stepMismatchFor("1800-11-12", "3", "1800-11-09")');
    26 shouldBeTrue('stepMismatchFor("275760-09-13", "3", "275760-09-11")');
    27 shouldBeFalse('stepMismatchFor("275760-09-13", "2", "275760-09-11")');
    28 debug('Implicit step base');
    29 shouldBeTrue('stepMismatchFor("1970-01-02", "2", null)');
    30 shouldBeFalse('stepMismatchFor("1970-01-03", "2", null)');
    31 debug('Fractional step values');
    32 shouldBeFalse('stepMismatchFor("2010-02-10", "0.1", "2010-02-09")');
    33 shouldBeFalse('stepMismatchFor("2010-02-10", "1.1", "2010-02-09")');
    34 shouldBeTrue('stepMismatchFor("2010-02-10", "1.9", "2010-02-09")');
    35 debug('Invalid or no step values');
    36 shouldBeFalse('stepMismatchFor("2010-02-10", null, "2010-02-09")');
    37 shouldBeFalse('stepMismatchFor("2010-02-10", "-1", "2010-02-09")');
    38 shouldBeFalse('stepMismatchFor("2010-02-10", "foo", "2010-02-09")');
    39 debug('Special step value');
    40 shouldBeFalse('stepMismatchFor("2010-02-10", "any", "2010-02-09")');
    41 debug('Disabled');
    42 shouldBeFalse('stepMismatchFor("2010-02-10", "2", "2010-02-09", true)');
    43 
    44 debug('');
    45 debug('Datetime type');
    46 input.type = 'datetime';
    47 debug('Empty values');
    48 shouldBeFalse('stepMismatchFor("", null, null)');
    49 shouldBeFalse('stepMismatchFor("", "2", "1969-12-31T12:34:56Z")');
    50 debug('Normal step values');
    51 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55Z", "1", "2010-02-09T12:34:56Z")');
    52 shouldBeTrue('stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z")');
    53 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:56.001Z", "0.001", "2010-02-09T12:34:56Z")');
    54 shouldBeTrue('stepMismatchFor("2010-02-09T12:34:55Z", "0.333", "2010-02-09T12:34:56Z")');
    55 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001Z", "0.333", "2010-02-09T12:34:56Z")');
    56 shouldBeFalse('stepMismatchFor("2010-02-09T12:34Z", "86400", "2010-02-08T12:34Z")');
    57 shouldBeTrue('stepMismatchFor("2010-02-09T12:34:56Z", "86400", "2010-02-08T12:34Z")');
    58 shouldBeTrue('stepMismatchFor("275760-09-13T00:00Z", "3", "275760-09-12T23:59:50Z")');
    59 shouldBeFalse('stepMismatchFor("275760-09-13T00:00Z", "2", "275760-09-12T23:59:50Z")');
    60 shouldBeTrue('stepMismatchFor("0001-01-01T00:00Z", "3", "0001-01-11T00:00:02Z")');
    61 shouldBeFalse('stepMismatchFor("0001-01-01T00:00Z", "2", "0001-01-11T00:00:02Z")');
    62 debug('Implicit step base');
    63 shouldBeFalse('stepMismatchFor("1970-01-01T12:34Z", "120", null)');
    64 shouldBeTrue('stepMismatchFor("1970-01-01T12:35Z", "120", null)');
    65 debug('Small step values');
    66 shouldBeFalse('stepMismatchFor("2010-02-10T12:34:56.000Z", "0.0003", "2010-02-10T12:34.55.000Z")');
    67 shouldBeTrue('stepMismatchFor("2010-02-10T12:34:55.001Z", "0.0019", "2010-02-10T12:34.55.000Z")');
    68 debug('Invalid or no step values');
    69 shouldBeFalse('stepMismatchFor("2010-02-10T12:34Z", null, "2010-02-09T12:34Z")');
    70 shouldBeTrue('stepMismatchFor("2010-02-10T12:34:56Z", null, "2010-02-09T12:34Z")');
    71 shouldBeFalse('stepMismatchFor("2010-02-10T12:34Z", "-1", "2010-02-09T12:34Z")');
    72 shouldBeFalse('stepMismatchFor("2010-02-10T12:34Z", "foo", "2010-02-09T12:34Z")');
    73 debug('Special step value');
    74 shouldBeFalse('stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z")');
    75 debug('Disabled');
    76 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true)');
    77 
    78 debug('');
    79 debug('Datetime-local type');
    80 input.type = 'datetime-local';
    81 debug('Empty values');
    82 shouldBeFalse('stepMismatchFor("", null, null)');
    83 shouldBeFalse('stepMismatchFor("", "2", "1969-12-31T12:34:56")');
    84 debug('Normal step values');
    85 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55", "1", "2010-02-09T12:34:56")');
    86 shouldBeTrue('stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56")');
    87 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:56.001", "0.001", "2010-02-09T12:34:56")');
    88 shouldBeTrue('stepMismatchFor("2010-02-09T12:34:55", "0.333", "2010-02-09T12:34:56")');
    89 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001", "0.333", "2010-02-09T12:34:56")');
    90 shouldBeFalse('stepMismatchFor("2010-02-09T12:34", "86400", "2010-02-08T12:34")');
    91 shouldBeTrue('stepMismatchFor("2010-02-09T12:34:56", "86400", "2010-02-08T12:34")');
    92 shouldBeTrue('stepMismatchFor("275760-09-13T00:00", "3", "275760-09-12T23:59:50")');
    93 shouldBeFalse('stepMismatchFor("275760-09-13T00:00", "2", "275760-09-12T23:59:50")');
    94 shouldBeTrue('stepMismatchFor("0001-01-01T00:00", "3", "0001-01-11T00:00:02")');
    95 shouldBeFalse('stepMismatchFor("0001-01-01T00:00", "2", "0001-01-11T00:00:02")');
    96 debug('Implicit step base');
    97 shouldBeFalse('stepMismatchFor("1970-01-01T12:34", "120", null)');
    98 shouldBeTrue('stepMismatchFor("1970-01-01T12:35", "120", null)');
    99 debug('Small step values');
    100 shouldBeFalse('stepMismatchFor("2010-02-10T12:34:56.000", "0.0003", "2010-02-10T12:34.55.000")');
    101 shouldBeTrue('stepMismatchFor("2010-02-10T12:34:55.001", "0.0019", "2010-02-10T12:34.55.000")');
    102 debug('Invalid or no step values');
    103 shouldBeFalse('stepMismatchFor("2010-02-10T12:34", null, "2010-02-09T12:34")');
    104 shouldBeTrue('stepMismatchFor("2010-02-10T12:34:56", null, "2010-02-09T12:34")');
    105 shouldBeFalse('stepMismatchFor("2010-02-10T12:34", "-1", "2010-02-09T12:34")');
    106 shouldBeFalse('stepMismatchFor("2010-02-10T12:34", "foo", "2010-02-09T12:34")');
    107 debug('Special step value');
    108 shouldBeFalse('stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34")');
    109 debug('Disabled');
    110 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true)');
    111 
    112 debug('');
    113 debug('Number type');
    114 input.type = 'number';
    115 debug('Empty values');
    116 shouldBe('stepMismatchFor("", null, null)', 'false');
    117 shouldBe('stepMismatchFor("", "1.0", "0.1")', 'false');
    118 debug('Integers');
    119 shouldBe('stepMismatchFor("1", "2", "0")', 'true');
    120 shouldBe('stepMismatchFor("-3", "2", "-4")', 'true');
    121 shouldBe('input.max = "5"; stepMismatchFor("5", "3", "0")', 'true');
    122 shouldBe('input.value', '"5"');
    123 debug('Invalid step values');
    124 input.max = '';
    125 shouldBe('stepMismatchFor("-3", "-2", "-4")', 'false');
    126 shouldBe('stepMismatchFor("-3", null, "-4")', 'false');
    127 shouldBe('stepMismatchFor("-3", undefined, "-4")', 'false');
    128 debug('Huge numbers and small step; uncomparable');
    129 shouldBe('stepMismatchFor("3.40282347e+38", "3", "")', 'false');
    130 shouldBe('stepMismatchFor("3.40282346e+38", "3", "")', 'false');
    131 shouldBe('stepMismatchFor("3.40282345e+38", "3", "")', 'false');
    132 debug('Huge numbers and huge step');
    133 shouldBe('stepMismatchFor("3.20e+38", "0.20e+38", "")', 'false');
    134 shouldBe('stepMismatchFor("3.20e+38", "0.22e+38", "")', 'true');
    135 debug('Fractional numbers');
    136 shouldBe('stepMismatchFor("0.9", "0.1", "")', 'false');
    137 shouldBe('stepMismatchFor("0.9", "0.1000001", "")', 'true');
    138 shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false');
    139 shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false');
    140 debug('Rounding');
    141 shouldBe('stepMismatchFor("5.005", "0.005", "4")', 'false');
    142 debug('Disabled');
    143 shouldBe('stepMismatchFor("1", "2", "0", true)', 'false');
    144 
    145 debug('');
    146 debug('Range type');
    147 input.type = 'range';
    148 // The following test inputs are the same as inputs for type=numbe,
    149 // but all expected results should be 'false'.
    150 debug('Empty values');
    151 shouldBe('stepMismatchFor("", null, null)', 'false');
    152 shouldBe('stepMismatchFor("", "1.0", "0.1")', 'false');
    153 debug('Integers');
    154 shouldBe('stepMismatchFor("1", "2", "0")', 'false');
    155 shouldBe('stepMismatchFor("-3", "2", "-4")', 'false');
    156 shouldBe('input.max = "5"; stepMismatchFor("5", "3", "0")', 'false');
    157 shouldBe('input.value', '"3"'); // Different from type=number.
    158 debug('Invalid step values');
    159 input.max = '';
    160 shouldBe('stepMismatchFor("-3", "-2", "-4")', 'false');
    161 shouldBe('stepMismatchFor("-3", null, "-4")', 'false');
    162 shouldBe('stepMismatchFor("-3", undefined, "-4")', 'false');
    163 debug('Huge numbers and small step; uncomparable');
    164 shouldBe('stepMismatchFor("3.40282347e+38", "3", "")', 'false');
    165 shouldBe('stepMismatchFor("3.40282346e+38", "3", "")', 'false');
    166 shouldBe('stepMismatchFor("3.40282345e+38", "3", "")', 'false');
    167 debug('Huge numbers and huge step');
    168 shouldBe('stepMismatchFor("3.20e+38", "0.20e+38", "")', 'false');
    169 shouldBe('stepMismatchFor("3.20e+38", "0.22e+38", "")', 'false');
    170 debug('Fractional numbers');
    171 shouldBe('stepMismatchFor("0.9", "0.1", "")', 'false');
    172 shouldBe('stepMismatchFor("0.9", "0.1000001", "")', 'false');
    173 shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false');
    174 shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false');
    175 debug('Disabled');
    176 shouldBe('stepMismatchFor("1", "2", "0", true)', 'false');
    177 
    178 debug('');
    179 debug('Time type');
    18024input.type = 'time';
    18125debug('Empty values');
     
    20953
    21054debug('');
    211 debug('Unsupported types');
    212 shouldBe('input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch', 'false');
    213 shouldBe('input.type = "button"; input.validity.stepMismatch', 'false');
    214 shouldBe('input.type = "checkbox"; input.validity.stepMismatch', 'false');
    215 shouldBe('input.type = "color"; input.validity.stepMismatch', 'false');
    216 shouldBe('input.type = "email"; input.validity.stepMismatch', 'false');
    217 shouldBe('input.type = "hidden"; input.validity.stepMismatch', 'false');
    218 shouldBe('input.type = "image"; input.validity.stepMismatch', 'false');
    219 shouldBe('input.type = "khtml_isindex"; input.validity.stepMismatch', 'false');
    220 shouldBe('input.type = "passwd"; input.validity.stepMismatch', 'false');
    221 shouldBe('input.type = "radio"; input.validity.stepMismatch', 'false');
    222 shouldBe('input.type = "reset"; input.validity.stepMismatch', 'false');
    223 shouldBe('input.type = "search"; input.validity.stepMismatch', 'false');
    224 shouldBe('input.type = "submit"; input.validity.stepMismatch', 'false');
    225 shouldBe('input.type = "tel"; input.validity.stepMismatch', 'false');
    226 shouldBe('input.type = "url"; input.validity.stepMismatch', 'false');
    227 shouldBe('input.type = "file"; input.validity.stepMismatch', 'false');
    228 
    22955var successfullyParsed = true;
     56</script>
     57<script src="../../js/resources/js-test-post.js"></script>
     58</body>
     59</html>
  • trunk/LayoutTests/fast/forms/time/ValidityState-typeMismatch-time.html

    r92745 r92746  
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
    111description('This test aims to check for typeMismatch flag with type=time input fields');
    212var i = document.createElement('input');
     
    6474
    6575var successfullyParsed = true;
     76</script>
     77<script src="../../js/resources/js-test-post.js"></script>
     78</body>
     79</html>
  • trunk/LayoutTests/fast/forms/time/input-valueasdate-time.html

    r92745 r92746  
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
    111description('Tests for .valueAsDate with &lt;input type=time>.');
    212
     
    4555
    4656var successfullyParsed = true;
     57</script>
     58<script src="../../js/resources/js-test-post.js"></script>
     59</body>
     60</html>
  • trunk/LayoutTests/fast/forms/time/input-valueasnumber-time.html

    r92745 r92746  
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
    111description('Tests for .valueAsNumber with &lt;input type=time>.');
    212
     
    4555
    4656var successfullyParsed = true;
     57</script>
     58<script src="../../js/resources/js-test-post.js"></script>
     59</body>
     60</html>
  • trunk/LayoutTests/fast/forms/time/time-input-type-expected.txt

    r92745 r92746  
    44
    55
    6 PASS input.type for "week" is correctly "week".
    7 PASS input.type for "WEEK" is correctly "week".
    8 PASS input.type for " week " is correctly "text".
     6PASS input.type for "time" is correctly "time".
     7PASS input.type for "TIME" is correctly "time".
     8PASS input.type for " time " is correctly "text".
    99PASS successfullyParsed is true
    1010
  • trunk/LayoutTests/fast/forms/time/time-input-type.html

    r92745 r92746  
    2323}
    2424
    25 check("week", "week");
    26 check("WEEK", "week");
    27 check(" week ", "text");
     25check("time", "time");
     26check("TIME", "time");
     27check(" time ", "text");
    2828
    2929var successfullyParsed = true;
     
    3232</body>
    3333</html>
    34 
  • trunk/LayoutTests/fast/forms/time/time-input-visible-string-expected.txt

    r92745 r92746  
    11The user-visible values of week input fields should be localized if the platform has a LocalizedDate implementation. Otherwise, they should be in the HTML5 formats.
    22
    3 week: value='2011-W17' visible='2011-W17'
     3time: value='01:56:20.391' visible='01:56:20.391'
    44PASS successfullyParsed is true
    55
  • trunk/LayoutTests/fast/forms/time/time-input-visible-string.html

    r92745 r92746  
    22<html>
    33<head>
    4 <title>Week Input Test</title>
     4<title>Time Input Test</title>
    55<script src="../../js/resources/js-test-pre.js"></script>
    66</head>
     
    1010
    1111    <form method="get" action="#">
    12         <input type="week"><br>
     12        <input type="time"><br>
    1313    </form>
    1414
  • trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt

    r92745 r92746  
    1 Check stepUp() and stepDown() bahevior for type=date, datetime, datetime-local, time.
     1Check stepUp() and stepDown() bahevior for type=time.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 Date type
    7 Invalid value
    8 PASS stepUp("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    9 PASS stepDown("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    10 Non-number arguments
    11 PASS stepUp("2010-02-10", null, null, "0") is "2010-02-10"
    12 PASS stepDown("2010-02-10", null, null, "0") is "2010-02-10"
    13 PASS stepUp("2010-02-10", null, null, "foo") is "2010-02-10"
    14 PASS stepDown("2010-02-10", null, null, "foo") is "2010-02-10"
    15 PASS stepUp("2010-02-10", null, null, null) is "2010-02-10"
    16 PASS stepDown("2010-02-10", null, null, null) is "2010-02-10"
    17 Normal cases
    18 PASS stepUp("2010-02-10", null, null) is "2010-02-11"
    19 PASS stepDown("2010-02-10", null, null) is "2010-02-09"
    20 PASS stepUp("2010-02-10", null, null, 10) is "2010-02-20"
    21 PASS stepDown("2010-02-10", null, null, 11) is "2010-01-30"
    22 PASS stepUp("1970-01-01", "4", null, 2) is "1970-01-09"
    23 PASS stepDown("1970-01-01", "4", null, 3) is "1969-12-20"
    24 Step=any
    25 PASS stepUp("2010-02-10", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    26 PASS stepDown("2010-02-10", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    27 Overflow/underflow
    28 PASS stepUp("2010-02-10", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    29 PASS stepDown("2010-02-10", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    30 PASS stepUp("2010-02-10", "1", "2010-02-10") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    31 PASS stepDown("2010-02-10", "1", "2010-02-10") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    32 
    33 Datetime type
    34 Invalid value
    35 PASS stepUp("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    36 PASS stepDown("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    37 Non-number arguments
    38 PASS stepUp("2010-02-10T20:13Z", null, null, "0") is "2010-02-10T20:13Z"
    39 PASS stepDown("2010-02-10T20:13Z", null, null, "0") is "2010-02-10T20:13Z"
    40 PASS stepUp("2010-02-10T20:13Z", null, null, "foo") is "2010-02-10T20:13Z"
    41 PASS stepDown("2010-02-10T20:13Z", null, null, "foo") is "2010-02-10T20:13Z"
    42 PASS stepUp("2010-02-10T20:13Z", null, null, null) is "2010-02-10T20:13Z"
    43 PASS stepDown("2010-02-10T20:13Z", null, null, null) is "2010-02-10T20:13Z"
    44 Normal cases
    45 PASS stepUp("2010-02-10T20:13Z", null, null) is "2010-02-10T20:14Z"
    46 PASS stepDown("2010-02-10T20:13Z", null, null) is "2010-02-10T20:12Z"
    47 PASS stepUp("2010-02-10T20:13Z", null, null, 10) is "2010-02-10T20:23Z"
    48 PASS stepDown("2010-02-10T20:13Z", null, null, 11) is "2010-02-10T20:02Z"
    49 PASS stepUp("1970-01-01T20:13Z", "4", null, 2) is "1970-01-01T20:13:08Z"
    50 PASS stepDown("1970-01-01T20:13Z", "4", null, 3) is "1970-01-01T20:12:48Z"
    51 Step=any
    52 PASS stepUp("2010-02-10T20:13Z", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    53 PASS stepDown("2010-02-10T20:13Z", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    54 Overflow/underflow
    55 PASS stepUp("2010-02-10T20:13Z", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    56 PASS stepDown("2010-02-10T20:13Z", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    57 PASS stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    58 PASS stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    59 
    60 Datetime-local type
    61 Invalid value
    62 PASS stepUp("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    63 PASS stepDown("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    64 Non-number arguments
    65 PASS stepUp("2010-02-10T20:13", null, null, "0") is "2010-02-10T20:13"
    66 PASS stepDown("2010-02-10T20:13", null, null, "0") is "2010-02-10T20:13"
    67 PASS stepUp("2010-02-10T20:13", null, null, "foo") is "2010-02-10T20:13"
    68 PASS stepDown("2010-02-10T20:13", null, null, "foo") is "2010-02-10T20:13"
    69 PASS stepUp("2010-02-10T20:13", null, null, null) is "2010-02-10T20:13"
    70 PASS stepDown("2010-02-10T20:13", null, null, null) is "2010-02-10T20:13"
    71 Normal cases
    72 PASS stepUp("2010-02-10T20:13", null, null) is "2010-02-10T20:14"
    73 PASS stepDown("2010-02-10T20:13", null, null) is "2010-02-10T20:12"
    74 PASS stepUp("2010-02-10T20:13", null, null, 10) is "2010-02-10T20:23"
    75 PASS stepDown("2010-02-10T20:13", null, null, 11) is "2010-02-10T20:02"
    76 PASS stepUp("1970-01-01T20:13", "4", null, 2) is "1970-01-01T20:13:08"
    77 PASS stepDown("1970-01-01T20:13", "4", null, 3) is "1970-01-01T20:12:48"
    78 Step=any
    79 PASS stepUp("2010-02-10T20:13", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    80 PASS stepDown("2010-02-10T20:13", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    81 Overflow/underflow
    82 PASS stepUp("2010-02-10T20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    83 PASS stepDown("2010-02-10T20:13", "3.40282346e+38", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    84 PASS stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    85 PASS stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    86 
    87 Number type
    88 Invalid value
    89 PASS stepUp("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    90 PASS stepDown("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    91 Non-number arguments
    92 PASS stepUp("0", null, null, "0") is "0"
    93 PASS stepDown("0", null, null, "0") is "0"
    94 PASS stepUp("0", null, null, "foo") is "0"
    95 PASS stepDown("0", null, null, "foo") is "0"
    96 PASS stepUp("0", null, null, null) is "0"
    97 PASS stepDown("0", null, null, null) is "0"
    98 Normal cases
    99 PASS stepUp("0", null, null) is "1"
    100 PASS stepUp("1", null, null, 2) is "3"
    101 PASS stepUp("3", null, null, -1) is "2"
    102 PASS stepDown("2", null, null) is "1"
    103 PASS stepDown("1", null, null, 2) is "-1"
    104 PASS stepDown("-1", null, null, -1) is "0"
    105 Extra arguments
    106 PASS input.value = "0"; input.min = null; input.step = null; input.stepUp(1, 2); input.value is "1"
    107 PASS input.value = "1"; input.stepDown(1, 3); input.value is "0"
    108 Invalid step value
    109 PASS stepUp("0", "foo", null) is "1"
    110 PASS stepUp("1", "0", null) is "2"
    111 PASS stepUp("2", "-1", null) is "3"
    112 Step=any
    113 PASS stepUp("0", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    114 PASS stepDown("0", "any", null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    115 Step=any corner case
    116 PASS stepUpExplicitBounds("0", "100", "any", "1.5", "1") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    117 PASS stepDownExplicitBounds("0", "100", "any", "1.5", "1") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    118 Overflow/underflow
    119 PASS stepDown("1", "1", "0") is "0"
    120 PASS stepDown("0", "1", "0") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    121 PASS stepDown("1", "1", "0", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    122 PASS input.value is "1"
    123 PASS stepDown("1", "3.40282346e+38", "", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    124 PASS stepUp("-1", "1", "0") is "0"
    125 PASS stepUp("0", "1", "0") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    126 PASS stepUp("-1", "1", "0", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    127 PASS input.value is "-1"
    128 PASS stepUp("1", "3.40282346e+38", "", 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    129 stepDown()/stepUp() for stepMismatch values
    130 PASS stepUp("1", "2", "") is "3"
    131 PASS input.stepDown(); input.value is "1"
    132 PASS input.min = "0"; stepUp("9", "10", "", 9) is "99"
    133 PASS stepDown("19", "10", "0") is "9"
    134 PASS stepUp("89", "10", "99") is "99"
    135 Huge value and small step
    136 PASS input.min = ""; stepUp("1e+38", "1", "", 999999) is "1e+38"
    137 PASS input.max = ""; stepDown("1e+38", "1", "", 999999) is "1e+38"
    138 Fractional numbers
    139 PASS input.min = ""; stepUp("0", "0.33333333333333333", "", 3) is "1"
    140 PASS stepUp("1", "0.1", "", 10) is "2"
    141 PASS input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value is "3"
    142 PASS input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255) is "1"
    143 PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0"
    144 Rounding
    145 PASS stepUp("5.005", "0.005", "", 2) is "5.015"
    146 PASS stepUp("5.005", "0.005", "", 11) is "5.06"
    147 PASS stepUp("5.005", "0.005", "", 12) is "5.065"
    148 PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 2) is "5.015"
    149 PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 11) is "5.06"
    150 PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 12) is "5.065"
    151 
    152 Range type
    153 function arguments are (min, max, step, value, [stepCount])
    154 Using the default values
    155 PASS stepUpExplicitBounds(null, null, null, "") is "51"
    156 PASS stepDownExplicitBounds(null, null, null, "") is "49"
    157 Non-number arguments (stepCount)
    158 PASS stepUpExplicitBounds(null, null, null, "0", "0") is "0"
    159 PASS stepDownExplicitBounds(null, null, null, "0", "0") is "0"
    160 PASS stepUpExplicitBounds(null, null, null, "0", "foo") is "0"
    161 PASS stepDownExplicitBounds(null, null, null, "0", "foo") is "0"
    162 PASS stepUpExplicitBounds(null, null, null, "0", null) is "0"
    163 PASS stepDownExplicitBounds(null, null, null, "0", null) is "0"
    164 Normal cases
    165 PASS stepUpExplicitBounds(null, null, null, "0") is "1"
    166 PASS stepUpExplicitBounds(null, null, null, "1", 2) is "3"
    167 PASS stepUpExplicitBounds(null, null, null, "3", -1) is "2"
    168 PASS stepDownExplicitBounds("-100", null, null, "2") is "1"
    169 PASS stepDownExplicitBounds("-100", null, null, "1", 2) is "-1"
    170 PASS stepDownExplicitBounds("-100", null, null, "-1", -1) is "0"
    171 Extra arguments
    172 PASS setInputAttributes(null, null, null, "0"); input.stepUp(1,2); input.value is "1"
    173 PASS setInputAttributes(null, null, null, "1"); input.stepDown(1,3); input.value is "0"
    174 Invalid step value
    175 PASS stepUpExplicitBounds(null, null, "foo", "0") is "1"
    176 PASS stepUpExplicitBounds(null, null, "0", "1") is "2"
    177 PASS stepUpExplicitBounds(null, null, "-1", "2") is "3"
    178 PASS stepDownExplicitBounds(null, null, "foo", "1") is "0"
    179 PASS stepDownExplicitBounds(null, null, "0", "2") is "1"
    180 PASS stepDownExplicitBounds(null, null, "-1", "3") is "2"
    181 Step=any
    182 PASS stepUpExplicitBounds(null, null, "any", "1") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    183 PASS stepDownExplicitBounds(null, null, "any", "1") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    184 Overflow/underflow
    185 PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
    186 PASS stepUpExplicitBounds(null, "100", "1", "100") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    187 PASS input.value is "100"
    188 PASS stepUpExplicitBounds(null, "100", "1", "99", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    189 PASS input.value is "99"
    190 PASS stepDownExplicitBounds("0", null, "1", "1") is "0"
    191 PASS stepDownExplicitBounds("0", null, "1", "0") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    192 PASS input.value is "0"
    193 PASS stepDownExplicitBounds("0", null, "1", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    194 PASS input.value is "1"
    195 PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    196 PASS stepUpExplicitBounds(-100, 0, 1, -1) is "0"
    197 PASS stepUpExplicitBounds(null, 0, 1, 0) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    198 PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    199 PASS input.value is "-1"
    200 PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    201 stepDown()/stepUp() for stepMismatch values
    202 PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
    203 PASS input.stepDown(); input.value is "2"
    204 PASS stepUpExplicitBounds(0, null, 10, 9, 9) is "100"
    205 PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
    206 value + step is <= max, but rounded result would be > max.
    207 PASS stepUpExplicitBounds(null, 99, 10, 89) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    208 Huge value and small step
    209 PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
    210 PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
    211 Fractional numbers
    212 PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
    213 PASS stepUpExplicitBounds(null, null, 0.1, 1) is "1.1"
    214 PASS stepUpExplicitBounds(null, null, 0.1, 1, 8) is "1.8"
    215 PASS stepUpExplicitBounds(null, null, 0.1, 1, 10) is "2"
    216 PASS input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value is "3"
    217 PASS stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255) is "1"
    218 PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0"
    219 PASS stepDownExplicitBounds(null, null, 0.1, 1, 8) is "0.2"
    220 PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
    221 
    222 Time type
    2236Invalid value
    2247PASS stepUp("", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
     
    24932PASS stepDown("00:00", null, null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    25033
    251 Unsupported type
    252 PASS input.step = "3"; input.min = ""; input.max = ""; input.value = "2"; input.stepDown() threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    253 PASS input.stepDown(0) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    254 PASS input.stepUp() threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    255 PASS input.stepUp(0) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
    25634PASS successfullyParsed is true
    25735
  • trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-from-renderer-expected.txt

    r92745 r92746  
    1 Check stepping-up and -down for  from renderer. No cases of empty initial values for type=date, datetime, datetime-local, time.
     1Check stepping-up and -down for time input fields from renderer. No cases of empty initial values.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 Date type
    7 Function arguments are (value, step, {min or max}, [stepCount]).
    8 Normal cases
    9 PASS stepUp("2010-02-10", null, null) is "2010-02-11"
    10 PASS stepDown("2010-02-10", null, null) is "2010-02-09"
    11 PASS stepUp("2010-02-10", null, null, 10) is "2010-02-20"
    12 PASS stepDown("2010-02-10", null, null, 11) is "2010-01-30"
    13 PASS stepUp("1970-01-01", "4", null, 2) is "1970-01-09"
    14 PASS stepDown("1970-01-01", "4", null, 3) is "1969-12-20"
    15 Step=any
    16 PASS stepUp("2010-02-10", "any", null) is "2010-02-11"
    17 PASS stepDown("2010-02-10", "any", null) is "2010-02-09"
    18 Overflow/underflow
    19 PASS stepUp("2010-02-10", "3.40282346e+38", null) is "275760-09-13"
    20 PASS stepDown("2010-02-10", "3.40282346e+38", null) is "1970-01-01"
    21 PASS stepUp("2010-02-10", "1", "2010-02-10") is "2010-02-10"
    22 PASS stepDown("2010-02-10", "1", "2010-02-10") is "2010-02-10"
    23 stepDown()/stepUp() for stepMismatch values
    24 PASS stepDown("2010-02-10", "3", "2010-02-06") is "2010-02-09"
    25 PASS stepUp("1970-01-02", "2", "") is "1970-01-03"
    26 
    27 Datetime type
    28 Function arguments are (value, step, {min or max}, [stepCount]).
    29 Normal cases
    30 PASS stepUp("2010-02-10T20:13Z", null, null) is "2010-02-10T20:14Z"
    31 PASS stepDown("2010-02-10T20:13Z", null, null) is "2010-02-10T20:12Z"
    32 PASS stepUp("2010-02-10T20:13Z", null, null, 10) is "2010-02-10T20:23Z"
    33 PASS stepDown("2010-02-10T20:13Z", null, null, 11) is "2010-02-10T20:02Z"
    34 PASS stepUp("1970-01-01T20:13Z", "4", null, 2) is "1970-01-01T20:13:08Z"
    35 PASS stepDown("1970-01-01T20:13Z", "4", null, 3) is "1970-01-01T20:12:48Z"
    36 Step=any
    37 PASS stepUp("2010-02-10T20:13Z", "any", null) is "2010-02-10T20:14Z"
    38 PASS stepDown("2010-02-10T20:13Z", "any", null) is "2010-02-10T20:12Z"
    39 Overflow/underflow
    40 PASS stepUp("2010-02-10T20:13Z", "3.40282346e+38", null) is "275760-09-13T00:00:00.000Z"
    41 PASS stepDown("2010-02-10T20:13Z", "3.40282346e+38", null) is "1970-01-01T00:00:00.000Z"
    42 PASS stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") is "2010-02-10T20:13Z"
    43 PASS stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") is "2010-02-10T20:13Z"
    44 stepDown()/stepUp() for stepMismatch values
    45 PASS stepDown("2010-02-10T20:13Z", "3", "2010-02-10T20:12:56Z") is "2010-02-10T20:12:59Z"
    46 PASS stepUp("1970-01-01T00:13Z", "7", "") is "1970-01-01T00:13:04Z"
    47 
    48 Datetime-local type
    49 Function arguments are (value, step, {min or max}, [stepCount]).
    50 Normal cases
    51 PASS stepUp("2010-02-10T20:13", null, null) is "2010-02-10T20:14"
    52 PASS stepDown("2010-02-10T20:13", null, null) is "2010-02-10T20:12"
    53 PASS stepUp("2010-02-10T20:13", null, null, 10) is "2010-02-10T20:23"
    54 PASS stepDown("2010-02-10T20:13", null, null, 11) is "2010-02-10T20:02"
    55 PASS stepUp("1970-01-01T20:13", "4", null, 2) is "1970-01-01T20:13:08"
    56 PASS stepDown("1970-01-01T20:13", "4", null, 3) is "1970-01-01T20:12:48"
    57 Step=any
    58 PASS stepUp("2010-02-10T20:13", "any", null) is "2010-02-10T20:14"
    59 PASS stepDown("2010-02-10T20:13", "any", null) is "2010-02-10T20:12"
    60 Overflow/underflow
    61 PASS stepUp("2010-02-10T20:13", "3.40282346e+38", null) is "275760-09-13T00:00:00.000"
    62 PASS stepDown("2010-02-10T20:13", "3.40282346e+38", null) is "1970-01-01T00:00:00.000"
    63 PASS stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13") is "2010-02-10T20:13"
    64 PASS stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13") is "2010-02-10T20:13"
    65 stepDown()/stepUp() for stepMismatch values
    66 PASS stepDown("2010-02-10T20:13", "3", "2010-02-10T20:12:56") is "2010-02-10T20:12:59"
    67 PASS stepUp("1970-01-01T00:13", "7", "") is "1970-01-01T00:13:04"
    68 
    69 Number type
    70 Function arguments are (value, step, {min or max}, [stepCount]).
    71 Invalid value
    72 PASS stepUp("", null, null) is "1"
    73 PASS stepDown("", null, null) is "-1"
    74 PASS stepUp("", "any", null) is "1"
    75 PASS stepDown("", "any", null) is "-1"
    76 PASS stepUp("", "foo", null) is "1"
    77 PASS stepDown("", "foo", null) is "-1"
    78 PASS stepUp("foo", null, null) is "1"
    79 PASS stepDown("foo", null, null) is "-1"
    80 PASS stepUp("foo", "any", null) is "1"
    81 PASS stepDown("foo", "any", null) is "-1"
    82 PASS stepUp("foo", "foo", null) is "1"
    83 PASS stepDown("foo", "foo", null) is "-1"
    84 Normal cases
    85 PASS stepUp("0", null, null) is "1"
    86 PASS stepUp("1", null, null, 2) is "3"
    87 PASS stepUp("3", null, null, -1) is "2"
    88 PASS stepDown("2", null, null) is "1"
    89 PASS stepDown("1", null, null, 2) is "-1"
    90 PASS stepDown("-1", null, null, -1) is "0"
    91 Invalid step value
    92 PASS stepUp("0", "foo", null) is "1"
    93 PASS stepUp("1", "0", null) is "2"
    94 PASS stepUp("2", "-1", null) is "3"
    95 Step=any
    96 PASS stepUp("0", "any", null) is "1"
    97 PASS stepDown("0", "any", null) is "-1"
    98 Step=any corner case
    99 PASS stepUpExplicitBounds("0", "100", "any", "1.5", "1") is "2.5"
    100 PASS stepDownExplicitBounds("0", "100", "any", "1.5", "1") is "0.5"
    101 Overflow/underflow
    102 PASS stepDown("1", "1", "0") is "0"
    103 PASS stepDown("0", "1", "0") is "0"
    104 PASS stepDown("1", "1", "0", 2) is "0"
    105 PASS stepDown("1", "3.40282346e+38", "", 2) is "-3.40282346e+38"
    106 PASS stepUp("-1", "1", "0") is "0"
    107 PASS stepUp("0", "1", "0") is "0"
    108 PASS stepUp("-1", "1", "0", 2) is "0"
    109 PASS stepUp("1", "3.40282346e+38", "", 2) is "3.40282346e+38"
    110 stepDown()/stepUp() for stepMismatch values
    111 PASS stepUp("1", "2", "") is "2"
    112 PASS input.min = "0"; stepUp("9", "10", "") is "10"
    113 PASS stepDown("19", "10", "0") is "10"
    114 PASS stepUp("89", "10", "99") is "90"
    115 Huge value and small step
    116 PASS input.min = ""; stepUp("1e+38", "1", "", 999) is "1e+38"
    117 PASS input.max = ""; stepDown("1e+38", "1", "", 999) is "1e+38"
    118 Fractional numbers
    119 PASS input.min = ""; stepUp("0", "0.33333333333333333", "", 3) is "1"
    120 PASS stepUp("1", "0.1", "", 10) is "2"
    121 PASS input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255) is "1"
    122 Rounding
    123 PASS stepUp("5.005", "0.005", "", 2) is "5.015"
    124 PASS stepUp("5.005", "0.005", "", 11) is "5.06"
    125 PASS stepUp("5.005", "0.005", "", 12) is "5.065"
    126 PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 2) is "5.015"
    127 PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 11) is "5.06"
    128 PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 12) is "5.065"
    129 PASS stepUpExplicitBounds(-4, 4, 1, "") is "1"
    130 PASS stepDownExplicitBounds(-4, 4, 1, "") is "-1"
    131 PASS stepDownExplicitBounds(0, 4, 1, "") is "0"
    132 PASS stepUpExplicitBounds(-4, 0, 1, "") is "0"
    133 PASS stepDownExplicitBounds(1, 4, 1, "") is "1"
    134 PASS stepUpExplicitBounds(1, 4, 1, "") is "1"
    135 PASS stepDownExplicitBounds(-4, -1, 1, "") is "-1"
    136 PASS stepUpExplicitBounds(-4, -1, 1, "") is "-1"
    137 PASS stepUpExplicitBounds(-100, null, 3, "") is "2"
    138 PASS stepDownExplicitBounds(-100, null, 3, "") is "-1"
    139 PASS stepUpExplicitBounds(1, 4, 1, 0) is "1"
    140 PASS stepDownExplicitBounds(1, 4, 1, 0) is "0"
    141 PASS stepDownExplicitBounds(-4, -1, 1, 0) is "-1"
    142 PASS stepUpExplicitBounds(-4, -1, 1, 0) is "0"
    143 PASS stepUpExplicitBounds(-100, null, 3, 3) is "5"
    144 PASS stepDownExplicitBounds(-100, null, 3, 3) is "2"
    145 
    146 Range type
    147 Function arguments are (min, max, step, value, [stepCount]).
    148 Using the default values
    149 PASS stepUpExplicitBounds(null, null, null, "") is "51"
    150 PASS stepDownExplicitBounds(null, null, null, "") is "49"
    151 PASS stepUpExplicitBounds(null, null, "any", "") is "51"
    152 PASS stepDownExplicitBounds(null, null, "any", "") is "49"
    153 PASS stepUpExplicitBounds(null, null, "foo", "") is "51"
    154 PASS stepDownExplicitBounds(null, null, "foo", "") is "49"
    155 PASS stepUpExplicitBounds(null, null, null, "foo") is "51"
    156 PASS stepDownExplicitBounds(null, null, null, "foo") is "49"
    157 PASS stepUpExplicitBounds(null, null, "any", "foo") is "51"
    158 PASS stepDownExplicitBounds(null, null, "any", "foo") is "49"
    159 PASS stepUpExplicitBounds(null, null, "foo", "foo") is "51"
    160 PASS stepDownExplicitBounds(null, null, "foo", "foo") is "49"
    161 Normal cases
    162 PASS stepUpExplicitBounds(null, null, null, "0") is "1"
    163 PASS stepUpExplicitBounds(null, null, null, "1", 2) is "3"
    164 PASS stepUpExplicitBounds(null, null, null, "3", -1) is "2"
    165 PASS stepDownExplicitBounds("-100", null, null, "2") is "1"
    166 PASS stepDownExplicitBounds("-100", null, null, "1", 2) is "-1"
    167 PASS stepDownExplicitBounds("-100", null, null, "-1", -1) is "0"
    168 Invalid step value
    169 PASS stepUpExplicitBounds(null, null, "foo", "0") is "1"
    170 PASS stepUpExplicitBounds(null, null, "0", "1") is "2"
    171 PASS stepUpExplicitBounds(null, null, "-1", "2") is "3"
    172 PASS stepDownExplicitBounds(null, null, "foo", "1") is "0"
    173 PASS stepDownExplicitBounds(null, null, "0", "2") is "1"
    174 PASS stepDownExplicitBounds(null, null, "-1", "3") is "2"
    175 Step=any
    176 PASS stepUpExplicitBounds(null, null, "any", "1") is "2"
    177 PASS stepDownExplicitBounds(null, null, "any", "1") is "0"
    178 Overflow/underflow
    179 PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
    180 PASS stepUpExplicitBounds(null, "100", "1", "100") is "100"
    181 PASS stepUpExplicitBounds(null, "100", "1", "99", 2) is "100"
    182 PASS stepDownExplicitBounds("0", null, "1", "1") is "0"
    183 PASS stepDownExplicitBounds("0", null, "1", "0") is "0"
    184 PASS stepDownExplicitBounds("0", null, "1", "1", 2) is "0"
    185 PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", 2) is "0"
    186 PASS stepUpExplicitBounds(-100, 0, 1, -1) is "0"
    187 PASS stepUpExplicitBounds(null, 0, 1, 0) is "0"
    188 PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) is "0"
    189 PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", 2) is "0"
    190 stepDown()/stepUp() for stepMismatch values
    191 PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
    192 PASS stepUpExplicitBounds(0, null, 10, 9, 9) is "100"
    193 PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
    194 value + step is <= max, but rounded result would be > max.
    195 PASS stepUpExplicitBounds(null, 99, 10, 89) is "90"
    196 Huge value and small step
    197 PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999) is "1e+38"
    198 PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999) is "1e+38"
    199 Fractional numbers
    200 PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
    201 PASS stepUpExplicitBounds(null, null, 0.1, 1) is "1.1"
    202 PASS stepUpExplicitBounds(null, null, 0.1, 1, 8) is "1.8"
    203 PASS stepUpExplicitBounds(null, null, 0.1, 1, 10) is "2"
    204 PASS stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255) is "1"
    205 PASS stepDownExplicitBounds(null, null, 0.1, 1, 8) is "0.2"
    206 PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
    207 
    208 Time type
    2096Function arguments are (value, step, {min or max}, [stepCount]).
    2107Normal cases
  • trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-from-renderer.html

    r92745 r92746  
    1 description('Check stepping-up and -down for <input> from renderer. No cases of empty initial values for type=date, datetime, datetime-local, time.');
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
     11description('Check stepping-up and -down for time input fields from renderer. No cases of empty initial values.');
    212
    313var input = document.createElement('input');
     
    4555}
    4656
    47 // Range value gets automatically shifted based on bounds,
    48 // So always set the min and max first to get expected behavior
    49 
    50 function stepUpExplicitBounds(min, max, step, value, stepCount) {
    51     setInputAttributes(min, max, step, value);
    52     if (typeof stepCount !== 'undefined')
    53         if (stepCount < 0) {
    54             for (var i = 0; i < -stepCount; i++)
    55                 sendKey('Down');
    56         } else {
    57             for (var i = 0; i < stepCount; i++)
    58                 sendKey('Up');
    59         }
    60     else
    61         sendKey('Up');
    62     return input.value;
    63 }
    64 
    65 function stepDownExplicitBounds(min, max, step, value, stepCount) {
    66     setInputAttributes(min, max, step, value);
    67     if (typeof stepCount !== 'undefined')
    68         if (stepCount < 0) {
    69             for (var i = 0; i < -stepCount; i++)
    70                 sendKey('Up');
    71         } else {
    72             for (var i = 0; i < stepCount; i++)
    73                 sendKey('Down');
    74         }
    75     else
    76         sendKey('Down');
    77     return input.value;
    78 }
    79 
    80 debug('Date type');
    81 input.type = 'date';
    82 debug('Function arguments are (value, step, {min or max}, [stepCount]).');
    83 debug('Normal cases');
    84 shouldBe('stepUp("2010-02-10", null, null)', '"2010-02-11"');
    85 shouldBe('stepDown("2010-02-10", null, null)', '"2010-02-09"');
    86 shouldBe('stepUp("2010-02-10", null, null, 10)', '"2010-02-20"');
    87 shouldBe('stepDown("2010-02-10", null, null, 11)', '"2010-01-30"');
    88 shouldBe('stepUp("1970-01-01", "4", null, 2)', '"1970-01-09"');
    89 shouldBe('stepDown("1970-01-01", "4", null, 3)', '"1969-12-20"');
    90 debug('Step=any');
    91 shouldBe('stepUp("2010-02-10", "any", null)', '"2010-02-11"');
    92 shouldBe('stepDown("2010-02-10", "any", null)', '"2010-02-09"');
    93 debug('Overflow/underflow');
    94 shouldBe('stepUp("2010-02-10", "3.40282346e+38", null)','"275760-09-13"');
    95 shouldBe('stepDown("2010-02-10", "3.40282346e+38", null)', '"1970-01-01"');
    96 shouldBe('stepUp("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
    97 shouldBe('stepDown("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
    98 debug('stepDown()/stepUp() for stepMismatch values');
    99 shouldBe('stepDown("2010-02-10", "3", "2010-02-06")', '"2010-02-09"');
    100 shouldBe('stepUp("1970-01-02", "2", "")', '"1970-01-03"');
    101 
    102 debug('');
    103 debug('Datetime type');
    104 input.type = 'datetime';
    105 debug('Function arguments are (value, step, {min or max}, [stepCount]).');
    106 debug('Normal cases');
    107 shouldBe('stepUp("2010-02-10T20:13Z", null, null)', '"2010-02-10T20:14Z"');
    108 shouldBe('stepDown("2010-02-10T20:13Z", null, null)', '"2010-02-10T20:12Z"');
    109 shouldBe('stepUp("2010-02-10T20:13Z", null, null, 10)', '"2010-02-10T20:23Z"');
    110 shouldBe('stepDown("2010-02-10T20:13Z", null, null, 11)', '"2010-02-10T20:02Z"');
    111 shouldBe('stepUp("1970-01-01T20:13Z", "4", null, 2)', '"1970-01-01T20:13:08Z"');
    112 shouldBe('stepDown("1970-01-01T20:13Z", "4", null, 3)', '"1970-01-01T20:12:48Z"');
    113 debug('Step=any');
    114 shouldBe('stepUp("2010-02-10T20:13Z", "any", null)', '"2010-02-10T20:14Z"');
    115 shouldBe('stepDown("2010-02-10T20:13Z", "any", null)', '"2010-02-10T20:12Z"');
    116 debug('Overflow/underflow');
    117 shouldBe('stepUp("2010-02-10T20:13Z", "3.40282346e+38", null)', '"275760-09-13T00:00:00.000Z"');
    118 shouldBe('stepDown("2010-02-10T20:13Z", "3.40282346e+38", null)', '"1970-01-01T00:00:00.000Z"');
    119 shouldBe('stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z")', '"2010-02-10T20:13Z"');
    120 shouldBe('stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z")', '"2010-02-10T20:13Z"');
    121 debug('stepDown()/stepUp() for stepMismatch values');
    122 shouldBe('stepDown("2010-02-10T20:13Z", "3", "2010-02-10T20:12:56Z")', '"2010-02-10T20:12:59Z"');
    123 shouldBe('stepUp("1970-01-01T00:13Z", "7", "")', '"1970-01-01T00:13:04Z"');
    124 
    125 debug('');
    126 debug('Datetime-local type');
    127 input.type = 'datetime-local';
    128 debug('Function arguments are (value, step, {min or max}, [stepCount]).');
    129 debug('Normal cases');
    130 shouldBe('stepUp("2010-02-10T20:13", null, null)', '"2010-02-10T20:14"');
    131 shouldBe('stepDown("2010-02-10T20:13", null, null)', '"2010-02-10T20:12"');
    132 shouldBe('stepUp("2010-02-10T20:13", null, null, 10)', '"2010-02-10T20:23"');
    133 shouldBe('stepDown("2010-02-10T20:13", null, null, 11)', '"2010-02-10T20:02"');
    134 shouldBe('stepUp("1970-01-01T20:13", "4", null, 2)', '"1970-01-01T20:13:08"');
    135 shouldBe('stepDown("1970-01-01T20:13", "4", null, 3)', '"1970-01-01T20:12:48"');
    136 debug('Step=any');
    137 shouldBe('stepUp("2010-02-10T20:13", "any", null)', '"2010-02-10T20:14"');
    138 shouldBe('stepDown("2010-02-10T20:13", "any", null)', '"2010-02-10T20:12"');
    139 debug('Overflow/underflow');
    140 shouldBe('stepUp("2010-02-10T20:13", "3.40282346e+38", null)', '"275760-09-13T00:00:00.000"');
    141 shouldBe('stepDown("2010-02-10T20:13", "3.40282346e+38", null)', '"1970-01-01T00:00:00.000"');
    142 shouldBe('stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13")', '"2010-02-10T20:13"');
    143 shouldBe('stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13")', '"2010-02-10T20:13"');
    144 debug('stepDown()/stepUp() for stepMismatch values');
    145 shouldBe('stepDown("2010-02-10T20:13", "3", "2010-02-10T20:12:56")', '"2010-02-10T20:12:59"');
    146 shouldBe('stepUp("1970-01-01T00:13", "7", "")', '"1970-01-01T00:13:04"');
    147 
    148 debug('');
    149 debug('Number type');
    150 input.type = 'number';
    151 debug('Function arguments are (value, step, {min or max}, [stepCount]).');
    152 debug('Invalid value');
    153 shouldBe('stepUp("", null, null)', '"1"');
    154 shouldBe('stepDown("", null, null)', '"-1"');
    155 shouldBe('stepUp("", "any", null)', '"1"');
    156 shouldBe('stepDown("", "any", null)', '"-1"');
    157 shouldBe('stepUp("", "foo", null)', '"1"');
    158 shouldBe('stepDown("", "foo", null)', '"-1"');
    159 shouldBe('stepUp("foo", null, null)', '"1"');
    160 shouldBe('stepDown("foo", null, null)', '"-1"');
    161 shouldBe('stepUp("foo", "any", null)', '"1"');
    162 shouldBe('stepDown("foo", "any", null)', '"-1"');
    163 shouldBe('stepUp("foo", "foo", null)', '"1"');
    164 shouldBe('stepDown("foo", "foo", null)', '"-1"');
    165 debug('Normal cases');
    166 shouldBe('stepUp("0", null, null)', '"1"');
    167 shouldBe('stepUp("1", null, null, 2)', '"3"');
    168 shouldBe('stepUp("3", null, null, -1)', '"2"');
    169 shouldBe('stepDown("2", null, null)', '"1"');
    170 shouldBe('stepDown("1", null, null, 2)', '"-1"');
    171 shouldBe('stepDown("-1", null, null, -1)', '"0"');
    172 debug('Invalid step value');
    173 shouldBe('stepUp("0", "foo", null)', '"1"');
    174 shouldBe('stepUp("1", "0", null)', '"2"');
    175 shouldBe('stepUp("2", "-1", null)', '"3"');
    176 debug('Step=any');
    177 shouldBe('stepUp("0", "any", null)', '"1"');
    178 shouldBe('stepDown("0", "any", null)', '"-1"');
    179 debug('Step=any corner case');
    180 shouldBe('stepUpExplicitBounds("0", "100", "any", "1.5", "1")', '"2.5"');
    181 shouldBe('stepDownExplicitBounds("0", "100", "any", "1.5", "1")', '"0.5"');
    182 debug('Overflow/underflow');
    183 shouldBe('stepDown("1", "1", "0")', '"0"');
    184 shouldBe('stepDown("0", "1", "0")', '"0"');
    185 shouldBe('stepDown("1", "1", "0", 2)', '"0"');
    186 shouldBe('stepDown("1", "3.40282346e+38", "", 2)', '"-3.40282346e+38"');
    187 shouldBe('stepUp("-1", "1", "0")', '"0"');
    188 shouldBe('stepUp("0", "1", "0")', '"0"');
    189 shouldBe('stepUp("-1", "1", "0", 2)', '"0"');
    190 shouldBe('stepUp("1", "3.40282346e+38", "", 2)', '"3.40282346e+38"');
    191 debug('stepDown()/stepUp() for stepMismatch values');
    192 shouldBe('stepUp("1", "2", "")', '"2"');
    193 shouldBe('input.min = "0"; stepUp("9", "10", "")', '"10"');
    194 shouldBe('stepDown("19", "10", "0")', '"10"');
    195 shouldBe('stepUp("89", "10", "99")', '"90"');
    196 debug('Huge value and small step');
    197 shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999)', '"1e+38"');
    198 shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999)', '"1e+38"');
    199 debug('Fractional numbers');
    200 shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"');
    201 shouldBe('stepUp("1", "0.1", "", 10)', '"2"');
    202 shouldBe('input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255)', '"1"');
    203 debug('Rounding');
    204 shouldBe('stepUp("5.005", "0.005", "", 2)', '"5.015"');
    205 shouldBe('stepUp("5.005", "0.005", "", 11)', '"5.06"');
    206 shouldBe('stepUp("5.005", "0.005", "", 12)', '"5.065"');
    207 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 2)', '"5.015"');
    208 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 11)', '"5.06"');
    209 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 12)', '"5.065"');
    210 shouldBe('stepUpExplicitBounds(-4, 4, 1, "")', '"1"');
    211 shouldBe('stepDownExplicitBounds(-4, 4, 1, "")', '"-1"');
    212 shouldBe('stepDownExplicitBounds(0, 4, 1, "")', '"0"');
    213 shouldBe('stepUpExplicitBounds(-4, 0, 1, "")', '"0"');
    214 shouldBe('stepDownExplicitBounds(1, 4, 1, "")', '"1"');
    215 shouldBe('stepUpExplicitBounds(1, 4, 1, "")', '"1"');
    216 shouldBe('stepDownExplicitBounds(-4, -1, 1, "")', '"-1"');
    217 shouldBe('stepUpExplicitBounds(-4, -1, 1, "")', '"-1"');
    218 shouldBe('stepUpExplicitBounds(-100, null, 3, "")', '"2"');
    219 shouldBe('stepDownExplicitBounds(-100, null, 3, "")', '"-1"');
    220 shouldBe('stepUpExplicitBounds(1, 4, 1, 0)', '"1"');
    221 shouldBe('stepDownExplicitBounds(1, 4, 1, 0)', '"0"');
    222 shouldBe('stepDownExplicitBounds(-4, -1, 1, 0)', '"-1"');
    223 shouldBe('stepUpExplicitBounds(-4, -1, 1, 0)', '"0"');
    224 shouldBe('stepUpExplicitBounds(-100, null, 3, 3)', '"5"');
    225 shouldBe('stepDownExplicitBounds(-100, null, 3, 3)', '"2"');
    226 
    227 debug('');
    228 debug('Range type');
    229 input.type = 'range';
    230 debug('Function arguments are (min, max, step, value, [stepCount]).');
    231 debug('Using the default values');
    232 shouldBe('stepUpExplicitBounds(null, null, null, "")', '"51"');
    233 shouldBe('stepDownExplicitBounds(null, null, null, "")', '"49"');
    234 shouldBe('stepUpExplicitBounds(null, null, "any", "")', '"51"');
    235 shouldBe('stepDownExplicitBounds(null, null, "any", "")', '"49"');
    236 shouldBe('stepUpExplicitBounds(null, null, "foo", "")', '"51"');
    237 shouldBe('stepDownExplicitBounds(null, null, "foo", "")', '"49"');
    238 shouldBe('stepUpExplicitBounds(null, null, null, "foo")', '"51"');
    239 shouldBe('stepDownExplicitBounds(null, null, null, "foo")', '"49"');
    240 shouldBe('stepUpExplicitBounds(null, null, "any", "foo")', '"51"');
    241 shouldBe('stepDownExplicitBounds(null, null, "any", "foo")', '"49"');
    242 shouldBe('stepUpExplicitBounds(null, null, "foo", "foo")', '"51"');
    243 shouldBe('stepDownExplicitBounds(null, null, "foo", "foo")', '"49"');
    244 debug('Normal cases');
    245 shouldBe('stepUpExplicitBounds(null, null, null, "0")', '"1"');
    246 shouldBe('stepUpExplicitBounds(null, null, null, "1", 2)', '"3"');
    247 shouldBe('stepUpExplicitBounds(null, null, null, "3", -1)', '"2"');
    248 shouldBe('stepDownExplicitBounds("-100", null, null, "2")', '"1"');
    249 shouldBe('stepDownExplicitBounds("-100", null, null, "1", 2)', '"-1"');
    250 shouldBe('stepDownExplicitBounds("-100", null, null, "-1", -1)', '"0"');
    251 debug('Invalid step value');
    252 shouldBe('stepUpExplicitBounds(null, null, "foo", "0")', '"1"');
    253 shouldBe('stepUpExplicitBounds(null, null, "0", "1")', '"2"');
    254 shouldBe('stepUpExplicitBounds(null, null, "-1", "2")', '"3"');
    255 shouldBe('stepDownExplicitBounds(null, null, "foo", "1")', '"0"');
    256 shouldBe('stepDownExplicitBounds(null, null, "0", "2")', '"1"');
    257 shouldBe('stepDownExplicitBounds(null, null, "-1", "3")', '"2"');
    258 debug('Step=any');
    259 shouldBe('stepUpExplicitBounds(null, null, "any", "1")', '"2"');
    260 shouldBe('stepDownExplicitBounds(null, null, "any", "1")', '"0"');
    261 debug('Overflow/underflow');
    262 shouldBe('stepUpExplicitBounds(null, "100", "1", "99")', '"100"');
    263 shouldBe('stepUpExplicitBounds(null, "100", "1", "100")', '"100"');
    264 shouldBe('stepUpExplicitBounds(null, "100", "1", "99", 2)', '"100"');
    265 shouldBe('stepDownExplicitBounds("0", null, "1", "1")', '"0"');
    266 shouldBe('stepDownExplicitBounds("0", null, "1", "0")', '"0"');
    267 shouldBe('stepDownExplicitBounds("0", null, "1", "1", 2)', '"0"');
    268 shouldBe('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", 2)', '"0"');
    269 shouldBe('stepUpExplicitBounds(-100, 0, 1, -1)', '"0"');
    270 shouldBe('stepUpExplicitBounds(null, 0, 1, 0)', '"0"');
    271 shouldBe('stepUpExplicitBounds(-100, 0, 1, -1, 2)', '"0"');
    272 shouldBe('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", 2)', '"0"');
    273 debug('stepDown()/stepUp() for stepMismatch values');
    274 shouldBe('stepUpExplicitBounds(null, null, 2, 1)', '"4"');
    275 shouldBe('stepUpExplicitBounds(0, null, 10, 9, 9)', '"100"');
    276 shouldBe('stepDownExplicitBounds(0, null, 10, 19)', '"10"');
    277 debug('value + step is <= max, but rounded result would be > max.');
    278 shouldBe('stepUpExplicitBounds(null, 99, 10, 89)', '"90"');
    279 debug('Huge value and small step');
    280 shouldBe('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999)', '"1e+38"');
    281 shouldBe('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999)', '"1e+38"');
    282 debug('Fractional numbers');
    283 shouldBe('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '"1"');
    284 shouldBe('stepUpExplicitBounds(null, null, 0.1, 1)', '"1.1"');
    285 shouldBe('stepUpExplicitBounds(null, null, 0.1, 1, 8)', '"1.8"');
    286 shouldBe('stepUpExplicitBounds(null, null, 0.1, 1, 10)', '"2"');
    287 shouldBe('stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255)', '"1"');
    288 shouldBe('stepDownExplicitBounds(null, null, 0.1, 1, 8)', '"0.2"');
    289 shouldBe('stepDownExplicitBounds(null, null, 0.1, 1)', '"0.9"');
    290 
    291 debug('');
    292 debug('Time type');
    29357input.type = 'time';
    29458debug('Function arguments are (value, step, {min or max}, [stepCount]).');
     
    31680debug('');
    31781var successfullyParsed = true;
     82</script>
     83<script src="../../js/resources/js-test-post.js"></script>
     84</body>
     85</html>
  • trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html

    r92745 r92746  
    1 description('Check stepUp() and stepDown() bahevior for type=date, datetime, datetime-local, time.');
     1<!DOCTYPE html>
     2<html>
     3<head>
     4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
     5<script src="../../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
     8<p id="description"></p>
     9<div id="console"></div>
     10<script>
     11description('Check stepUp() and stepDown() bahevior for type=time.');
    212
    313var input = document.createElement('input');
     
    2939}
    3040
    31 // Range value gets automatically shifted based on bounds,
    32 // So always set the min and max first to get expected behavior
    33 
    34 function stepUpExplicitBounds(min, max, step, value, stepCount) {
    35     setInputAttributes(min, max, step, value);
    36     if (typeof stepCount !== 'undefined')
    37         input.stepUp(stepCount);
    38     else
    39         input.stepUp();
    40     return input.value;
    41 }
    42 
    43 function stepDownExplicitBounds(min, max, step, value, stepCount) {
    44     setInputAttributes(min, max, step, value);
    45     if (typeof stepCount !== 'undefined')
    46         input.stepDown(stepCount);
    47     else
    48         input.stepDown();
    49     return input.value;
    50 }
    51 
    52 debug('Date type');
    53 input.type = 'date';
    54 debug('Invalid value');
    55 shouldThrow('stepUp("", null, null)', invalidStateErr);
    56 shouldThrow('stepDown("", null, null)', invalidStateErr);
    57 debug('Non-number arguments');
    58 shouldBe('stepUp("2010-02-10", null, null, "0")', '"2010-02-10"');
    59 shouldBe('stepDown("2010-02-10", null, null, "0")', '"2010-02-10"');
    60 shouldBe('stepUp("2010-02-10", null, null, "foo")', '"2010-02-10"');
    61 shouldBe('stepDown("2010-02-10", null, null, "foo")', '"2010-02-10"');
    62 shouldBe('stepUp("2010-02-10", null, null, null)', '"2010-02-10"');
    63 shouldBe('stepDown("2010-02-10", null, null, null)', '"2010-02-10"');
    64 debug('Normal cases');
    65 shouldBe('stepUp("2010-02-10", null, null)', '"2010-02-11"');
    66 shouldBe('stepDown("2010-02-10", null, null)', '"2010-02-09"');
    67 shouldBe('stepUp("2010-02-10", null, null, 10)', '"2010-02-20"');
    68 shouldBe('stepDown("2010-02-10", null, null, 11)', '"2010-01-30"');
    69 shouldBe('stepUp("1970-01-01", "4", null, 2)', '"1970-01-09"');
    70 shouldBe('stepDown("1970-01-01", "4", null, 3)', '"1969-12-20"');
    71 debug('Step=any');
    72 shouldThrow('stepUp("2010-02-10", "any", null)', invalidStateErr);
    73 shouldThrow('stepDown("2010-02-10", "any", null)', invalidStateErr);
    74 debug('Overflow/underflow');
    75 shouldThrow('stepUp("2010-02-10", "3.40282346e+38", null)', invalidStateErr);
    76 shouldThrow('stepDown("2010-02-10", "3.40282346e+38", null)', invalidStateErr);
    77 shouldThrow('stepUp("2010-02-10", "1", "2010-02-10")', invalidStateErr);
    78 shouldThrow('stepDown("2010-02-10", "1", "2010-02-10")', invalidStateErr);
    79 
    80 debug('');
    81 debug('Datetime type');
    82 input.type = 'datetime';
    83 debug('Invalid value');
    84 shouldThrow('stepUp("", null, null)', invalidStateErr);
    85 shouldThrow('stepDown("", null, null)', invalidStateErr);
    86 debug('Non-number arguments');
    87 shouldBe('stepUp("2010-02-10T20:13Z", null, null, "0")', '"2010-02-10T20:13Z"');
    88 shouldBe('stepDown("2010-02-10T20:13Z", null, null, "0")', '"2010-02-10T20:13Z"');
    89 shouldBe('stepUp("2010-02-10T20:13Z", null, null, "foo")', '"2010-02-10T20:13Z"');
    90 shouldBe('stepDown("2010-02-10T20:13Z", null, null, "foo")', '"2010-02-10T20:13Z"');
    91 shouldBe('stepUp("2010-02-10T20:13Z", null, null, null)', '"2010-02-10T20:13Z"');
    92 shouldBe('stepDown("2010-02-10T20:13Z", null, null, null)', '"2010-02-10T20:13Z"');
    93 debug('Normal cases');
    94 shouldBe('stepUp("2010-02-10T20:13Z", null, null)', '"2010-02-10T20:14Z"');
    95 shouldBe('stepDown("2010-02-10T20:13Z", null, null)', '"2010-02-10T20:12Z"');
    96 shouldBe('stepUp("2010-02-10T20:13Z", null, null, 10)', '"2010-02-10T20:23Z"');
    97 shouldBe('stepDown("2010-02-10T20:13Z", null, null, 11)', '"2010-02-10T20:02Z"');
    98 shouldBe('stepUp("1970-01-01T20:13Z", "4", null, 2)', '"1970-01-01T20:13:08Z"');
    99 shouldBe('stepDown("1970-01-01T20:13Z", "4", null, 3)', '"1970-01-01T20:12:48Z"');
    100 debug('Step=any');
    101 shouldThrow('stepUp("2010-02-10T20:13Z", "any", null)', invalidStateErr);
    102 shouldThrow('stepDown("2010-02-10T20:13Z", "any", null)', invalidStateErr);
    103 debug('Overflow/underflow');
    104 shouldThrow('stepUp("2010-02-10T20:13Z", "3.40282346e+38", null)', invalidStateErr);
    105 shouldThrow('stepDown("2010-02-10T20:13Z", "3.40282346e+38", null)', invalidStateErr);
    106 shouldThrow('stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z")', invalidStateErr);
    107 shouldThrow('stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z")', invalidStateErr);
    108 
    109 debug('');
    110 debug('Datetime-local type');
    111 input.type = 'datetime-local';
    112 debug('Invalid value');
    113 shouldThrow('stepUp("", null, null)', invalidStateErr);
    114 shouldThrow('stepDown("", null, null)', invalidStateErr);
    115 debug('Non-number arguments');
    116 shouldBe('stepUp("2010-02-10T20:13", null, null, "0")', '"2010-02-10T20:13"');
    117 shouldBe('stepDown("2010-02-10T20:13", null, null, "0")', '"2010-02-10T20:13"');
    118 shouldBe('stepUp("2010-02-10T20:13", null, null, "foo")', '"2010-02-10T20:13"');
    119 shouldBe('stepDown("2010-02-10T20:13", null, null, "foo")', '"2010-02-10T20:13"');
    120 shouldBe('stepUp("2010-02-10T20:13", null, null, null)', '"2010-02-10T20:13"');
    121 shouldBe('stepDown("2010-02-10T20:13", null, null, null)', '"2010-02-10T20:13"');
    122 debug('Normal cases');
    123 shouldBe('stepUp("2010-02-10T20:13", null, null)', '"2010-02-10T20:14"');
    124 shouldBe('stepDown("2010-02-10T20:13", null, null)', '"2010-02-10T20:12"');
    125 shouldBe('stepUp("2010-02-10T20:13", null, null, 10)', '"2010-02-10T20:23"');
    126 shouldBe('stepDown("2010-02-10T20:13", null, null, 11)', '"2010-02-10T20:02"');
    127 shouldBe('stepUp("1970-01-01T20:13", "4", null, 2)', '"1970-01-01T20:13:08"');
    128 shouldBe('stepDown("1970-01-01T20:13", "4", null, 3)', '"1970-01-01T20:12:48"');
    129 debug('Step=any');
    130 shouldThrow('stepUp("2010-02-10T20:13", "any", null)', invalidStateErr);
    131 shouldThrow('stepDown("2010-02-10T20:13", "any", null)', invalidStateErr);
    132 debug('Overflow/underflow');
    133 shouldThrow('stepUp("2010-02-10T20:13", "3.40282346e+38", null)', invalidStateErr);
    134 shouldThrow('stepDown("2010-02-10T20:13", "3.40282346e+38", null)', invalidStateErr);
    135 shouldThrow('stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13")', invalidStateErr);
    136 shouldThrow('stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13")', invalidStateErr);
    137 
    138 debug('');
    139 debug('Number type');
    140 input.type = 'number';
    141 debug('Invalid value');
    142 shouldThrow('stepUp("", null, null)', invalidStateErr);
    143 shouldThrow('stepDown("", null, null)', invalidStateErr);
    144 debug('Non-number arguments');
    145 shouldBe('stepUp("0", null, null, "0")', '"0"');
    146 shouldBe('stepDown("0", null, null, "0")', '"0"');
    147 shouldBe('stepUp("0", null, null, "foo")', '"0"');
    148 shouldBe('stepDown("0", null, null, "foo")', '"0"');
    149 shouldBe('stepUp("0", null, null, null)', '"0"');
    150 shouldBe('stepDown("0", null, null, null)', '"0"');
    151 debug('Normal cases');
    152 shouldBe('stepUp("0", null, null)', '"1"');
    153 shouldBe('stepUp("1", null, null, 2)', '"3"');
    154 shouldBe('stepUp("3", null, null, -1)', '"2"');
    155 shouldBe('stepDown("2", null, null)', '"1"');
    156 shouldBe('stepDown("1", null, null, 2)', '"-1"');
    157 shouldBe('stepDown("-1", null, null, -1)', '"0"');
    158 debug('Extra arguments');
    159 shouldBe('input.value = "0"; input.min = null; input.step = null; input.stepUp(1, 2); input.value', '"1"');
    160 shouldBe('input.value = "1"; input.stepDown(1, 3); input.value', '"0"');
    161 debug('Invalid step value');
    162 shouldBe('stepUp("0", "foo", null)', '"1"');
    163 shouldBe('stepUp("1", "0", null)', '"2"');
    164 shouldBe('stepUp("2", "-1", null)', '"3"');
    165 debug('Step=any');
    166 shouldThrow('stepUp("0", "any", null)', invalidStateErr);
    167 shouldThrow('stepDown("0", "any", null)', invalidStateErr);
    168 debug('Step=any corner case');
    169 shouldThrow('stepUpExplicitBounds("0", "100", "any", "1.5", "1")', invalidStateErr);
    170 shouldThrow('stepDownExplicitBounds("0", "100", "any", "1.5", "1")', invalidStateErr);
    171 debug('Overflow/underflow');
    172 shouldBe('stepDown("1", "1", "0")', '"0"');
    173 shouldThrow('stepDown("0", "1", "0")', invalidStateErr);
    174 shouldThrow('stepDown("1", "1", "0", 2)', invalidStateErr);
    175 shouldBe('input.value', '"1"');
    176 shouldThrow('stepDown("1", "3.40282346e+38", "", 2)', invalidStateErr);
    177 shouldBe('stepUp("-1", "1", "0")', '"0"');
    178 shouldThrow('stepUp("0", "1", "0")', invalidStateErr);
    179 shouldThrow('stepUp("-1", "1", "0", 2)', invalidStateErr);
    180 shouldBe('input.value', '"-1"');
    181 shouldThrow('stepUp("1", "3.40282346e+38", "", 2)', invalidStateErr);
    182 debug('stepDown()/stepUp() for stepMismatch values');
    183 shouldBe('stepUp("1", "2", "")', '"3"');
    184 shouldBe('input.stepDown(); input.value', '"1"');
    185 shouldBe('input.min = "0"; stepUp("9", "10", "", 9)', '"99"');
    186 shouldBe('stepDown("19", "10", "0")', '"9"');
    187 shouldBe('stepUp("89", "10", "99")', '"99"');
    188 debug('Huge value and small step');
    189 shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999999)', '"1e+38"');
    190 shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999999)', '"1e+38"');
    191 debug('Fractional numbers');
    192 shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"');
    193 shouldBe('stepUp("1", "0.1", "", 10)', '"2"');
    194 shouldBe('input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value', '"3"');
    195 shouldBe('input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255)', '"1"');
    196 shouldBe('for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value', '"0"');
    197 debug('Rounding');
    198 shouldBe('stepUp("5.005", "0.005", "", 2)', '"5.015"');
    199 shouldBe('stepUp("5.005", "0.005", "", 11)', '"5.06"');
    200 shouldBe('stepUp("5.005", "0.005", "", 12)', '"5.065"');
    201 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 2)', '"5.015"');
    202 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 11)', '"5.06"');
    203 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 12)', '"5.065"');
    204 
    205 debug('');
    206 debug('Range type');
    207 input.type = 'range';
    208 debug('function arguments are (min, max, step, value, [stepCount])');
    209 debug('Using the default values');
    210 shouldBe('stepUpExplicitBounds(null, null, null, "")', '"51"');
    211 shouldBe('stepDownExplicitBounds(null, null, null, "")', '"49"');
    212 debug('Non-number arguments (stepCount)');
    213 shouldBe('stepUpExplicitBounds(null, null, null, "0", "0")', '"0"');
    214 shouldBe('stepDownExplicitBounds(null, null, null, "0", "0")', '"0"');
    215 shouldBe('stepUpExplicitBounds(null, null, null, "0", "foo")', '"0"');
    216 shouldBe('stepDownExplicitBounds(null, null, null, "0", "foo")', '"0"');
    217 shouldBe('stepUpExplicitBounds(null, null, null, "0", null)', '"0"');
    218 shouldBe('stepDownExplicitBounds(null, null, null, "0", null)', '"0"');
    219 debug('Normal cases');
    220 shouldBe('stepUpExplicitBounds(null, null, null, "0")', '"1"');
    221 shouldBe('stepUpExplicitBounds(null, null, null, "1", 2)', '"3"');
    222 shouldBe('stepUpExplicitBounds(null, null, null, "3", -1)', '"2"');
    223 shouldBe('stepDownExplicitBounds("-100", null, null, "2")', '"1"');
    224 shouldBe('stepDownExplicitBounds("-100", null, null, "1", 2)', '"-1"');
    225 shouldBe('stepDownExplicitBounds("-100", null, null, "-1", -1)', '"0"');
    226 debug('Extra arguments');
    227 shouldBe('setInputAttributes(null, null, null, "0"); input.stepUp(1,2); input.value', '"1"');
    228 shouldBe('setInputAttributes(null, null, null, "1"); input.stepDown(1,3); input.value', '"0"');
    229 debug('Invalid step value');
    230 shouldBe('stepUpExplicitBounds(null, null, "foo", "0")', '"1"');
    231 shouldBe('stepUpExplicitBounds(null, null, "0", "1")', '"2"');
    232 shouldBe('stepUpExplicitBounds(null, null, "-1", "2")', '"3"');
    233 shouldBe('stepDownExplicitBounds(null, null, "foo", "1")', '"0"');
    234 shouldBe('stepDownExplicitBounds(null, null, "0", "2")', '"1"');
    235 shouldBe('stepDownExplicitBounds(null, null, "-1", "3")', '"2"');
    236 debug('Step=any');
    237 shouldThrow('stepUpExplicitBounds(null, null, "any", "1")', invalidStateErr);
    238 shouldThrow('stepDownExplicitBounds(null, null, "any", "1")', invalidStateErr);
    239 debug('Overflow/underflow');
    240 shouldBe('stepUpExplicitBounds(null, "100", "1", "99")', '"100"');
    241 shouldThrow('stepUpExplicitBounds(null, "100", "1", "100")', invalidStateErr);
    242 shouldBe('input.value', '"100"');
    243 shouldThrow('stepUpExplicitBounds(null, "100", "1", "99", "2")', invalidStateErr);
    244 shouldBe('input.value', '"99"');
    245 shouldBe('stepDownExplicitBounds("0", null, "1", "1")', '"0"');
    246 shouldThrow('stepDownExplicitBounds("0", null, "1", "0")', invalidStateErr);
    247 shouldBe('input.value', '"0"');
    248 shouldThrow('stepDownExplicitBounds("0", null, "1", "1", "2")', invalidStateErr);
    249 shouldBe('input.value', '"1"');
    250 shouldThrow('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")', invalidStateErr);
    251 shouldBe('stepUpExplicitBounds(-100, 0, 1, -1)', '"0"');
    252 shouldThrow('stepUpExplicitBounds(null, 0, 1, 0)', invalidStateErr);
    253 shouldThrow('stepUpExplicitBounds(-100, 0, 1, -1, 2)', invalidStateErr);
    254 shouldBe('input.value', '"-1"');
    255 shouldThrow('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")', invalidStateErr);
    256 debug('stepDown()/stepUp() for stepMismatch values');
    257 shouldBe('stepUpExplicitBounds(null, null, 2, 1)', '"4"');
    258 shouldBe('input.stepDown(); input.value', '"2"');
    259 shouldBe('stepUpExplicitBounds(0, null, 10, 9, 9)', '"100"');
    260 shouldBe('stepDownExplicitBounds(0, null, 10, 19)', '"10"');
    261 debug('value + step is <= max, but rounded result would be > max.');
    262 shouldThrow('stepUpExplicitBounds(null, 99, 10, 89)', invalidStateErr);
    263 debug('Huge value and small step');
    264 shouldBe('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999)', '"1e+38"');
    265 shouldBe('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999)', '"1e+38"');
    266 debug('Fractional numbers');
    267 shouldBe('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '"1"');
    268 shouldBe('stepUpExplicitBounds(null, null, 0.1, 1)', '"1.1"');
    269 shouldBe('stepUpExplicitBounds(null, null, 0.1, 1, 8)', '"1.8"');
    270 shouldBe('stepUpExplicitBounds(null, null, 0.1, 1, 10)', '"2"');
    271 shouldBe('input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value', '"3"');
    272 shouldBe('stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255)', '"1"');
    273 shouldBe('for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value', '"0"');
    274 shouldBe('stepDownExplicitBounds(null, null, 0.1, 1, 8)', '"0.2"');
    275 shouldBe('stepDownExplicitBounds(null, null, 0.1, 1)', '"0.9"');
    276 
    277 debug('');
    278 debug('Time type');
    27941input.type = 'time';
    28042debug('Invalid value');
     
    30769
    30870debug('');
    309 debug('Unsupported type');
    310 shouldThrow('input.step = "3"; input.min = ""; input.max = ""; input.value = "2"; input.stepDown()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
    311 shouldThrow('input.stepDown(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
    312 shouldThrow('input.stepUp()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
    313 shouldThrow('input.stepUp(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
    314 
    31571var successfullyParsed = true;
     72</script>
     73<script src="../../js/resources/js-test-post.js"></script>
     74</body>
     75</html>
Note: See TracChangeset for help on using the changeset viewer.