FIX: tooltip regression in admin dashboard

FIX: tooltip regression in admin dashboard

  • adds registerHoverTooltip in tooltip qunit test
From 923692d45a7194d1f6df02ca47cd873fbce2d9cc Mon Sep 17 00:00:00 2001
From: Penar Musaraj <pmusaraj@gmail.com>
Date: Mon, 3 Dec 2018 11:15:31 -0500
Subject: [PATCH] FIX: tooltip regression in admin dashboard

- adds registerHoverTooltip in tooltip qunit test

diff --git a/app/assets/javascripts/discourse/lib/tooltip.js.es6 b/app/assets/javascripts/discourse/lib/tooltip.js.es6
index 227e0f6..ecf93d8 100644
--- a/app/assets/javascripts/discourse/lib/tooltip.js.es6
+++ b/app/assets/javascripts/discourse/lib/tooltip.js.es6
@@ -3,8 +3,9 @@ import { escapeExpression } from "discourse/lib/utilities";
 const fadeSpeed = 300;
 const tooltipID = "#discourse-tooltip";
 
-export function showTooltip($this) {
-  const $parent = $this.offsetParent();
+export function showTooltip(e) {
+  const $this = $(e.currentTarget),
+    $parent = $this.offsetParent();
   // html tooltip are risky try your best to sanitize anything
   // displayed as html to avoid XSS attacks
   const content = $this.attr("data-tooltip")
@@ -77,9 +78,7 @@ export function hideTooltip() {
 
 export function registerTooltip(jqueryContext) {
   if (jqueryContext.length) {
-    jqueryContext
-      .off("click")
-      .on("click", event => showTooltip($(event.currentTarget)));
+    jqueryContext.off("click").on("click", event => showTooltip(event));
   }
 }
 
diff --git a/test/javascripts/lib/tooltip-test.js.es6 b/test/javascripts/lib/tooltip-test.js.es6
index ece7b09..df59cfd 100644
--- a/test/javascripts/lib/tooltip-test.js.es6
+++ b/test/javascripts/lib/tooltip-test.js.es6
@@ -1,4 +1,4 @@
-import { registerTooltip } from "discourse/lib/tooltip";
+import { registerTooltip, registerHoverTooltip } from "discourse/lib/tooltip";
 
 // prettier-ignore
 QUnit.module("lib:tooltip", {
@@ -37,7 +37,7 @@ QUnit.test("text support", async assert => {
 
 QUnit.test("html support", async assert => {
   const $testHtmlLink = fixture(".test-html-link");
-  registerTooltip($testHtmlLink);
+  registerHoverTooltip($testHtmlLink);
 
   await $testHtmlLink.click();

GitHub

This commit has been mentioned on Discourse Meta. There might be relevant details there: