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

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

Issue 2308683003: Add a missing updateStyleAndLayout call in InsertListCommand. (Closed)
Patch Set: -to. Created 4 years, 3 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/InsertListCommand.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/InsertListCommandTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertListCommandTest.cpp b/third_party/WebKit/Source/core/editing/commands/InsertListCommandTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..eb70b3574f76684adf611519373a42baf4f528fc
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommandTest.cpp
@@ -0,0 +1,44 @@
+// Copyright 2016 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/InsertListCommand.h"
+
+#include "core/dom/ParentNode.h"
+#include "core/dom/Text.h"
+#include "core/editing/EditingTestBase.h"
+#include "core/editing/FrameSelection.h"
+
+namespace blink {
+
+class InsertListCommandTest : public EditingTestBase {
+};
+
+TEST_F(InsertListCommandTest, ShouldCleanlyRemoveSpuriousTextNode)
+{
+ // Needs to be editable to use InsertListCommand.
+ document().setDesignMode("on");
+ // Set up the condition:
+ // * Selection is a range, to go down into InsertListCommand::listifyParagraph.
+ // * The selection needs to have a sibling list to go down into
+ // InsertListCommand::mergeWithNeighboringLists.
+ // * Should be the same type (ordered list) to go into
+ // CompositeEditCommand::mergeIdenticalElements.
+ // * Should have no actual children to fail the listChildNode check
+ // in InsertListCommand::doApplyForSingleParagraph.
+ // * There needs to be an extra text node to trigger its removal in
+ // CompositeEditCommand::mergeIdenticalElements.
+ // The removeNode is what updates document lifecycle to VisualUpdatePending and
+ // makes FrameView::needsLayout return true.
+ setBodyContent("\nd\n<ol>");
+ Text* emptyText = document().createTextNode("");
+ document().body()->insertBefore(emptyText, document().body()->firstChild());
+ document().frame()->selection().setSelection(VisibleSelection(Position(document().body(), 0), Position(document().body(), 2)));
+
+ InsertListCommand* command = InsertListCommand::create(document(), InsertListCommand::OrderedList);
+ // This should not DCHECK.
+ EXPECT_TRUE(command->apply()) << "The insert ordered list command should have succeeded";
+ EXPECT_EQ("<ol><li>d</li></ol>", document().body()->innerHTML());
+}
+
+}
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698