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

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: dominicc nits 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..02522ede788f2949584de047da09629681808da5
--- /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 contenteditable');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698