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

Side by Side 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: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/custom/CustomElement.h" 5 #include "core/dom/custom/CustomElement.h"
6 6
7 #include "platform/Logging.h" 7 #include "platform/Logging.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 UChar32 from, to; 103 UChar32 from, to;
104 } ranges[] = { 104 } ranges[] = {
105 { 'A', 'Z' }, 105 { 'A', 'Z' },
106 }; 106 };
107 for (auto range : ranges) { 107 for (auto range : ranges) {
108 for (UChar32 c = range.from; c <= range.to; ++c) 108 for (UChar32 c = range.from; c <= range.to; ++c)
109 TestIsPotentialCustomElementNameChar(c, false); 109 TestIsPotentialCustomElementNameChar(c, false);
110 } 110 }
111 } 111 }
112 112
113 TEST(CustomElementTest, TestHyphenContainingElementNames)
114 {
115 EXPECT_TRUE(CustomElement::isValidName("valid-name"));
116
117 EXPECT_FALSE(CustomElement::isValidName("annotation-xml"));
118 EXPECT_FALSE(CustomElement::isValidName("color-profile"));
119 EXPECT_FALSE(CustomElement::isValidName("font-face"));
120 EXPECT_FALSE(CustomElement::isValidName("font-face-src"));
121 EXPECT_FALSE(CustomElement::isValidName("font-face-uri"));
122 EXPECT_FALSE(CustomElement::isValidName("font-face-format"));
123 EXPECT_FALSE(CustomElement::isValidName("font-face-name"));
124 EXPECT_FALSE(CustomElement::isValidName("missing-glyph"));
125 }
126
113 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698