OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description('Check stepUp() and stepDown() behavior for number type.'); | 8 description('Check stepUp() and stepDown() behavior for number type.'); |
9 | 9 |
10 var input = document.createElement('input'); | 10 var input = document.createElement('input'); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 debug('Step=any'); | 81 debug('Step=any'); |
82 shouldThrow('stepUp("0", "any", null)'); | 82 shouldThrow('stepUp("0", "any", null)'); |
83 shouldThrow('stepDown("0", "any", null)'); | 83 shouldThrow('stepDown("0", "any", null)'); |
84 debug('Step=any corner case'); | 84 debug('Step=any corner case'); |
85 shouldThrow('stepUpExplicitBounds("0", "100", "any", "1.5", "1")'); | 85 shouldThrow('stepUpExplicitBounds("0", "100", "any", "1.5", "1")'); |
86 shouldThrow('stepDownExplicitBounds("0", "100", "any", "1.5", "1")'); | 86 shouldThrow('stepDownExplicitBounds("0", "100", "any", "1.5", "1")'); |
87 debug('Overflow/underflow'); | 87 debug('Overflow/underflow'); |
88 shouldBe('stepDown("1", "1", "0")', '"0"'); | 88 shouldBe('stepDown("1", "1", "0")', '"0"'); |
89 shouldBeEqualToString('stepDown("0", "1", "0")', '0'); | 89 shouldBeEqualToString('stepDown("0", "1", "0")', '0'); |
90 shouldBeEqualToString('stepDown("1", "1", "0", 2)', '0'); | 90 shouldBeEqualToString('stepDown("1", "1", "0", 2)', '0'); |
91 shouldBeEqualToString('stepDown("1", "3.40282346e+38", "", 2)', '-3.40282346e+38
'); | 91 shouldBeEqualToString('stepDown("1", "1.797693134862315e+308", "", 2)', '-1.7976
93134862315e+308'); |
92 shouldBeEqualToString('stepUp("-1", "1", "0")', '0'); | 92 shouldBeEqualToString('stepUp("-1", "1", "0")', '0'); |
93 shouldBeEqualToString('stepUp("0", "1", "0")', '0'); | 93 shouldBeEqualToString('stepUp("0", "1", "0")', '0'); |
94 shouldBeEqualToString('stepUp("-1", "1", "0", 2)', '0'); | 94 shouldBeEqualToString('stepUp("-1", "1", "0", 2)', '0'); |
95 shouldBeEqualToString('stepUp("1", "3.40282346e+38", "", 2)', '3.40282346e+38'); | 95 shouldBeEqualToString('stepUp("1", "1.797693134862315e+308", "", 2)', '1.7976931
34862315e+308'); |
96 debug('stepDown()/stepUp() for stepMismatch values'); | 96 debug('stepDown()/stepUp() for stepMismatch values'); |
97 shouldBeEqualToString('stepUpExplicitBounds("0", "", "2", "1"); input.value', '2
'); | 97 shouldBeEqualToString('stepUpExplicitBounds("0", "", "2", "1"); input.value', '2
'); |
98 shouldBeEqualToString('stepUp("1", "2", "")', '2'); | 98 shouldBeEqualToString('stepUp("1", "2", "")', '2'); |
99 shouldBeEqualToString('input.stepDown(); input.value', '0'); | 99 shouldBeEqualToString('input.stepDown(); input.value', '0'); |
100 shouldBeEqualToString('input.min = "0"; stepUp("9", "10", "", 9)', '90'); | 100 shouldBeEqualToString('input.min = "0"; stepUp("9", "10", "", 9)', '90'); |
101 shouldBeEqualToString('stepDown("19", "10", "0")', '10'); | 101 shouldBeEqualToString('stepDown("19", "10", "0")', '10'); |
102 shouldBeEqualToString('stepUp("89", "10", "99")', '90'); | 102 shouldBeEqualToString('stepUp("89", "10", "99")', '90'); |
103 debug('Huge value and small step'); | 103 debug('Huge value and small step'); |
104 shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999999)', '"1e+38"'); | 104 shouldBe('input.min = ""; stepUp("1e+308", "1", "", 999999)', '"1e+308"'); |
105 shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999999)', '"1e+38"'); | 105 shouldBe('input.max = ""; stepDown("1e+308", "1", "", 999999)', '"1e+308"'); |
106 debug('Fractional numbers'); | 106 debug('Fractional numbers'); |
107 shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"'); | 107 shouldBe('input.min = ""; stepUp("0", "0.33333333333333333", "", 3)', '"1"'); |
108 shouldBe('stepUp("1", "0.1", "", 10)', '"2"'); | 108 shouldBe('stepUp("1", "0.1", "", 10)', '"2"'); |
109 shouldBe('input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.
stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.
stepUp(); input.value', '"3"'); | 109 shouldBe('input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.
stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.
stepUp(); input.value', '"3"'); |
110 shouldBe('input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255)', '"1"'
); | 110 shouldBe('input.min = "0"; stepUp("0", "0.003921568627450980", "1", 255)', '"1"'
); |
111 shouldBe('for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value', '"0
"'); | 111 shouldBe('for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value', '"0
"'); |
112 debug('Rounding'); | 112 debug('Rounding'); |
113 shouldBe('stepUp("5.005", "0.005", "", 2)', '"5.015"'); | 113 shouldBe('stepUp("5.005", "0.005", "", 2)', '"5.015"'); |
114 shouldBe('stepUp("5.005", "0.005", "", 11)', '"5.06"'); | 114 shouldBe('stepUp("5.005", "0.005", "", 11)', '"5.06"'); |
115 shouldBe('stepUp("5.005", "0.005", "", 12)', '"5.065"'); | 115 shouldBe('stepUp("5.005", "0.005", "", 12)', '"5.065"'); |
116 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 2)', '"5.015"'); | 116 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 2)', '"5.015"'); |
117 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 11)', '"5.06"'); | 117 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 11)', '"5.06"'); |
118 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 12)', '"5.065"'); | 118 shouldBe('stepUpExplicitBounds("4", "9", "0.005", "5.005", 12)', '"5.065"'); |
119 </script> | 119 </script> |
120 </body> | 120 </body> |
121 </html> | 121 </html> |
OLD | NEW |