FIX: tooltip regression in admin dashboard

- adds registerHoverTooltip in tooltip qunit test
This commit is contained in:
Penar Musaraj 2018-12-03 11:15:31 -05:00
parent 1a4676c6e0
commit 923692d45a
2 changed files with 6 additions and 7 deletions

View File

@ -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));
}
}

View File

@ -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();