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

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

Issue 1914383002: Implement CustomElement::isValidName() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PCENChar
Patch Set: Rebase Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/custom/CustomElement.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/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 720b5c1247bc1028c15d8edc8e80eea3a12befdc..7f47cd6735fd9502b9eee3878bfe94629eacd77b 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
@@ -11,11 +11,11 @@ namespace blink {
static void testIsPotentialCustomElementName(const AtomicString& str, bool expected)
{
if (expected) {
- EXPECT_TRUE(CustomElement::isPotentialCustomElementName(str))
- << str << " should be PotentialCustomElementName.";
+ EXPECT_TRUE(CustomElement::isValidName(str))
+ << str << " should be a valid custom element name.";
} else {
- EXPECT_FALSE(CustomElement::isPotentialCustomElementName(str))
- << str << " should NOT be PotentialCustomElementName.";
+ EXPECT_FALSE(CustomElement::isValidName(str))
+ << str << " should NOT be a valid custom element name.";
}
}
@@ -36,7 +36,7 @@ static void testIsPotentialCustomElementNameChar(UChar32 c, bool expected)
testIsPotentialCustomElementName(str, expected);
}
-TEST(CustomElementTest, TestIsPotentialCustomElementName)
+TEST(CustomElementTest, TestIsValidNamePotentialCustomElementName)
{
struct {
bool expected;
@@ -63,7 +63,7 @@ TEST(CustomElementTest, TestIsPotentialCustomElementName)
testIsPotentialCustomElementName(test.str, test.expected);
}
-TEST(CustomElementTest, TestIsPotentialCustomElementNameChar)
+TEST(CustomElementTest, TestIsValidNamePotentialCustomElementNameChar)
{
struct {
UChar32 from, to;
@@ -94,7 +94,7 @@ TEST(CustomElementTest, TestIsPotentialCustomElementNameChar)
}
}
-TEST(CustomElementTest, TestIsPotentialCustomElementNameCharFalse)
+TEST(CustomElementTest, TestIsValidNamePotentialCustomElementNameCharFalse)
{
struct {
UChar32 from, to;
@@ -107,4 +107,18 @@ TEST(CustomElementTest, TestIsPotentialCustomElementNameCharFalse)
}
}
+TEST(CustomElementTest, TestIsValidNameHyphenContainingElementNames)
+{
+ EXPECT_TRUE(CustomElement::isValidName("valid-name"));
+
+ EXPECT_FALSE(CustomElement::isValidName("annotation-xml"));
+ EXPECT_FALSE(CustomElement::isValidName("color-profile"));
+ EXPECT_FALSE(CustomElement::isValidName("font-face"));
+ EXPECT_FALSE(CustomElement::isValidName("font-face-src"));
+ EXPECT_FALSE(CustomElement::isValidName("font-face-uri"));
+ EXPECT_FALSE(CustomElement::isValidName("font-face-format"));
+ EXPECT_FALSE(CustomElement::isValidName("font-face-name"));
+ EXPECT_FALSE(CustomElement::isValidName("missing-glyph"));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/custom/CustomElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698