Bug 1161072 - Fix pending requests in markup view tests. r=pbrosset

This commit is contained in:
J. Ryan Stinnett 2015-06-03 17:56:00 -05:00
Родитель 313ec41bae
Коммит b8bdee0297
3 изменённых файлов: 16 добавлений и 6 удалений

Просмотреть файл

@ -30,6 +30,7 @@ const Heritage = require("sdk/core/heritage");
const {setTimeout, clearTimeout, setInterval, clearInterval} = require("sdk/timers");
const {parseAttribute} = require("devtools/shared/node-attribute-parser");
const ELLIPSIS = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data;
const {Task} = require("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm");
Cu.import("resource://gre/modules/devtools/Templater.jsm");
@ -1955,7 +1956,7 @@ MarkupContainer.prototype = {
/**
* On mouse up, stop dragging.
*/
_onMouseUp: function(event) {
_onMouseUp: Task.async(function*() {
this._isMouseDown = false;
if (!this.isDragging) {
@ -1967,13 +1968,14 @@ MarkupContainer.prototype = {
let dropTargetNodes = this.markup.dropTargetNodes;
if(!dropTargetNodes) {
if (!dropTargetNodes) {
return;
}
this.markup.walker.insertBefore(this.node, dropTargetNodes.parent,
dropTargetNodes.nextSibling);
},
yield this.markup.walker.insertBefore(this.node, dropTargetNodes.parent,
dropTargetNodes.nextSibling);
this.markup.emit("drop-completed");
}),
/**
* On mouse move, move the dragged element if any and indicate the drop target.

Просмотреть файл

@ -46,9 +46,13 @@ add_task(function*() {
yield scroll;
let dropCompleted = once(markup, "drop-completed");
container._onMouseUp(ev);
markup._onMouseUp(ev);
yield dropCompleted;
ok("Scroll event fired");
});
@ -58,4 +62,4 @@ function onScroll(win) {
resolve(e);
}
});
};
};

Просмотреть файл

@ -31,6 +31,8 @@ add_task(function*() {
yield wait(GRAB_DELAY + 1);
ok(el.isDragging, "isDragging true after GRAB_DELAY has passed");
let dropCompleted = once(inspector.markup, "drop-completed");
info("Simulating mouseUp on #test");
el._onMouseUp({
target: el.tagLine,
@ -38,5 +40,7 @@ add_task(function*() {
pageY: rect.y
});
yield dropCompleted;
is(el.isDragging, false, "isDragging false after mouseUp");
});