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

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp

Issue 2446903008: Custom Elements: Lookup custom element definition algorithm (Closed)
Patch Set: Patch Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp
index 4f918bb548d08c0c2ca0a1f401b2f66d00685e72..defad7588d2f02fa5d3ceb69cd681781d3c529f3 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp
@@ -414,6 +414,32 @@ TEST_F(CustomElementRegistryTest, adoptedCallback) {
<< "adoptNode() should not invoke other callbacks";
}
+TEST_F(CustomElementRegistryTest, lookupCustomElementDefinition) {
+ NonThrowableExceptionState shouldNotThrow;
+ TestCustomElementDefinitionBuilder builder;
+ CustomElementDefinition* definitionA = registry().define(
+ "a-a", builder, ElementDefinitionOptions(), shouldNotThrow);
+ ElementDefinitionOptions options;
+ options.setExtends("div");
+ CustomElementDefinition* definitionB =
+ registry().define("b-b", builder, options, shouldNotThrow);
+ // look up defined autonomous custom element
+ CustomElementDefinition* definition = registry().definitionFor(
+ CustomElementDescriptor(CustomElementDescriptor("a-a", "a-a")));
+ EXPECT_NE(nullptr, definition) << "a-a, a-a should be registered";
+ EXPECT_EQ(definitionA, definition);
+ // look up undefined autonomous custom element
+ definition = registry().definitionFor(CustomElementDescriptor("a-a", "div"));
+ EXPECT_EQ(nullptr, definition) << "a-a, div should not be registered";
+ // look up defined customized built-in element
+ definition = registry().definitionFor(CustomElementDescriptor("b-b", "div"));
+ EXPECT_NE(nullptr, definition) << "b-b, div should be registered";
+ EXPECT_EQ(definitionB, definition);
+ // look up undefined customized built-in element
+ definition = registry().definitionFor(CustomElementDescriptor("a-a", "div"));
+ EXPECT_EQ(nullptr, definition) << "a-a, div should not be registered";
+}
+
// TODO(dominicc): Add tests which adjust the "is" attribute when type
// extensions are implemented.
« no previous file with comments | « third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698