OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>ScrollState constructor behaves correctly</title> |
| 6 <script src="../../../resources/testharness.js"></script> |
| 7 <script src="../../../resources/testharnessreport.js"></script> |
| 8 </head> |
| 9 <body> |
| 10 <script> |
| 11 |
| 12 if (!window.internals || !window.internals.runtimeFlags.scrollCustomizationEnabl
ed) { |
| 13 console.log("These tests only work with window.internals exposed, " + |
| 14 "and require scroll customization."); |
| 15 done(); |
| 16 } |
| 17 |
| 18 test(function() { |
| 19 var scrollState = new ScrollState(); |
| 20 assert_equals(scrollState.deltaX, 0); |
| 21 assert_equals(scrollState.deltaY, 0); |
| 22 assert_equals(scrollState.deltaGranularity, 0); |
| 23 assert_equals(scrollState.velocityX, 0); |
| 24 assert_equals(scrollState.velocityY, 0); |
| 25 assert_equals(scrollState.inInertialPhase, false); |
| 26 assert_equals(scrollState.isEnding, false); |
| 27 assert_equals(scrollState.fromUserInput, false); |
| 28 assert_equals(scrollState.shouldPropagate, true); |
| 29 }, "Empty constructor behaves correctly."); |
| 30 |
| 31 test(function() { |
| 32 var deltaX = 12.5; |
| 33 var deltaY = 14.9; |
| 34 var deltaGranularity = 148.3; |
| 35 var velocityX = 23.7; |
| 36 var velocityY = 2.5; |
| 37 var inInertialPhase = true; |
| 38 var isEnding = true; |
| 39 var scrollState = new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, |
| 40 velocityY, inInertialPhase, isEnding); |
| 41 assert_equals(scrollState.deltaX, deltaX); |
| 42 assert_equals(scrollState.deltaY, deltaY); |
| 43 assert_equals(scrollState.deltaGranularity, deltaGranularity); |
| 44 assert_equals(scrollState.velocityX, velocityX); |
| 45 assert_equals(scrollState.velocityY, velocityY); |
| 46 assert_equals(scrollState.inInertialPhase, inInertialPhase); |
| 47 assert_equals(scrollState.isEnding, isEnding); |
| 48 assert_equals(scrollState.fromUserInput, false); |
| 49 assert_equals(scrollState.shouldPropagate, true); |
| 50 }, "Constructor behaves correctly."); |
| 51 |
| 52 test(function() { |
| 53 var scrollState = new ScrollState(); |
| 54 scrollState.fromUserInput = true; |
| 55 assert_equals(scrollState.fromUserInput, false); |
| 56 }, "fromUserInput is read only"); |
| 57 </script> |
| 58 </body> |
| 59 </html> |
OLD | NEW |