summaryrefslogtreecommitdiffstats
path: root/toolkit/components/tooltiptext/tests/browser_bug331772_xul_tooltiptext_in_html.js
blob: 61c50e542235cf9b7348347fc7f8acc99fd792f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Tests that the tooltiptext attribute is used for XUL elements in an HTML doc.
 */
add_task(async function () {
  await SpecialPowers.pushPermissions([
    { type: "allowXULXBL", allow: true, context: "http://mochi.test:8888" },
  ]);

  await BrowserTestUtils.withNewTab(
    {
      gBrowser,
      url: "http://mochi.test:8888/browser/toolkit/components/tooltiptext/tests/xul_tooltiptext.xhtml",
    },
    async function (browser) {
      await SpecialPowers.spawn(browser, [""], function () {
        let textObj = {};
        let tttp = Cc[
          "@mozilla.org/embedcomp/default-tooltiptextprovider;1"
        ].getService(Ci.nsITooltipTextProvider);
        let xulToolbarButton =
          content.document.getElementById("xulToolbarButton");
        ok(
          tttp.getNodeText(xulToolbarButton, textObj, {}),
          "should get tooltiptext"
        );
        is(textObj.value, "XUL tooltiptext");
      });
    }
  );
});