Bug 1271119 - Port test_bug1153237.html from chrome to plain; r?masayuki
MozReview-Commit-ID: DDfHuLwplBV
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -18,17 +18,16 @@ skip-if = buildapp == 'mulet'
[test_bug636465.xul]
[test_bug780908.xul]
[test_bug830600.html]
subsuite = clipboard
[test_bug1053048.html]
[test_bug1100966.html]
[test_bug1102906.html]
[test_bug1140105.html]
-[test_bug1153237.html]
[test_bug1154791.html]
[test_bug1248128.html]
[test_bug1248185.html]
[test_bug1250010.html]
[test_bug1257363.html]
[test_composition_event_created_in_chrome.html]
[test_contenteditable_text_input_handling.html]
[test_dragdrop.html]
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -179,16 +179,17 @@ skip-if = toolkit == 'android' # bug 105
[test_spellcheck_pref.html]
skip-if = toolkit == 'android'
[test_bug1068979.html]
subsuite = clipboard
[test_bug1109465.html]
[test_bug1140617.html]
subsuite = clipboard
skip-if = toolkit == 'android' # bug 1299578
+[test_bug1153237.html]
[test_bug1162952.html]
[test_bug1186799.html]
[test_bug1181130-1.html]
[test_bug1181130-2.html]
[test_backspace_vs.html]
[test_css_chrome_load_access.html]
skip-if = toolkit == 'android' # chrome urls not available due to packaging
[test_bug1247483.html]
--- a/editor/libeditor/tests/test_bug1153237.html
+++ b/editor/libeditor/tests/test_bug1153237.html
@@ -1,18 +1,18 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1153237
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1153237</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
// Avoid platform selection differences
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({
"set": [["layout.word_select.eat_space_to_next_word", true]]
@@ -20,30 +20,24 @@ https://bugzilla.mozilla.org/show_bug.cg
});
function runTests()
{
var element = document.getElementById("editor");
var sel = window.getSelection();
element.focus();
- ok(sel.getRangeAt(0).startOffset == 0, "offset is zero");
+ is(sel.getRangeAt(0).startOffset, 0, "offset is zero");
- const kSelectRight2 = "cmd_selectRight2";
- var controller =
- top.document.commandDispatcher.getControllerForCommand(kSelectRight2);
- ok((controller && controller.isCommandEnabled(kSelectRight2)),
- "have " + kSelectRight2 + " command");
-
- controller.doCommand(kSelectRight2);
- ok(sel.toString() == "Some ",
+ SpecialPowers.doCommand(window, "cmd_selectRight2");
+ is(sel.toString(), "Some ",
"first word + space is selected: got '" + sel.toString() + "'");
- controller.doCommand(kSelectRight2);
- ok(sel.toString() == "Some text",
+ SpecialPowers.doCommand(window, "cmd_selectRight2");
+ is(sel.toString(), "Some text",
"both words are selected: got '" + sel.toString() + "'");
SimpleTest.finish();
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1153237">Mozilla Bug 1153237</a>