| Check stepUp() and stepDown() bahevior for number type. |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| Number type |
| |
| Invalid value |
| PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state.. |
| PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state.. |
| |
| Non-number arguments |
| PASS stepUp("0", null, null, "0") is "0" |
| PASS stepDown("0", null, null, "0") is "0" |
| PASS stepUp("0", null, null, "foo") is "0" |
| PASS stepDown("0", null, null, "foo") is "0" |
| PASS stepUp("0", null, null, null) is "0" |
| PASS stepDown("0", null, null, null) is "0" |
| |
| Normal cases |
| PASS stepUp("0", null, null) is "1" |
| PASS stepUp("1", null, null, 2) is "3" |
| PASS stepUp("3", null, null, -1) is "2" |
| PASS stepDown("2", null, null) is "1" |
| PASS stepDown("1", null, null, 2) is "-1" |
| PASS stepDown("-1", null, null, -1) is "0" |
| |
| Fractional cases |
| PASS stepUp("0.1", 1, null) is "1.1" |
| PASS stepUp("0.2", 1, null) is "1.2" |
| PASS stepUp("1.0", 1, null) is "2" |
| PASS stepUp("1.1", 1, null) is "2.1" |
| PASS stepUp("1.2", 1, null) is "2.2" |
| PASS stepUp("2.0", 1, null) is "3" |
| |
| PASS stepUp("-0.1", 1, null) is "0.9" |
| PASS stepUp("-0.2", 1, null) is "0.8" |
| PASS stepUp("-1.0", 1, null) is "0" |
| PASS stepUp("-1.1", 1, null) is "-0.1" |
| PASS stepUp("-1.2", 1, null) is "-0.2" |
| PASS stepUp("-2.0", 1, null) is "-1" |
| |
| PASS stepDown("0.1", 1, null) is "-0.9" |
| PASS stepDown("0.2", 1, null) is "-0.8" |
| PASS stepDown("1.0", 1, null) is "0" |
| PASS stepDown("1.1", 1, null) is "0.1" |
| PASS stepDown("1.2", 1, null) is "0.2" |
| PASS stepDown("2.0", 1, null) is "1" |
| |
| PASS stepDown("-0.1", 1, null) is "-1.1" |
| PASS stepDown("-0.2", 1, null) is "-1.2" |
| PASS stepDown("-1.0", 1, null) is "-2" |
| PASS stepDown("-1.1", 1, null) is "-2.1" |
| PASS stepDown("-1.2", 1, null) is "-2.2" |
| PASS stepDown("-2.0", 1, null) is "-3" |
| |
| PASS stepUp(".1", 1, null) is "1.1" |
| PASS stepUp(".2", 1, null) is "1.2" |
| PASS stepUp("1.", 1, null) is "2" |
| PASS stepUp("2.", 1, null) is "3" |
| |
| PASS stepUp("-.1", 1, null) is "0.9" |
| PASS stepUp("-.2", 1, null) is "0.8" |
| PASS stepUp("-1.", 1, null) is "0" |
| PASS stepUp("-2.", 1, null) is "-1" |
| |
| PASS stepDown(".1", 1, null) is "-0.9" |
| PASS stepDown(".2", 1, null) is "-0.8" |
| PASS stepDown("1.", 1, null) is "0" |
| PASS stepDown("2.", 1, null) is "1" |
| |
| PASS stepDown("-.1", 1, null) is "-1.1" |
| PASS stepDown("-.2", 1, null) is "-1.2" |
| PASS stepDown("-1.", 1, null) is "-2" |
| PASS stepDown("-2.", 1, null) is "-3" |
| |
| PASS stepUp("0.1", .1, null) is "0.2" |
| PASS stepUp("0.2", .1, null) is "0.3" |
| PASS stepUp("1.0", .1, null) is "1.1" |
| PASS stepUp("1.1", .1, null) is "1.2" |
| PASS stepUp("1.2", .1, null) is "1.3" |
| PASS stepUp("2.0", .1, null) is "2.1" |
| |
| PASS stepUp("-0.1", .1, null) is "0" |
| PASS stepUp("-0.2", .1, null) is "-0.1" |
| PASS stepUp("-1.0", .1, null) is "-0.9" |
| PASS stepUp("-1.1", .1, null) is "-1" |
| PASS stepUp("-1.2", .1, null) is "-1.1" |
| PASS stepUp("-2.0", .1, null) is "-1.9" |
| |
| PASS stepDown("0.1", .1, null) is "0" |
| PASS stepDown("0.2", .1, null) is "0.1" |
| PASS stepDown("1.0", .1, null) is "0.9" |
| PASS stepDown("1.1", .1, null) is "1" |
| PASS stepDown("1.2", .1, null) is "1.1" |
| PASS stepDown("2.0", .1, null) is "1.9" |
| |
| PASS stepDown("-0.1", .1, null) is "-0.2" |
| PASS stepDown("-0.2", .1, null) is "-0.3" |
| PASS stepDown("-1.0", .1, null) is "-1.1" |
| PASS stepDown("-1.1", .1, null) is "-1.2" |
| PASS stepDown("-1.2", .1, null) is "-1.3" |
| PASS stepDown("-2.0", .1, null) is "-2.1" |
| |
| PASS stepUp(".1", .1, null) is "0.2" |
| PASS stepUp(".2", .1, null) is "0.3" |
| PASS stepUp("1.", .1, null) is "1.1" |
| PASS stepUp("2.", .1, null) is "2.1" |
| |
| PASS stepUp("-.1", .1, null) is "0" |
| PASS stepUp("-.2", .1, null) is "-0.1" |
| PASS stepUp("-1.", .1, null) is "-0.9" |
| PASS stepUp("-2.", .1, null) is "-1.9" |
| |
| PASS stepDown(".1", .1, null) is "0" |
| PASS stepDown(".2", .1, null) is "0.1" |
| PASS stepDown("1.", .1, null) is "0.9" |
| PASS stepDown("2.", .1, null) is "1.9" |
| |
| PASS stepDown("-.1", .1, null) is "-0.2" |
| PASS stepDown("-.2", .1, null) is "-0.3" |
| PASS stepDown("-1.", .1, null) is "-1.1" |
| PASS stepDown("-2.", .1, null) is "-2.1" |
| |
| Extra arguments |
| PASS input.value = "0"; input.min = null; input.step = null; input.stepUp(1, 2); input.value is "1" |
| PASS input.value = "1"; input.stepDown(1, 3); input.value is "0" |
| |
| Invalid step value |
| PASS stepUp("0", "foo", null) is "1" |
| PASS stepUp("1", "0", null) is "2" |
| PASS stepUp("2", "-1", null) is "3" |
| |
| Step=any |
| PASS stepUp("0", "any", null) threw exception InvalidStateError: The object is in an invalid state.. |
| PASS stepDown("0", "any", null) threw exception InvalidStateError: The object is in an invalid state.. |
| |
| Step=any corner case |
| PASS stepUpExplicitBounds("0", "100", "any", "1.5", "1") threw exception InvalidStateError: The object is in an invalid state.. |
| PASS stepDownExplicitBounds("0", "100", "any", "1.5", "1") threw exception InvalidStateError: The object is in an invalid state.. |
| |
| Overflow/underflow |
| PASS stepDown("1", "1", "0") is "0" |
| PASS stepDown("0", "1", "0") threw exception InvalidStateError: The object is in an invalid state.. |
| PASS stepDown("1", "1", "0", 2) threw exception InvalidStateError: The object is in an invalid state.. |
| PASS input.value is "1" |
| PASS stepDown("1", "3.40282346e+38", "", 2) threw exception InvalidStateError: The object is in an invalid state.. |
| PASS stepUp("-1", "1", "0") is "0" |
| PASS stepUp("0", "1", "0") threw exception InvalidStateError: The object is in an invalid state.. |
| PASS stepUp("-1", "1", "0", 2) threw exception InvalidStateError: The object is in an invalid state.. |
| PASS input.value is "-1" |
| PASS stepUp("1", "3.40282346e+38", "", 2) threw exception InvalidStateError: The object is in an invalid state.. |
| |
| stepDown()/stepUp() for stepMismatch values |
| PASS stepUp("1", "2", "") is "3" |
| PASS input.stepDown(); input.value is "1" |
| PASS input.min = "0"; stepUp("9", "10", "", 9) is "99" |
| PASS stepDown("19", "10", "0") is "9" |
| PASS stepUp("89", "10", "99") is "99" |
| |
| Huge value and small step |
| PASS input.min = ""; stepUp("1e+38", "1", "", 999999) is "1e+38" |
| PASS input.max = ""; stepDown("1e+38", "1", "", 999999) is "1e+38" |
| |
| Fractional numbers |
| PASS input.min = ""; stepUp("0", "0.33333333333333333", "", 3) is "1" |
| PASS stepUp("1", "0.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 input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255) is "1" |
| PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0" |
| |
| Rounding |
| PASS stepUp("5.005", "0.005", "", 2) is "5.015" |
| PASS stepUp("5.005", "0.005", "", 11) is "5.06" |
| PASS stepUp("5.005", "0.005", "", 12) is "5.065" |
| PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 2) is "5.015" |
| PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 11) is "5.06" |
| PASS stepUpExplicitBounds("4", "9", "0.005", "5.005", 12) is "5.065" |
| |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |