Index: third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommandTest.cpp |
diff --git a/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommandTest.cpp b/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommandTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5bc0b53241bbb9ef18149c3865f4cde7cc726608 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/editing/commands/SetCharacterDataCommandTest.cpp |
@@ -0,0 +1,29 @@ |
+// Copyright 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/SetCharacterDataCommand.h" |
+ |
+#include "core/editing/EditingTestBase.h" |
+#include "core/editing/commands/EditingState.h" |
+ |
+namespace blink { |
+ |
+class SetCharacterDataCommandTest : public EditingTestBase {}; |
+ |
+TEST_F(SetCharacterDataCommandTest, applyAndUnapply) { |
+ setBodyContent("<div contenteditable>This is a good test case</div>"); |
+ |
+ SimpleEditCommand* command = SetCharacterDataCommand::create( |
+ toText(document().body()->firstChild()->firstChild()), 10, 4, "lousy"); |
+ |
+ command->doReapply(); |
+ EXPECT_EQ("This is a lousy test case", |
+ toText(document().body()->firstChild()->firstChild())->wholeText()); |
+ |
+ command->doUnapply(); |
+ EXPECT_EQ("This is a good test case", |
+ toText(document().body()->firstChild()->firstChild())->wholeText()); |
+} |
yosin_UTC9
2017/02/22 06:44:32
Could you add edge cases?
- node.length=0 offset=c
|
+ |
+} // namespace blink |