OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/editing/commands/InsertTextCommand.h" |
| 6 |
| 7 #include "core/editing/EditingTestBase.h" |
| 8 #include "core/editing/FrameSelection.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class InsertTextCommandTest : public EditingTestBase {}; |
| 13 |
| 14 // http://crbug.com/714311 |
| 15 TEST_F(InsertTextCommandTest, WithTypingStyle) { |
| 16 SetBodyContent("<div contenteditable=true><option id=sample></option></div>"); |
| 17 Element* const sample = GetDocument().getElementById("sample"); |
| 18 Selection().SetSelection( |
| 19 SelectionInDOMTree::Builder().Collapse(Position(sample, 0)).Build()); |
| 20 // Register typing style to make |InsertTextCommand| to attempt to apply |
| 21 // style to inserted text. |
| 22 GetDocument().execCommand("fontSizeDelta", false, "+3", ASSERT_NO_EXCEPTION); |
| 23 CompositeEditCommand* const command = |
| 24 InsertTextCommand::Create(GetDocument(), "x"); |
| 25 command->Apply(); |
| 26 |
| 27 EXPECT_EQ( |
| 28 "<div contenteditable=\"true\"><option id=\"sample\">x</option></div>", |
| 29 GetDocument().body()->innerHTML()) |
| 30 << "Content of OPTION is distributed into shadow node as text" |
| 31 "without applying typing style."; |
| 32 } |
| 33 |
| 34 } // namespace blink |
OLD | NEW |