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

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

Issue 2847763004: Make InsertTextCommand not to apply style for empty selection (Closed)
Patch Set: 2017-04-28T14:41:08 Created 3 years, 8 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/commands/InsertTextCommand.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/InsertTextCommandTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertTextCommandTest.cpp b/third_party/WebKit/Source/core/editing/commands/InsertTextCommandTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..98290a1b3e4156e19b7a0c40c88dca72841efbf7
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/commands/InsertTextCommandTest.cpp
@@ -0,0 +1,34 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/editing/commands/InsertTextCommand.h"
+
+#include "core/editing/EditingTestBase.h"
+#include "core/editing/FrameSelection.h"
+
+namespace blink {
+
+class InsertTextCommandTest : public EditingTestBase {};
+
+// http://crbug.com/714311
+TEST_F(InsertTextCommandTest, WithTypingStyle) {
+ SetBodyContent("<div contenteditable=true><option id=sample></option></div>");
+ Element* const sample = GetDocument().getElementById("sample");
+ Selection().SetSelection(
+ SelectionInDOMTree::Builder().Collapse(Position(sample, 0)).Build());
+ // Register typing style to make |InsertTextCommand| to attempt to apply
+ // style to inserted text.
+ GetDocument().execCommand("fontSizeDelta", false, "+3", ASSERT_NO_EXCEPTION);
+ CompositeEditCommand* const command =
+ InsertTextCommand::Create(GetDocument(), "x");
+ command->Apply();
+
+ EXPECT_EQ(
+ "<div contenteditable=\"true\"><option id=\"sample\">x</option></div>",
+ GetDocument().body()->innerHTML())
+ << "Content of OPTION is distributed into shadow node as text"
+ "without applying typing style.";
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698