Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/clone-contenteditable.html

Issue 2097463002: Add backup element queue to CustomElementReactionStack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/custom-elements/clone-contenteditable.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/clone-contenteditable.html b/third_party/WebKit/LayoutTests/custom-elements/clone-contenteditable.html
new file mode 100644
index 0000000000000000000000000000000000000000..e0cd7c0e4a2f17c15cb7a4151c859703a4624900
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-elements/clone-contenteditable.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=editor contenteditable><x-x>aa</x-x></div>
+<script>
+'use strict';
+
+promise_test(function () {
+ let constructCount = 0;
+ customElements.define('x-x', class extends HTMLElement {
+ constructor() {
+ super();
+ constructCount++;
+ }
+ });
+
+ assert_equals(constructCount, 1, 'define() should run constructor');
+
+ let element = editor.firstElementChild;
+ element.focus();
+ let selection = getSelection();
+ selection.collapse(element.firstChild, 1);
+
+ eventSender.keyDown('\r');
+
+ // Backup queue runs in a microtask, so schedule the assertions after that.
+ return new Promise(resolve => {
+ resolve();
+ }).then(() => {
+ assert_equals(document.getElementsByTagName('x-x').length, 2, 'Enter key should clone the element');
+ assert_equals(constructCount, 2, 'clone should run constructor');
+ });
+}, 'clone-a-node in contentedtiable');
+</script>

Powered by Google App Engine
This is Rietveld 408576698