Bug 1266448 - part1: fix remaining TooltipToggle callback;r=ochameau

In bug 1270462 we changed the expected return value of the hover callback
used for the toggle tooltips. All callbacks were migrated except one in
markup.js. This changeset fixes this as well as a test which was depending
on it.

MozReview-Commit-ID: 1FZmxT6gIoS

--HG--
extra : rebase_source : c0799cca4a077dc65dd2fc6f1f4c6af82b6f7abd
This commit is contained in:
Julian Descottes 2016-05-16 18:11:08 +02:00
parent 3d6dea90e7
commit ce605c88aa
2 changed files with 7 additions and 13 deletions

View File

@ -475,11 +475,11 @@ MarkupView.prototype = {
* @return {Promise} the promise returned by
* MarkupElementContainer._isImagePreviewTarget
*/
_isImagePreviewTarget: function (target) {
_isImagePreviewTarget: Task.async(function* (target) {
// From the target passed here, let's find the parent MarkupContainer
// and ask it if the tooltip should be shown
if (this.isDragging) {
return promise.reject(false);
return false;
}
let parent = target, container;
@ -497,8 +497,8 @@ MarkupView.prototype = {
return container.isImagePreviewTarget(target, this.tooltip);
}
return undefined;
},
return false;
}),
/**
* Given the known reason, should the current selection be briefly highlighted
@ -2654,9 +2654,8 @@ MarkupElementContainer.prototype = Heritage.extend(MarkupContainer.prototype, {
* Checks if the target is indeed something we want to have an image tooltip
* preview over and, if so, inserts content into the tooltip.
*
* @return {Promise} that resolves when the content has been inserted or
* rejects if no preview is required. This promise is then used by
* Tooltip.js to decide if/when to show the tooltip
* @return {Promise} that resolves when the tooltip content is ready. Resolves
* true if the tooltip should be displayed, false otherwise.
*/
isImagePreviewTarget: Task.async(function* (target, tooltip) {
// Is this Element previewable.

View File

@ -23,12 +23,7 @@ add_task(function* () {
yield simulateNodeDrag(inspector, "div");
info("Now check that the src attribute of the image isn't a valid target");
try {
yield isHoverTooltipTarget(markup.tooltip, target);
isValid = true;
} catch (e) {
isValid = false;
}
isValid = yield isHoverTooltipTarget(markup.tooltip, target);
ok(!isValid, "The element is not a valid tooltip target");
info("Stop dragging the test div");