OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <span inert id="not-editable" contenteditable>I'm not editable.</span> |
| 9 <span id="editable" contenteditable>I'm editable.</span> |
| 10 <script> |
| 11 function clickOn(element) |
| 12 { |
| 13 return new Promise(function(resolve, reject) { |
| 14 if (!window.eventSender) |
| 15 reject(); |
| 16 |
| 17 var absoluteTop = 0; |
| 18 var absoluteLeft = 0; |
| 19 for (var parentNode = element; parentNode; parentNode = parentNode.offse
tParent) { |
| 20 absoluteLeft += parentNode.offsetLeft; |
| 21 absoluteTop += parentNode.offsetTop; |
| 22 } |
| 23 |
| 24 var x = absoluteLeft + element.offsetWidth / 2; |
| 25 var y = absoluteTop + element.offsetHeight / 2; |
| 26 var pointerActions = [{ |
| 27 source: "mouse", |
| 28 actions: [ |
| 29 { name: "pointerMove", x: x, y: y }, |
| 30 { name: "pointerDown", x: x, y: x }, |
| 31 { name: "pointerUp" }, |
| 32 { name: "pointerMove", x: 0, y: 0} |
| 33 ] |
| 34 }]; |
| 35 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve); |
| 36 }); |
| 37 } |
| 38 |
| 39 notEditable = document.querySelector('#not-editable'); |
| 40 editable = document.querySelector('#editable'); |
| 41 |
| 42 test(function() { |
| 43 clickOn(notEditable).then(() => { |
| 44 oldValue = notEditable.textContent; |
| 45 eventSender.keyDown('a'); |
| 46 assert_equals(notEditable.textContent, oldValue); |
| 47 }); |
| 48 }, "Can't edit inert contenteditable"); |
| 49 |
| 50 test(function() { |
| 51 clickOn(editable).then(() => { |
| 52 oldValue = editable.textContent; |
| 53 eventSender.keyDown('a'); |
| 54 assert_not_equals(editable.textContent, oldValue); |
| 55 }); |
| 56 }, "Can edit non-inert contenteditable"); |
| 57 |
| 58 </script> |
| 59 </body> |
| 60 </html> |
OLD | NEW |