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..80bd4a7b9a39bc4ba34274416e4741d640e5d6f5 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 |
@@ -9,6 +9,27 @@ |
// 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 = []; |
+ let connectedCallback_args; |
+ w.customElements.define('a-a', class extends w.HTMLElement { |
+ constructor() { super(); } |
dominicc (has gone to gerrit)
2016/07/13 06:19:06
You can omit this line; I think an ES6 class gets
|
+ connectedCallback() { |
+ invocations.push(['connected', this]); |
+ connectedCallback_args = arguments; |
+ } |
+ }); |
+ w.document.body.appendChild(element); |
+ assert_true(element.matches(':defined')); |
+ w.document.body.appendChild(element); |
+ assert_equals(invocations.length, 1, 'connectedCallback should be invoked only once'); |
dominicc (has gone to gerrit)
2016/07/13 06:19:05
Could you also assert the length is 1 before line
|
+ assert_array_equals(invocations[0], ['connected', element], 'insierting "custom" element should enqueue a connectedCallback reaction'); |
dominicc (has gone to gerrit)
2016/07/13 06:19:05
Spelling--inserting
|
+ assert_array_equals(connectedCallback_args, [], 'connectedCallback should be invoked with empty argument list'); |
+}, '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 |