Index: third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp |
index d077ad4f8f3e50a6cb64d0a18b650a7367815d12..6113a519ce079ba81d9a1c764b34855b11c2a266 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp |
@@ -5,12 +5,15 @@ |
#include "core/dom/custom/CustomElementDescriptor.h" |
#include "core/dom/custom/CustomElementDescriptorHash.h" |
+#include "core/dom/custom/CustomElementTestHelpers.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "wtf/HashSet.h" |
#include "wtf/text/AtomicString.h" |
namespace blink { |
+class Element; |
+ |
TEST(CustomElementDescriptorTest, equal) |
{ |
CustomElementDescriptor myTypeExtension("my-button", "button"); |
@@ -40,4 +43,41 @@ TEST(CustomElementDescriptorTest, hashable) |
<< "an unrelated descriptor should not be found in the hash set"; |
} |
+TEST(CustomElementDescriptorTest, matches_autonomous) |
+{ |
+ CustomElementDescriptor descriptor("a-b", "a-b"); |
+ Element* element = CreateElement("a-b"); |
+ EXPECT_TRUE(descriptor.matches(*element)); |
+} |
+ |
+TEST(CustomElementDescriptorTest, |
+ matches_autonomous_shouldNotMatchCustomizedBuiltInElement) |
+{ |
+ CustomElementDescriptor descriptor("a-b", "a-b"); |
+ Element* element = CreateElement("futuretag").withIsAttribute("a-b"); |
+ EXPECT_FALSE(descriptor.matches(*element)); |
+} |
+ |
+TEST(CustomElementDescriptorTest, matches_customizedBuiltIn) |
+{ |
+ CustomElementDescriptor descriptor("a-b", "button"); |
+ Element* element = CreateElement("button").withIsAttribute("a-b"); |
+ EXPECT_TRUE(descriptor.matches(*element)); |
+} |
+ |
+TEST(CustomElementDescriptorTest, |
+ matches_customizedBuiltIn_shouldNotMatchAutonomousElement) |
+{ |
+ CustomElementDescriptor descriptor("a-b", "button"); |
+ Element* element = CreateElement("a-b"); |
+ EXPECT_FALSE(descriptor.matches(*element)); |
+} |
+ |
+TEST(CustomElementDescriptorTest, matches_elementNotInHTMLNamespaceDoesNotMatch) |
+{ |
+ CustomElementDescriptor descriptor("a-b", "a-b"); |
+ Element* element = CreateElement("a-b").inNamespace("data:text/plain,foo"); |
+ EXPECT_FALSE(descriptor.matches(*element)); |
+} |
+ |
} // namespace blink |