browser_rules_edit-property-increments-wheel.js (2152B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that increasing/decreasing values in rule view using 7 // the mouse wheel works correctly. 8 9 const TEST_URI = ` 10 <style> 11 #test { 12 margin-top: 0px; 13 } 14 </style> 15 <div id="test"></div> 16 `; 17 18 add_task(async function () { 19 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 20 21 const { inspector, view } = await openRuleView(); 22 await selectNode("#test", inspector); 23 24 info("Testing wheel increments on the margin property"); 25 26 const marginPropEditor = getTextProperty(view, 1, { 27 "margin-top": "0px", 28 }).editor; 29 30 await runWheelIncrementTest(marginPropEditor, view, { horizontal: false }); 31 await runWheelIncrementTest(marginPropEditor, view, { horizontal: true }); 32 }); 33 34 function runWheelIncrementTest(marginPropEditor, view, { horizontal }) { 35 const wheelDelta = horizontal ? "deltaX" : "deltaY"; 36 return runIncrementTest(marginPropEditor, view, { 37 1: { 38 wheel: true, 39 [wheelDelta]: -1, 40 ...getSmallIncrementKey(), 41 start: "0px", 42 end: "0.1px", 43 selectAll: true, 44 }, 45 2: { 46 wheel: true, 47 [wheelDelta]: -1, 48 start: "0px", 49 end: "1px", 50 selectAll: true, 51 }, 52 3: { 53 wheel: true, 54 [wheelDelta]: -1, 55 shift: true, 56 start: "0px", 57 end: "10px", 58 selectAll: true, 59 }, 60 4: { 61 wheel: true, 62 [wheelDelta]: 1, 63 ...getSmallIncrementKey(), 64 start: "0.1px", 65 end: "0px", 66 selectAll: true, 67 }, 68 5: { 69 wheel: true, 70 [wheelDelta]: 1, 71 down: true, 72 start: "0px", 73 end: "-1px", 74 selectAll: true, 75 }, 76 6: { 77 wheel: true, 78 [wheelDelta]: 1, 79 down: true, 80 shift: true, 81 start: "0px", 82 end: "-10px", 83 selectAll: true, 84 }, 85 7: { 86 wheel: true, 87 [wheelDelta]: -1, 88 start: "0", 89 end: "1px", 90 selectAll: true, 91 }, 92 8: { 93 wheel: true, 94 [wheelDelta]: 1, 95 down: true, 96 start: "0", 97 end: "-1px", 98 selectAll: true, 99 }, 100 }); 101 }