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..170fe7ec55c3c5820ff86dda0de0d9aa512f9d51 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html |
@@ -0,0 +1,34 @@ |
+<!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> |
+ |
dominicc (has gone to gerrit)
2016/07/25 07:56:14
Delete this blank line. You could separate use str
|
+'use strict' |
+// 3. If document is not the same as the oldDocument: |
dominicc (has gone to gerrit)
2016/07/25 07:56:14
Could we add tests for what happens to exceptions
|
+// 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 frame = doc.createElement('iframe'); |
dominicc (has gone to gerrit)
2016/07/25 07:56:13
Look at how test_with_window is implemented and do
|
+ doc.body.appendChild(frame); |
+ let iframeWindow = frame.contentWindow; |
+ let iframeDoc = iframeWindow.document; |
+ let a = iframeDoc.createElement('a-a'); |
+ iframeDoc.body.appendChild(a); |
+ class X extends iframeWindow.HTMLElement { |
dominicc (has gone to gerrit)
2016/07/25 07:56:13
Be consistent with naming; w is an iframe window t
|
+ constructor() { super(); } |
dominicc (has gone to gerrit)
2016/07/25 07:56:13
Again--the implicit one is all you need; you can o
davaajav
2016/08/02 07:21:20
Omitting super(); was resulting in "this" being un
|
+ adoptedCallback() { invocations.push(['adopted', this, arguments]); } |
+ } |
+ iframeWindow.customElements.define('a-a', X); |
+ doc.adoptNode(a); |
+ let expected_invocations = [ ['adopted', a, []] ]; |
+ assert_array_equals_callback_invocations(invocations, expected_invocations); |
+}, 'adopting a custom element to the same document should enqueue an adoptedCallback reaction'); |
dominicc (has gone to gerrit)
2016/07/25 07:56:14
It might be worth adding a test that adopting or m
|
+</script> |
+</body> |