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

Unified Diff: LayoutTests/fast/dom/custom/callbacks-upgrade.html

Issue 17707002: Implement Custom Elements inserted and removed callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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: LayoutTests/fast/dom/custom/callbacks-upgrade.html
diff --git a/LayoutTests/fast/dom/custom/callbacks-upgrade.html b/LayoutTests/fast/dom/custom/callbacks-upgrade.html
new file mode 100644
index 0000000000000000000000000000000000000000..aa4d65fe106490d6564ecb3c67db6b283d405141
--- /dev/null
+++ b/LayoutTests/fast/dom/custom/callbacks-upgrade.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<body>
+<x-a id="a"></x-a>
+<x-a id="b"></x-a>
+<x-a id="c"></x-a>
+<script>
+test(function () {
+ var b = document.querySelector('#b');
+ b.remove();
+
+ var calls = [];
+
+ var proto = Object.create(HTMLElement.prototype);
+ proto.readyCallback = function () {
+ calls.push(this.id + ' ready');
+ };
+ proto.insertedCallback = function () {
+ calls.push(this.id + ' inserted');
+ };
+ proto.removedCallback = function () {}
+
+ var ctor = document.register('x-a', {prototype: proto});
+
+ // FIXME: Simplify this after
+ // <https://www.w3.org/Bugs/Public/show_bug.cgi?id=22455> is fixed.
+ var call_set = calls.slice();
+ call_set.sort();
+ assert_array_equals(call_set, ['a inserted', 'a ready', 'b ready', 'c inserted', 'c ready'], 'the callbacks should have been invoked during registration');
+
+ for (var i = 0; i < calls.length; i++) {
+ switch (calls[i]) {
+ case 'a ready':
+ assert_equals(calls[i + 1], 'a inserted');
+ break;
+ case 'c ready':
+ assert_equals(calls[i + 1], 'c inserted');
+ break;
+ }
+ }
+}, 'element upgrade callbacks');
+</script>

Powered by Google App Engine
This is Rietveld 408576698