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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp

Issue 2325553002: Restore a collapsed leading space of text used for line break (Closed)
Patch Set: Add gtests Created 4 years, 3 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/editing/iterators/TextIteratorTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
index 9e6a5bdf22a990d3b502b0878e3894f16a2807e8..7a5311cb2801b7763741f37dd9c21b12af487d68 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
@@ -158,6 +158,15 @@ TEST_F(TextIteratorTest, EnteringTextControlsWithOptionComplex)
EXPECT_EQ("[][\n][Beginning of range][\n][][\n][Under DOM nodes][\n][][\n][End of range]", iterate<FlatTree>(TextIteratorEntersTextControls));
}
+TEST_F(TextIteratorTest, PreserveLeadingSpace)
+{
+ static const char* input = "<div style='width: 2em;'><b><i>foo</i></b> bar</div>";
+ setBodyContent(input);
+ EXPECT_EQ("[foo][ ][bar]", iterate<DOMTree>(TextIteratorEmitsImageAltText));
+ EXPECT_EQ("[foo][ ][bar]", iterate<DOMTree>(TextIteratorDoesNotBreakAtReplacedElement));
+ EXPECT_EQ("[foo][ ][bar]", iterate<DOMTree>(TextIteratorForInnerText));
+}
+
TEST_F(TextIteratorTest, NotEnteringShadowTree)
{
static const char* bodyContent = "<div>Hello, <span id='host'>text</span> iterator.</div>";

Powered by Google App Engine
This is Rietveld 408576698