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

Unified Diff: Source/core/editing/EditingUtilitiesTest.cpp

Issue 1309903003: Introduce composed tree version of enclosingNodeOfType() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-26T13:10:19 Created 5 years, 4 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: Source/core/editing/EditingUtilitiesTest.cpp
diff --git a/Source/core/editing/EditingUtilitiesTest.cpp b/Source/core/editing/EditingUtilitiesTest.cpp
index 0ad6ab745225f0c5bc938963876f41813b84fe56..3a6481280c5ee06603c399978cbcda46b48a73ad 100644
--- a/Source/core/editing/EditingUtilitiesTest.cpp
+++ b/Source/core/editing/EditingUtilitiesTest.cpp
@@ -12,6 +12,21 @@ namespace blink {
class EditingUtilitiesTest : public EditingTestBase {
};
+TEST_F(EditingUtilitiesTest, enclosingNodeOfType)
+{
+ const char* bodyContent = "<p id='host'><b id='one'>11</b></p>";
+ const char* shadowContent = "<content select=#two></content><div id='three'><content select=#one></div></content>";
+ setBodyContent(bodyContent);
+ RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
+ updateLayoutAndStyleForPainting();
+ Node* host = document().getElementById("host");
+ Node* one = document().getElementById("one");
+ Node* three = shadowRoot->getElementById("three");
+
+ EXPECT_EQ(host, enclosingNodeOfType(Position(one, 0), isBlock));
+ EXPECT_EQ(three, enclosingNodeOfType(PositionInComposedTree(one, 0), isBlock));
+}
+
TEST_F(EditingUtilitiesTest, NextNodeIndex)
{
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
« Source/core/editing/EditingUtilities.h ('K') | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698