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

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

Issue 2746153008: Fix bug causing TextIterator to duplicate leading spaces (Closed)
Patch Set: Remove obsolete comment Created 3 years, 9 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/editing/iterators/TextIterator.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/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 ff89e831f0946c529475b5c918c4c9f50869175e..893bc646d8432f289d19d8c77ee65ca75f7825a0 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
@@ -655,6 +655,16 @@ TEST_F(TextIteratorTest, PreserveLeadingSpace) {
plainText(EphemeralRange(start, end), emitsImageAltTextBehavior()));
}
+// We used to have a bug where the leading space was duplicated if we didn't
+// emit alt text, this tests for that bug
+TEST_F(TextIteratorTest, PreserveLeadingSpaceWithoutEmittingAltText) {
+ setBodyContent("<div style='width: 2em;'><b><i>foo</i></b> bar</div>");
+ Element* div = document().querySelector("div");
+ Position start(div->firstChild()->firstChild()->firstChild(), 0);
+ Position end(div->lastChild(), 4);
+ EXPECT_EQ("foo bar", plainText(EphemeralRange(start, end)));
+}
+
TEST_F(TextIteratorTest, PreserveOnlyLeadingSpace) {
setBodyContent(
"<div style='width: 2em;'><b><i id='foo'>foo </i></b> bar</div>");
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698