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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommandTest.cpp

Issue 2534783002: Apply RelocatablePosition in DeleteSelectionCommand::mergeParagraphs (Closed)
Patch Set: Tue Nov 29 21:12:11 JST 2016 Created 4 years 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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/DeleteSelectionCommand.h"
6
7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/Document.h"
9 #include "core/editing/EditingTestBase.h"
10 #include "core/editing/FrameSelection.h"
11 #include "core/editing/Position.h"
12 #include "core/editing/VisibleSelection.h"
13 #include "core/frame/FrameView.h"
14 #include "core/frame/LocalFrame.h"
15 #include "core/testing/DummyPageHolder.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17
18 #include <memory>
19
20 namespace blink {
21
22 class DeleteSelectionCommandTest : public EditingTestBase {};
23
24 // This is a regression test for https://crbug.com/668765
25 TEST_F(DeleteSelectionCommandTest, deleteListFromTable) {
26 setBodyContent(
27 "<div contenteditable=true>"
28 "<table><tr><td><ol>"
29 "<li><br></li>"
30 "<li>foo</li>"
31 "</ol></td></tr></table>"
32 "</div>");
33
34 Element* div = document().querySelector("div");
35 Element* table = document().querySelector("table");
36 Element* br = document().querySelector("br");
37
38 LocalFrame* frame = document().frame();
39 frame->selection().setSelection(
40 SelectionInDOMTree::Builder()
41 .collapse(Position(br, PositionAnchorType::BeforeAnchor))
42 .extend(Position(table, PositionAnchorType::AfterAnchor))
43 .build());
44
45 const bool kNoSmartDelete = false;
46 const bool kMergeBlocksAfterDelete = true;
47 const bool kNoExpandForSpecialElements = false;
48 const bool kSanitizeMarkup = true;
49 DeleteSelectionCommand* command = DeleteSelectionCommand::create(
50 document(), kNoSmartDelete, kMergeBlocksAfterDelete,
51 kNoExpandForSpecialElements, kSanitizeMarkup,
52 InputEvent::InputType::DeleteByCut);
53
54 EXPECT_TRUE(command->apply()) << "the delete command should have succeeded";
55 EXPECT_EQ("<div contenteditable=\"true\"><br></div>",
56 document().body()->innerHTML());
57 EXPECT_TRUE(frame->selection().isCaret());
58 EXPECT_EQ(Position(div, 0), frame->selection().base().toOffsetInAnchor());
59 }
60
61 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698