Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
|
yosin_UTC9
2016/05/09 03:43:50
Could you use w3c test harness?
Here is an example
| |
| 2 <body> | |
| 3 This tests queryCommandState. | |
| 4 <p> | |
| 5 <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=584939">Bug 58493 9</a> | |
| 6 </p> | |
| 7 <div contenteditable="true"> | |
| 8 <img src="../resources/abe.png"> | |
| 9 </div> | |
| 10 <ul id="console"></ul> | |
| 11 | |
| 12 <script type="text/javascript"> | |
| 13 | |
| 14 if (window.testRunner) { | |
| 15 testRunner.dumpAsText(); | |
| 16 } | |
| 17 | |
| 18 document.getSelection().removeAllRanges(); | |
| 19 var range = document.createRange(); | |
| 20 range.selectNode(document.querySelector('img')); | |
| 21 document.getSelection().addRange(range); | |
| 22 | |
| 23 assert(!document.queryCommandState('bold')); | |
| 24 assert(!document.queryCommandState('italic')); | |
| 25 assert(!document.queryCommandState('underline')); | |
| 26 assert(!document.queryCommandState('strikethrough')); | |
| 27 | |
| 28 function log(str) { | |
| 29 var li = document.createElement("li"); | |
| 30 li.appendChild(document.createTextNode(str)); | |
| 31 var console = document.getElementById("console"); | |
| 32 console.appendChild(li); | |
| 33 } | |
| 34 | |
| 35 function assert(bool) { | |
| 36 if (!bool) | |
| 37 log("Failure"); | |
| 38 else | |
| 39 log("Success"); | |
| 40 } | |
| 41 </script> | |
| 42 | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |