Bug 1267403 - HTMLTooltip tests: destroy tooltips at the end of tests;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 04 Jul 2016 16:02:37 +0200
changeset 384509 5dc96caed88143bdfd03983a1a293ea90c0e672d
parent 384508 eb169031125a30477cd3cb6324c1ee95d4b14b39
child 384613 011c428d3fd66410f599570af28e8a894e7ecf80
child 384703 cc1d6ac8152de5394ca090ff24aa89c590ef87a4
child 384838 384969e88f8fb3ed23187c12d305acc113cf6a2c
child 385027 754c5f7d34eab00ff1f04e83f7131e93d97959b2
push id22283
push userjdescottes@mozilla.com
push dateWed, 06 Jul 2016 12:52:33 +0000
reviewersochameau
bugs1267403
milestone50.0a1
Bug 1267403 - HTMLTooltip tests: destroy tooltips at the end of tests;r=ochameau MozReview-Commit-ID: 2jMKxlsWId2
devtools/client/shared/test/browser_html_tooltip-03.js
devtools/client/shared/test/browser_html_tooltip-04.js
devtools/client/shared/test/browser_html_tooltip-05.js
devtools/client/shared/test/browser_html_tooltip_arrow-02.js
devtools/client/shared/test/browser_html_tooltip_consecutive-show.js
devtools/client/shared/test/browser_html_tooltip_variable-height.js
devtools/client/shared/test/browser_html_tooltip_width-auto.js
devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js
--- a/devtools/client/shared/test/browser_html_tooltip-03.js
+++ b/devtools/client/shared/test/browser_html_tooltip-03.js
@@ -59,16 +59,18 @@ function* testNoAutoFocus(doc) {
   info("Test a tooltip without autofocus will not take focus");
   let tooltip = yield createTooltip(doc, false);
 
   yield showTooltip(tooltip, doc.getElementById("box1"));
   ok(doc.activeElement.closest("#box4-input"), "Focus is still in the #box4-input");
 
   yield hideTooltip(tooltip);
   yield blurNode(doc, "#box4-input");
+
+  tooltip.destroy();
 }
 
 function* testAutoFocus(doc) {
   yield focusNode(doc, "#box4-input");
   ok(doc.activeElement.closest("#box4-input"), "Focus is in the #box4-input");
 
   info("Test autofocus tooltip takes focus when displayed, " +
     "and restores the focus when hidden");
@@ -77,16 +79,18 @@ function* testAutoFocus(doc) {
   yield showTooltip(tooltip, doc.getElementById("box1"));
   ok(doc.activeElement.closest(".tooltip-content"), "Focus is in the tooltip");
 
   yield hideTooltip(tooltip);
   ok(doc.activeElement.closest("#box4-input"), "Focus is in the #box4-input");
 
   info("Blur the textbox before moving to the next test to reset the state.");
   yield blurNode(doc, "#box4-input");
+
+  tooltip.destroy();
 }
 
 function* testAutoFocusPreservesFocusChange(doc) {
   yield focusNode(doc, "#box4-input");
   ok(doc.activeElement.closest("#box4-input"), "Focus is still in the #box3-input");
 
   info("Test autofocus tooltip takes focus when displayed, " +
     "but does not try to restore the active element if it is not focused when hidden");
@@ -99,16 +103,18 @@ function* testAutoFocusPreservesFocusCha
   yield focusNode(doc, "#box3-input");
   ok(doc.activeElement.closest("#box3-input"), "Focus moved to the #box3-input");
 
   yield hideTooltip(tooltip);
   ok(doc.activeElement.closest("#box3-input"), "Focus is still in the #box3-input");
 
   info("Blur the textbox before moving to the next test to reset the state.");
   yield blurNode(doc, "#box3-input");
+
+  tooltip.destroy();
 }
 
 /**
  * Fpcus the node corresponding to the provided selector in the provided document. Returns
  * a promise that will resolve when receiving the focus event on the node.
  */
 function focusNode(doc, selector) {
   let node = doc.querySelector(selector);
--- a/devtools/client/shared/test/browser_html_tooltip-04.js
+++ b/devtools/client/shared/test/browser_html_tooltip-04.js
@@ -100,9 +100,11 @@ add_task(function* () {
 
   info("Try to display the tooltip on bottom of box4.");
   yield showTooltip(tooltip, box4, {position: "bottom"});
   expectedTooltipGeometry = {position: "top", height, width};
   checkTooltipGeometry(tooltip, box4, expectedTooltipGeometry);
   yield hideTooltip(tooltip);
 
   is(tooltip.isVisible(), false, "Tooltip is not visible");
+
+  tooltip.destroy();
 });
--- a/devtools/client/shared/test/browser_html_tooltip-05.js
+++ b/devtools/client/shared/test/browser_html_tooltip-05.js
@@ -99,9 +99,11 @@ add_task(function* () {
 
   info("Try to display the tooltip on bottom of box4.");
   yield showTooltip(tooltip, box4, {position: "bottom"});
   expectedTooltipGeometry = {position: "top", height: 150, width};
   checkTooltipGeometry(tooltip, box4, expectedTooltipGeometry);
   yield hideTooltip(tooltip);
 
   is(tooltip.isVisible(), false, "Tooltip is not visible");
+
+  tooltip.destroy();
 });
--- a/devtools/client/shared/test/browser_html_tooltip_arrow-02.js
+++ b/devtools/client/shared/test/browser_html_tooltip_arrow-02.js
@@ -90,9 +90,11 @@ function* runTests(doc) {
       "Tooltip arrow is aligned with the anchor, or stuck on viewport's edge.");
 
     let isInPanel = arrowBounds.left >= panelBounds.left &&
                     arrowBounds.right <= panelBounds.right;
     ok(isInPanel,
       "The tooltip arrow remains inside the tooltip panel horizontally");
     yield hideTooltip(tooltip);
   }
+
+  tooltip.destroy();
 }
--- a/devtools/client/shared/test/browser_html_tooltip_consecutive-show.js
+++ b/devtools/client/shared/test/browser_html_tooltip_consecutive-show.js
@@ -61,9 +61,11 @@ add_task(function* () {
   checkTooltipGeometry(tooltip, box3, {position: "top", width, height});
 
   info("Show tooltip on box4");
   tooltip.show(box4);
   checkTooltipGeometry(tooltip, box4, {position: "top", width, height});
 
   info("Hide tooltip before leaving test");
   yield hideTooltip(tooltip);
+
+  tooltip.destroy();
 });
--- a/devtools/client/shared/test/browser_html_tooltip_variable-height.js
+++ b/devtools/client/shared/test/browser_html_tooltip_variable-height.js
@@ -78,9 +78,11 @@ function* runTests(doc) {
   yield onPanelClick;
   is(tooltip.isVisible(), true, "Tooltip is still visible");
 
   info("Click below the tooltip container, the tooltip should be closed.");
   onHidden = once(tooltip, "hidden");
   EventUtils.synthesizeMouse(tooltip.container, 100, CONTAINER_HEIGHT + 10,
     {}, doc.defaultView);
   yield onHidden;
+
+  tooltip.destroy();
 }
--- a/devtools/client/shared/test/browser_html_tooltip_width-auto.js
+++ b/devtools/client/shared/test/browser_html_tooltip_width-auto.js
@@ -51,9 +51,11 @@ function* runTests(doc) {
 
   info("Show the tooltip and check the tooltip panel width.");
   yield showTooltip(tooltip, doc.getElementById("box1"));
 
   let panelRect = tooltip.panel.getBoundingClientRect();
   is(panelRect.width, 150, "Tooltip panel has the expected width.");
 
   yield hideTooltip(tooltip);
+
+  tooltip.destroy();
 }
--- a/devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js
+++ b/devtools/client/shared/test/browser_html_tooltip_xul-wrapper.js
@@ -60,16 +60,18 @@ add_task(function* () {
   // Below box1: check that the tooltip can overflow out of the browser window.
   info("Display the tooltip below box1.");
   yield showTooltip(tooltip, box1, {position: "bottom"});
   checkTooltip(tooltip, "bottom", TOOLTIP_HEIGHT);
   yield hideTooltip(tooltip);
 
   is(tooltip.isVisible(), false, "Tooltip is not visible");
 
+  tooltip.destroy();
+
   info("Restore original window dimensions.");
   win.top.resizeTo(originalWidth, originalHeight);
 });
 
 function checkTooltip(tooltip, position, height) {
   is(tooltip.position, position, "Actual tooltip position is " + position);
   let rect = tooltip.container.getBoundingClientRect();
   is(rect.height, height, "Actual tooltip height is " + height);