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 238395 4524fdd94db741bd84d480e1524f633a8eb44afb
parent 238394 dfc8a1a241da738bfdbe8e2e6091e3739be5031f
child 238396 2f36b6c0cd285a7995531399fa4d1c41ba1103eb
push id609
push userryanvm@gmail.com
push dateTue, 19 May 2015 01:35:34 +0000
treeherdermozilla-b2g37_v2_2@bab8e4f5cbe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test-only
bugs1163640, 417418
milestone37.0
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
@@ -26,42 +26,48 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(runTest);
 
 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();
 }