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

Unified Diff: third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type.html

Issue 2334123004: Convert editing/execCommand/switch-list-type.html to use w3c test harness (Closed)
Patch Set: 2016-09-14T14:32:49 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 | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type.html
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type.html b/third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type.html
index c1e538f605630c7f22a827c8b3e4dad2f40bc25f..03cfe8ab2ce11d596a4b019ef30e204919af2f83 100644
--- a/third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type.html
+++ b/third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type.html
@@ -1,45 +1,135 @@
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
<script>
-if (window.testRunner) {
- testRunner.dumpEditingCallbacks();
- testRunner.dumpAsText();
-}
-</script>
-<p>This test checks to see if InsertOrderedList can switch the list type of list items.</p>
-<div id="div" contenteditable="true">
-<ol style="border: 1px solid red;">
- <li>This should be in an ordered list.</li>
- <span id="item1">This should be in an unordered list.</span>
- <br><br>
- This should be in an ordered list.
- <li>This should be in an ordered list.</li>
- <span id="item2">This should be in an unordered list.</span>
- <li>This should be in an ordered list.</li>
- <li><span id="item3">This should be in an unordered list.</span></li>
- <li>This should be in an ordered list.</li>
-</ol>
-This should not be in a list.
-<li><span id="item4">This should be in an ordered list.</span></li>
-</div>
-<p id="console"></p>
-
-<script>
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>item-1</li>',
+ '|one-1<br>',
+ '<br>',
+ 'one-2',
+ '<li>item-2</li>',
+ '</ol>',
+ '</div>',
+ ].join(''),
+ 'insertUnorderedList',
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>item-1</li>',
+ '</ol>',
+ '<ul>',
+ '<li>|one-1</li>',
+ '</ul>',
+ '<ol>',
+ '<br>',
+ 'one-2',
+ '<li>item-2</li>',
+ '</ol>',
+ '</div>',
+ ].join('')),
+ '1 switch list type on text outside LI with BR');
-function log(message) {
- var console = document.getElementById("console");
- var text = document.createTextNode(message);
- console.appendChild(text);
-}
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<ul>',
+ '<li>one-1</li>',
+ '</ul>',
+ '<ol>',
+ '<br>',
+ 'one-2',
+ '<li>item-2</li>',
+ '|two-1',
+ '</ol>',
+ '</div>',
+ ].join(''),
+ 'insertUnorderedList',
+ [
+ '<div contenteditable>',
+ '<ul>',
+ '<li>one-1</li>',
+ '</ul>',
+ '<ol>',
+ '<br>',
+ 'one-2',
+ '<li>item-2</li>',
+ '</ol>',
+ '<ul>',
+ '<li>|two-1</li>',
+ '</ul>',
+ '</div>',
+ ].join('')),
+ '2 switch list type on text outside LI');
-var s = window.getSelection();
-s.collapse(document.getElementById("item1"), 0);
-document.execCommand("InsertUnorderedList", false, "Moo");
-s.collapse(document.getElementById("item2"), 0);
-document.execCommand("InsertUnorderedList", false, "Goo");
-s.collapse(document.getElementById("item3"), 0);
-document.execCommand("InsertUnorderedList", false, "Gai");
-s.collapse(document.getElementById("item4"), 0);
-document.execCommand("InsertOrderedList", false, "Noodles");
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>|item-1</li>',
+ '<li>item-2</li>',
+ '</ol>',
+ '</div>',
+ ].join(''),
+ 'insertUnorderedList',
+ [
+ '<div contenteditable>',
+ '<ul>',
+ '<li>|item-1</li>',
+ '</ul>',
+ '<ol>',
+ '<li>item-2</li>',
+ '</ol>',
+ '</div>',
+ ].join('')),
+ '3 switch list type on text in LI');
-log(div.innerHTML);
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>item-1</li>',
+ '</ol>',
+ 'item-2',
+ '<li>|item-3</li>',
+ '</div>',
+ ].join(''),
+ 'insertOrderedList',
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>item-1</li>',
+ '</ol>',
+ 'item-2<br>',
+ '<ol>',
+ '<li>|item-3</li>',
+ '</ol>',
+ '</div>',
+ ].join('')),
+ '4 insertOrderedList on LI outside list');
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>item-1</li>',
+ '</ol>',
+ 'item-2',
+ '<li>|item-3</li>',
+ '</div>',
+ ].join(''),
+ 'insertUnorderedList',
+ [
+ '<div contenteditable>',
+ '<ol>',
+ '<li>item-1</li>',
+ '</ol>',
+ 'item-2<br>',
+ '|item-3', // remove LI
+ '</div>',
+ ].join('')),
+ '5 insertUnorderedList on LI outside list');
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/switch-list-type-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698