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

Unified Diff: LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 years, 3 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/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html
diff --git a/LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html b/LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html
new file mode 100644
index 0000000000000000000000000000000000000000..6ad8fcd1b53fc755569f1e59eb202d07adedf929
--- /dev/null
+++ b/LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Document, created with createHTMLDocument or createDocument with HTML namespace, should share registry with the associated document</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="When DOMImplementation's createDocument method is invoked with namespace set to HTML Namespace or when the createHTMLDocument method is invoked, use the registry of the associated document to the new instance.">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passing-registries">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+<link rel="stylesheet" href="../../../../resources/testharness.css">
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-frame';
+
+ var GeneratedConstructor = doc.registerElement(name);
+ var doc2 = doc.implementation.createHTMLDocument('Document 2');
+ assert_throws(
+ 'NotSupportedError',
+ function() { doc2.registerElement(name); },
+ 'Registering a custom element type name that is already registered in a shared ' +
+ 'registry should throw an exception');
+
+ var xframe = doc2.createElement(name);
+ assert_true(xframe instanceof GeneratedConstructor,
+ 'Created element should be x-frame instance');
+}, 'Document created by createHTMLDocument should share an existing registry');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-frame-1';
+
+ var GeneratedConstructor = doc.registerElement(name);
+ var doc2 = doc.implementation.createDocument(HTML_NAMESPACE, 'html', null);
+ assert_throws(
+ 'NotSupportedError',
+ function() { doc2.registerElement(name); },
+ 'Exception should be thrown for custom element, ' +
+ 'which is already registered in shared registry');
+
+ var xframe = doc2.createElement(name);
+ assert_true(xframe instanceof GeneratedConstructor,
+ 'Created element should be x-frame instance');
+}, 'Document created by createDocument with HTML namespace should share an existing registry');
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698