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

Unified Diff: LayoutTests/fast/dom/custom/inherited-prototype.html

Issue 1097243002: [Reland] Implement Custom Element's class side inheritance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Nits Created 5 years, 8 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/inherited-prototype.html
diff --git a/LayoutTests/fast/dom/custom/inherited-prototype.html b/LayoutTests/fast/dom/custom/inherited-prototype.html
new file mode 100644
index 0000000000000000000000000000000000000000..c95f4769b7fc6b306863e43f6d561e92519c4f23
--- /dev/null
+++ b/LayoutTests/fast/dom/custom/inherited-prototype.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<body>
+<script>
+test(function () {
+ var protoA = Object.create(HTMLDivElement.prototype);
+ var A = document.registerElement('x-a', {
+ extends: 'div', prototype: protoA});
+
+ assert_equals(
+ Object.getPrototypeOf(A), HTMLDivElement,
+ 'generated constructor prototype should be base element constructor ' +
+ '(extend built-in element)');
+
+ assert_equals(
+ A.__proto__, HTMLDivElement,
+ 'Internal prototype should also be base element function object ' +
+ '(extend built-in element)');
+
+ assert_equals(
+ A.prototype.__proto__, HTMLDivElement.prototype,
+ 'Internal prototype of generated constructor prototype should be ' +
+ 'prototype of base element function object (extend built-in element)');
+
+ var protoB = Object.create(protoA);
+ var B = document.registerElement('x-b', {prototype: protoB});
+ assert_equals(
+ Object.getPrototypeOf(B), A,
+ 'generated constructor prototype should be base element constructor ' +
+ '(extend Custom Element)');
+
+ assert_equals(
+ B.__proto__, A,
+ 'Internal prototype should also be base element function object ' +
+ '(extend Custom Element)');
+
+ assert_equals(
+ B.prototype.__proto__, A.prototype,
+ 'Internal prototype of generated constructor prototype should be ' +
+ 'prototype of base element function object (extend Custom Element)');
+}, 'generated constructor prototype property');
+</script>

Powered by Google App Engine
This is Rietveld 408576698