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

Unified Diff: LayoutTests/fast/dom/custom/transfer-callbacks.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/transfer-callbacks.html
diff --git a/LayoutTests/fast/dom/custom/transfer-callbacks.html b/LayoutTests/fast/dom/custom/transfer-callbacks.html
new file mode 100644
index 0000000000000000000000000000000000000000..4a2af92e2164f24093661f033f029771cfc0245c
--- /dev/null
+++ b/LayoutTests/fast/dom/custom/transfer-callbacks.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<body>
+<script>
+t = async_test('transfer callbacks');
+t.gets = [];
+t.calls = [];
+
+t.step(function () {
+ function getter(name) {
+ return function () {
+ t.gets.push(name);
+ return function () {
+ t.calls.push(name);
+ };
+ };
+ }
+
+ var proto = Object.create(HTMLElement.prototype, {
+ insertedCallback: {
+ get: getter('inserted')
+ },
+ readyCallback: {
+ get: getter('ready')
+ },
+ removedCallback: {
+ get: getter('removed')
+ }
+ });
+
+ var ctor = document.register('x-a', {prototype: proto});
+ assert_array_equals(t.gets, ['ready', 'inserted', 'removed'], 'the callbacks must have been retrieved in the correct order');
+
+ function failer() {
+ assert_unreached('the callbacks must not be retrieved after registration');
+ }
+ proto.readyCallback = proto.insertedCallback = proto.removedCallback = failer;
+
+ var element = new ctor();
+ document.body.appendChild(element);
+ element.remove();
+});
+</script>
+<script>
+t.step(function () {
+ assert_array_equals(t.calls, ['ready', 'inserted', 'removed'], 'the retrieved callbacks should have been invoked');
+ t.done();
+ t = null;
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698