blob: de61fe18e56c26081d8b5f0411a91394869e895a [file] [log] [blame]
Check stepUp() and stepDown() behavior for range type.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
function arguments are (min, max, step, value, [stepCount])
Using the default values
PASS stepUpExplicitBounds(null, null, null, "") is "51"
PASS stepDownExplicitBounds(null, null, null, "") is "49"
Non-number arguments (stepCount)
PASS stepUpExplicitBounds(null, null, null, "0", "0") is "0"
PASS stepDownExplicitBounds(null, null, null, "0", "0") is "0"
PASS stepUpExplicitBounds(null, null, null, "0", "foo") is "0"
PASS stepDownExplicitBounds(null, null, null, "0", "foo") is "0"
PASS stepUpExplicitBounds(null, null, null, "0", null) is "0"
PASS stepDownExplicitBounds(null, null, null, "0", null) is "0"
Normal cases
PASS stepUpExplicitBounds(null, null, null, "0") is "1"
PASS stepUpExplicitBounds(null, null, null, "1", 2) is "3"
PASS stepUpExplicitBounds(null, null, null, "3", -1) is "2"
PASS stepDownExplicitBounds("-100", null, null, "2") is "1"
PASS stepDownExplicitBounds("-100", null, null, "1", 2) is "-1"
PASS stepDownExplicitBounds("-100", null, null, "-1", -1) is "0"
Extra arguments
PASS setInputAttributes(null, null, null, "0"); input.stepUp(1,2); input.value is "1"
PASS setInputAttributes(null, null, null, "1"); input.stepDown(1,3); input.value is "0"
Invalid step value
PASS stepUpExplicitBounds(null, null, "foo", "0") is "1"
PASS stepUpExplicitBounds(null, null, "0", "1") is "2"
PASS stepUpExplicitBounds(null, null, "-1", "2") is "3"
PASS stepDownExplicitBounds(null, null, "foo", "1") is "0"
PASS stepDownExplicitBounds(null, null, "0", "2") is "1"
PASS stepDownExplicitBounds(null, null, "-1", "3") is "2"
Step bases
PASS createInputWithContentAttributes(0, 100, "20", "50"); input.value is "60"
PASS createInputWithContentAttributes(null, null, "50", "25"); input.value is "25"
PASS createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(1); input.value is "75"
PASS createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(1); input.stepDown(1); input.value is "25"
PASS createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(2); input.stepDown(2); input.value is "25"
PASS createInputWithContentAttributes(null, null, "7", "22"); input.stepUp(40); input.value is "99"
Step=any
PASS stepUpExplicitBounds(null, null, "any", "1") threw exception InvalidStateError: Failed to execute 'stepUp' on 'HTMLInputElement': This form element does not have an allowed value step..
PASS stepDownExplicitBounds(null, null, "any", "1") threw exception InvalidStateError: Failed to execute 'stepDown' on 'HTMLInputElement': This form element does not have an allowed value step..
Overflow/underflow
PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
PASS stepUpExplicitBounds(null, "100", "1", "100") is "100"
PASS stepUpExplicitBounds(null, "100", "1", "99", "2") is "100"
PASS stepDownExplicitBounds("0", null, "1", "1") is "0"
PASS stepDownExplicitBounds("0", null, "1", "0") is "0"
PASS stepDownExplicitBounds("0", null, "1", "1", "2") is "0"
PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2") is "0"
PASS stepUpExplicitBounds(-100, 0, 1, -1) is "0"
PASS stepUpExplicitBounds(null, 0, 1, 0) is "0"
PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) is "0"
PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") is "0"
stepDown()/stepUp() for stepMismatch values
PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
PASS input.stepDown(); input.value is "2"
PASS stepUpExplicitBounds(0, null, 10, 9, 9) is "100"
PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
value + step is <= max, but rounded result would be > max.
PASS stepUpExplicitBounds(null, 99, 10, 89) is "90"
PASS stepUpExplicitBounds(null, 99, 10, 89, 21) is "90"
PASS stepUpExplicitBounds(null, 99, 10, 77, 2) is "90"
Huge value and small step
PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
Fractional numbers
PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
PASS stepUpExplicitBounds(null, null, 0.1, 1) is "1.1"
PASS stepUpExplicitBounds(null, null, 0.1, 1, 8) is "1.8"
PASS stepUpExplicitBounds(null, null, 0.1, 1, 10) is "2"
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"
PASS stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255) is "1"
PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0"
PASS stepDownExplicitBounds(null, null, 0.1, 1, 8) is "0.2"
PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
PASS successfullyParsed is true
TEST COMPLETE