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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html

Issue 2170383002: CustomElements: adopt node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adoptedCallback should be enqueued when doc is different from oldDocument 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
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>

Powered by Google App Engine
This is Rietveld 408576698