Bug 1222820 - Image preview tooltips still show up during drag and drop; r=pbro

This commit is contained in:
simplyblue 2015-11-17 17:06:10 +05:30
parent 8362f8f434
commit fa42aa81da
3 changed files with 42 additions and 0 deletions

View File

@ -406,6 +406,10 @@ MarkupView.prototype = {
_isImagePreviewTarget: 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);
}
let parent = target, container;
while (parent !== this.doc.body) {
if (parent.container) {

View File

@ -50,6 +50,7 @@ skip-if = e10s # scratchpad.xul is not loading in e10s window
[browser_markupview_dragdrop_escapeKeyPress.js]
[browser_markupview_dragdrop_invalidNodes.js]
[browser_markupview_dragdrop_reorder.js]
[browser_markupview_dragdrop_tooltip.js]
[browser_markupview_events.js]
skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible
[browser_markupview_events_form.js]

View File

@ -0,0 +1,37 @@
"use strict";
// Test that tooltips don't appear when dragging over tooltip targets.
const TEST_URL = "data:text/html;charset=utf8,<img src=\"about:logo\" /><div>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {markup} = inspector;
info("Get the tooltip target element for the image's src attribute");
let img = yield getContainerForSelector("img", inspector);
let target = img.editor.getAttributeElement("src").querySelector(".link");
info("Check that the src attribute of the image is a valid tooltip target");
let isValid = yield markup.tooltip.isValidHoverTarget(target);
ok(isValid, "The element is a valid tooltip target");
info("Start dragging the test div");
yield simulateNodeDrag(inspector, "div");
info("Now check that the src attribute of the image isn't a valid target");
try{
yield markup.tooltip.isValidHoverTarget(target);
isValid = true;
} catch(e) {
isValid = false;
}
ok(!isValid, "The element is not a valid tooltip target");
info("Stop dragging the test div");
yield simulateNodeDrop(inspector, "div");
info("Check again the src attribute of the image");
isValid = yield markup.tooltip.isValidHoverTarget(target);
ok(isValid, "The element is a valid tooltip target");
});