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

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

Issue 2442223003: Make createElement tag name case handling consistent for custom elements (Closed)
Patch Set: Created 4 years, 2 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: third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
index b135c127ed9b512de280c2dbaee7b59f434bfb54..426340a687a8105babaa1fc3d088f7db4ce3ed96 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
@@ -7,6 +7,9 @@
#include "core/HTMLNames.h"
#include "core/SVGNames.h"
#include "core/dom/Document.h"
+#include "core/dom/custom/CustomElementDefinition.h"
+#include "core/dom/custom/CustomElementRegistry.h"
+#include "core/dom/custom/CustomElementTestHelpers.h"
#include "core/html/HTMLElement.h"
#include "core/testing/DummyPageHolder.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -201,4 +204,29 @@ TEST(CustomElementTest, StateByCreateElement) {
}
}
+TEST(CustomElementTest,
+ CreateElement_TagNameCaseHandlingCreatingCustomElement) {
+ // register a definition
+ std::unique_ptr<DummyPageHolder> holder(DummyPageHolder::create());
+ CustomElementRegistry* registry =
+ holder->frame().localDOMWindow()->customElements();
+ NonThrowableExceptionState shouldNotThrow;
+ {
+ CEReactionsScope reactions;
+ TestCustomElementDefinitionBuilder builder;
+ registry->define("a-a", builder, ElementDefinitionOptions(),
+ shouldNotThrow);
+ }
+ CustomElementDefinition* definition =
+ registry->definitionFor(CustomElementDescriptor("a-a", "a-a"));
+ EXPECT_NE(nullptr, definition) << "a-a should be registered";
+
+ // create an element with an uppercase tag name
+ Document& document = holder->document();
+ EXPECT_TRUE(document.isHTMLDocument())
+ << "this test requires a HTML document";
+ Element* element = document.createElement("A-A", shouldNotThrow);
+ EXPECT_EQ(definition, element->customElementDefinition());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698