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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html

Issue 2144993002: CustomElements: insert a node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor linebreak change Created 4 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html b/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html
index bfc2cc2887d536719fc03b343de07bc84e75e8dc..9070ad276067396d776352aa926acb147a40b671 100644
--- a/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html
@@ -7,8 +7,28 @@
<script>
'use strict';
+function assert_invocations(invocations, element, length, i) {
+ assert_equals(invocations.length, length, length == 2 ? 'inserting into different node should enqueue connectedCallback again' : 'inserting an element should enqueue connectedCallback reaction');
+ assert_array_equals(invocations[i].slice(0, 2), ['connected', element], 'inserting "custom" element should enqueue a connectedCallback reaction');
+ assert_array_equals(invocations[i][2], [], 'connectedCallback should be invoked with empty argument list');
+}
+
// Insert a node
// https://dom.spec.whatwg.org/#concept-node-insert
+// 6.5.2.1 If inclusiveDescendant is custom, then enqueue a custom element callback reaction
+// with inclusiveDescendant, callback name "connectedCallback", and an empty argument list.
+test_with_window(w => {
+ let element = w.document.createElement('a-a');
+ let invocations = [];
+ w.customElements.define('a-a', class extends w.HTMLElement {
+ connectedCallback() { invocations.push(['connected', this, arguments]); }
+ });
+ w.document.body.appendChild(element);
+ assert_invocations(invocations, element, 1, 0);
+ w.document.head.appendChild(element);
+ assert_invocations(invocations, element, 2, 1);
+}, 'Insert a node that is "custom" should enqueue connectedCallback');
+
// 6.5.2.2. try to upgrade inclusiveDescendant.
// Try to upgrade an element
// https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade
@@ -29,4 +49,4 @@ test_with_window(w => {
assert_true(element.matches(':defined'));
}, 'Insert a node should try to upgrade');
</script>
-</body>
+</body>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698