mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 07:01:13 +08:00
FIX: tooltip regression in admin dashboard
- adds registerHoverTooltip in tooltip qunit test
This commit is contained in:
@ -3,8 +3,9 @@ import { escapeExpression } from "discourse/lib/utilities";
|
|||||||
const fadeSpeed = 300;
|
const fadeSpeed = 300;
|
||||||
const tooltipID = "#discourse-tooltip";
|
const tooltipID = "#discourse-tooltip";
|
||||||
|
|
||||||
export function showTooltip($this) {
|
export function showTooltip(e) {
|
||||||
const $parent = $this.offsetParent();
|
const $this = $(e.currentTarget),
|
||||||
|
$parent = $this.offsetParent();
|
||||||
// html tooltip are risky try your best to sanitize anything
|
// html tooltip are risky try your best to sanitize anything
|
||||||
// displayed as html to avoid XSS attacks
|
// displayed as html to avoid XSS attacks
|
||||||
const content = $this.attr("data-tooltip")
|
const content = $this.attr("data-tooltip")
|
||||||
@ -77,9 +78,7 @@ export function hideTooltip() {
|
|||||||
|
|
||||||
export function registerTooltip(jqueryContext) {
|
export function registerTooltip(jqueryContext) {
|
||||||
if (jqueryContext.length) {
|
if (jqueryContext.length) {
|
||||||
jqueryContext
|
jqueryContext.off("click").on("click", event => showTooltip(event));
|
||||||
.off("click")
|
|
||||||
.on("click", event => showTooltip($(event.currentTarget)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerTooltip } from "discourse/lib/tooltip";
|
import { registerTooltip, registerHoverTooltip } from "discourse/lib/tooltip";
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
QUnit.module("lib:tooltip", {
|
QUnit.module("lib:tooltip", {
|
||||||
@ -37,7 +37,7 @@ QUnit.test("text support", async assert => {
|
|||||||
|
|
||||||
QUnit.test("html support", async assert => {
|
QUnit.test("html support", async assert => {
|
||||||
const $testHtmlLink = fixture(".test-html-link");
|
const $testHtmlLink = fixture(".test-html-link");
|
||||||
registerTooltip($testHtmlLink);
|
registerHoverTooltip($testHtmlLink);
|
||||||
|
|
||||||
await $testHtmlLink.click();
|
await $testHtmlLink.click();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user