Bug 1163640 - Fix the test for bug 417418 to not leave the widget in a drag session. r=ehsan, a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 11 May 2015 17:21:30 -0400
changeset 274633 157446f10a5ed0d9549ecc49ad01a4db367009ad
parent 274632 4e29546b3a53bfe9c5ed631dfe392359685e1175
child 274634 0af65151a322b0f67957d647cf3be644be3af2a4
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test-only
bugs1163640, 417418
milestone40.0a2
Bug 1163640 - Fix the test for bug 417418 to not leave the widget in a drag session. r=ehsan, a=test-only
editor/libeditor/tests/test_bug417418.html
--- a/editor/libeditor/tests/test_bug417418.html
+++ b/editor/libeditor/tests/test_bug417418.html
@@ -20,49 +20,54 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 417418 **/
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(runTest);
-SimpleTest.expectAssertions(0, 1);
 
 function resetSelection() {
   window.getSelection().collapse(document.getElementById("coin"), 0);
 }
 
 function runTest() {
-    var rightClick = {type: 'mousedown', button: 2},
-        singleClick = {type: 'mousedown', button: 0};
+    var rightClickDown = {type: 'mousedown', button: 2},
+        rightClickUp = {type: 'mouseup', button: 2},
+        singleClickDown = {type: 'mousedown', button: 0},
+        singleClickUp = {type: 'mouseup', button: 0};
     var selection = window.getSelection();
 
     var div = document.getElementById('display');
     var img = document.getElementById('img');
     var divRect = div.getBoundingClientRect();
     var imgselected;
 
     resetSelection();
-    synthesizeMouse(div, divRect.width - 1, divRect.height - 1, rightClick);
+    synthesizeMouse(div, divRect.width - 1, divRect.height - 1, rightClickDown);
+    synthesizeMouse(div, divRect.width - 1, divRect.height - 1, rightClickUp);
     ok(selection.isCollapsed, "selection is not collapsed");
 
     resetSelection();
-    synthesizeMouse(div, divRect.width - 1, divRect.height - 1, singleClick);
+    synthesizeMouse(div, divRect.width - 1, divRect.height - 1, singleClickDown);
+    synthesizeMouse(div, divRect.width - 1, divRect.height - 1, singleClickUp);
     ok(selection.isCollapsed, "selection is not collapsed");
 
     resetSelection();
-    synthesizeMouseAtCenter(img, rightClick);
+    synthesizeMouseAtCenter(img, rightClickDown);
+    synthesizeMouseAtCenter(img, rightClickUp);
     imgselected = selection.anchorNode == img.parentNode &&
                       selection.anchorOffset === 1 &&
                       selection.rangeCount === 1;
     ok(imgselected, "image is not selected");
 
     resetSelection();
-    synthesizeMouseAtCenter(img, singleClick);
+    synthesizeMouseAtCenter(img, singleClickDown);
+    synthesizeMouseAtCenter(img, singleClickUp);
     imgselected = selection.anchorNode == img.parentNode &&
                       selection.anchorOffset === 1 &&
                       selection.rangeCount === 1;
     ok(imgselected, "image is not selected");
 
     SimpleTest.finish();
 }