Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html |
| diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html b/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d6980baedf7a097432268f5093f2c1bb9801f678 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html |
| @@ -0,0 +1,30 @@ |
| +<!DOCTYPE html> |
| +<title>Custom Elements: adopt node</title> |
| +<link rel="help" href="https://dom.spec.whatwg.org/#concept-node-adopt"> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="resources/custom-elements-helpers.js"></script> |
| +<body> |
| +<script> |
| + |
| +'use strict' |
| +// 3.2 For each inclusiveDescendant in node’s shadow-including inclusive descendants that is a custom |
| +// element, enqueue a custom element callback reaction with inclusiveDescendant, |
| +// callback name "adoptedCallback", and an empty argument list. |
| +test_with_window((w) => { |
| + let invocations = []; |
| + let doc = w.document; |
| + let a = doc.createElement('a-a'); |
| + doc.body.appendChild(a); |
| + class X extends w.HTMLElement { |
| + constructor() {} |
| + adoptedCallback() { invocations.push(['adopted', this, arguments]); } |
| + } |
| + w.customElements.define('a-a', X); |
| + doc.adoptNode(a); |
| + assert_equals(invocations.length, 1); |
|
dominicc (has gone to gerrit)
2016/07/22 09:07:58
We're writing a lot of things which push records i
|
| + assert_array_equals(invocations[0].slice(0,2), ['adopted', a], 'the adoptedCallback should be invoked'); |
|
dominicc (has gone to gerrit)
2016/07/22 09:07:58
space after ,
|
| + assert_array_equals(invocations[0][0], [], 'the adoptedCallback should be invoked with empty argumnets'); |
|
dominicc (has gone to gerrit)
2016/07/22 09:07:58
spelling: arguments
|
| +}, 'adopting a custom element to the same document should enqueue an adoptedCallback reaction'); |
| +</script> |
| +</body> |