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

Unified Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommandTest.cpp

Issue 2533703002: Don't refer to removed spans when reformulating pasted content. (Closed)
Patch Set: Address nit. Created 4 years, 1 month 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/commands/ReplaceSelectionCommand.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/commands/ReplaceSelectionCommandTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommandTest.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommandTest.cpp
index f833401c1652bc7e4a9a2dbfd65307e76c35e7ca..3624499beb95d8747140ae69d0efd909d5174165 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommandTest.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommandTest.cpp
@@ -51,6 +51,30 @@ TEST_F(ReplaceSelectionCommandTest, pastingEmptySpan) {
EXPECT_EQ("foo", document().body()->innerHTML()) << "no DOM tree mutation";
}
+// This is a regression test for https://crbug.com/668808
+TEST_F(ReplaceSelectionCommandTest, pasteSpanInText) {
+ document().setDesignMode("on");
+ setBodyContent("<b>text</b>");
+
+ Element* bElement = document().querySelector("b");
+ LocalFrame* frame = document().frame();
+ frame->selection().setSelection(
+ SelectionInDOMTree::Builder()
+ .collapse(Position(bElement->firstChild(), 1))
+ .build());
+
+ DocumentFragment* fragment = document().createDocumentFragment();
+ fragment->parseHTML("<span><div>bar</div></span>", bElement);
+
+ ReplaceSelectionCommand::CommandOptions options = 0;
+ ReplaceSelectionCommand* command =
+ ReplaceSelectionCommand::create(document(), fragment, options);
+
+ EXPECT_TRUE(command->apply()) << "the replace command should have succeeded";
+ EXPECT_EQ("<b>t</b>bar<b>ext</b>", document().body()->innerHTML())
+ << "'bar' should have been inserted";
+}
+
// This is a regression test for https://crbug.com/121163
TEST_F(ReplaceSelectionCommandTest, styleTagsInPastedHeadIncludedInContent) {
document().setDesignMode("on");
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698