Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <div id=editor contenteditable><x-x>aa</x-x></div> | |
| 5 <script> | |
| 6 'use strict'; | |
| 7 | |
| 8 promise_test(function () { | |
| 9 let constructCount = 0; | |
| 10 customElements.define('x-x', class extends HTMLElement { | |
| 11 constructor() { | |
| 12 super(); | |
| 13 constructCount++; | |
| 14 } | |
| 15 }); | |
| 16 | |
| 17 assert_equals(constructCount, 1, 'define() should run constructor'); | |
| 18 | |
| 19 let element = editor.firstElementChild; | |
| 20 element.focus(); | |
| 21 let selection = getSelection(); | |
| 22 selection.collapse(element.firstChild, 1); | |
| 23 | |
| 24 eventSender.keyDown('\r'); | |
| 25 | |
| 26 // Backup queue runs in a microtask, so schedule the assertions after that. | |
| 27 return new Promise(resolve => { | |
| 28 resolve(); | |
| 29 }).then(() => { | |
| 30 assert_equals(document.getElementsByTagName('x-x').length, 2, 'Enter key sho uld clone the element'); | |
| 31 assert_equals(constructCount, 2, 'clone should run constructor'); | |
| 32 }); | |
| 33 }, 'clone-a-node in contentedtiable'); | |
|
dominicc (has gone to gerrit)
2016/06/29 07:19:54
spelling, editable
| |
| 34 </script> | |
| OLD | NEW |