summaryrefslogtreecommitdiffstats
path: root/toolkit/components/tooltiptext/tests
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/tooltiptext/tests')
-rw-r--r--toolkit/components/tooltiptext/tests/browser.ini7
-rw-r--r--toolkit/components/tooltiptext/tests/browser_bug329212.js35
-rw-r--r--toolkit/components/tooltiptext/tests/browser_bug331772_xul_tooltiptext_in_html.js19
-rw-r--r--toolkit/components/tooltiptext/tests/browser_bug561623.js24
-rw-r--r--toolkit/components/tooltiptext/tests/browser_bug581947.js87
-rw-r--r--toolkit/components/tooltiptext/tests/browser_input_file_tooltips.js122
-rw-r--r--toolkit/components/tooltiptext/tests/title_test.svg59
-rw-r--r--toolkit/components/tooltiptext/tests/xul_tooltiptext.xhtml14
8 files changed, 0 insertions, 367 deletions
diff --git a/toolkit/components/tooltiptext/tests/browser.ini b/toolkit/components/tooltiptext/tests/browser.ini
deleted file mode 100644
index 9896fcd2c..000000000
--- a/toolkit/components/tooltiptext/tests/browser.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[browser_bug329212.js]
-support-files = title_test.svg
-[browser_bug331772_xul_tooltiptext_in_html.js]
-support-files = xul_tooltiptext.xhtml
-[browser_bug561623.js]
-[browser_bug581947.js]
-[browser_input_file_tooltips.js]
diff --git a/toolkit/components/tooltiptext/tests/browser_bug329212.js b/toolkit/components/tooltiptext/tests/browser_bug329212.js
deleted file mode 100644
index b3434eff6..000000000
--- a/toolkit/components/tooltiptext/tests/browser_bug329212.js
+++ /dev/null
@@ -1,35 +0,0 @@
-"use strict";
-
-add_task(function*() {
- yield BrowserTestUtils.withNewTab({
- gBrowser,
- url: "http://mochi.test:8888/browser/toolkit/components/tooltiptext/tests/title_test.svg",
- }, function*(browser) {
- yield ContentTask.spawn(browser, "", function() {
- let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
- .getService(Ci.nsITooltipTextProvider);
- function checkElement(id, expectedTooltipText) {
- let el = content.document.getElementById(id);
- let textObj = {};
- let shouldHaveTooltip = expectedTooltipText !== null;
- is(tttp.getNodeText(el, textObj, {}), shouldHaveTooltip,
- "element " + id + " should " + (shouldHaveTooltip ? "" : "not ") + "have a tooltip");
- if (shouldHaveTooltip) {
- is(textObj.value, expectedTooltipText,
- "element " + id + " should have the right tooltip text");
- }
- }
- checkElement("svg1", "This is a non-root SVG element title");
- checkElement("text1", "\n\n\n This is a title\n\n ");
- checkElement("text2", null);
- checkElement("text3", null);
- checkElement("link1", "\n This is a title\n ");
- checkElement("text4", "\n This is a title\n ");
- checkElement("link2", null);
- checkElement("link3", "This is an xlink:title attribute");
- checkElement("link4", "This is an xlink:title attribute");
- checkElement("text5", null);
- });
- });
-});
-
diff --git a/toolkit/components/tooltiptext/tests/browser_bug331772_xul_tooltiptext_in_html.js b/toolkit/components/tooltiptext/tests/browser_bug331772_xul_tooltiptext_in_html.js
deleted file mode 100644
index 23d8c4a6e..000000000
--- a/toolkit/components/tooltiptext/tests/browser_bug331772_xul_tooltiptext_in_html.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Tests that the tooltiptext attribute is used for XUL elements in an HTML doc.
- */
-add_task(function*() {
- yield BrowserTestUtils.withNewTab({
- gBrowser,
- url: "http://mochi.test:8888/browser/toolkit/components/tooltiptext/tests/xul_tooltiptext.xhtml",
- }, function*(browser) {
- yield ContentTask.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");
- });
- });
-});
-
diff --git a/toolkit/components/tooltiptext/tests/browser_bug561623.js b/toolkit/components/tooltiptext/tests/browser_bug561623.js
deleted file mode 100644
index 49c51c4ba..000000000
--- a/toolkit/components/tooltiptext/tests/browser_bug561623.js
+++ /dev/null
@@ -1,24 +0,0 @@
-add_task(function*() {
- yield BrowserTestUtils.withNewTab({
- gBrowser,
- url: "data:text/html,<!DOCTYPE html><html><body><input id='i'></body></html>",
- }, function*(browser) {
- yield ContentTask.spawn(browser, "", function() {
- let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
- .getService(Ci.nsITooltipTextProvider);
- let i = content.document.getElementById("i");
-
- ok(!tttp.getNodeText(i, {}, {}),
- "No tooltip should be shown when @title is null");
-
- i.title = "foo";
- ok(tttp.getNodeText(i, {}, {}),
- "A tooltip should be shown when @title is not the empty string");
-
- i.pattern = "bar";
- ok(tttp.getNodeText(i, {}, {}),
- "A tooltip should be shown when @title is not the empty string");
- });
- });
-});
-
diff --git a/toolkit/components/tooltiptext/tests/browser_bug581947.js b/toolkit/components/tooltiptext/tests/browser_bug581947.js
deleted file mode 100644
index 034e0a4d1..000000000
--- a/toolkit/components/tooltiptext/tests/browser_bug581947.js
+++ /dev/null
@@ -1,87 +0,0 @@
-function check(aBrowser, aElementName, aBarred, aType) {
- return ContentTask.spawn(aBrowser, [aElementName, aBarred, aType], function*([aElementName, aBarred, aType]) {
- let e = content.document.createElement(aElementName);
- let contentElement = content.document.getElementById('content');
- contentElement.appendChild(e);
-
- if (aType) {
- e.type = aType;
- }
-
- let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
- .getService(Ci.nsITooltipTextProvider);
- ok(!tttp.getNodeText(e, {}, {}),
- "No tooltip should be shown when the element is valid");
-
- e.setCustomValidity('foo');
- if (aBarred) {
- ok(!tttp.getNodeText(e, {}, {}),
- "No tooltip should be shown when the element is barred from constraint validation");
- } else {
- ok(tttp.getNodeText(e, {}, {}),
- e.tagName + " " +"A tooltip should be shown when the element isn't valid");
- }
-
- e.setAttribute('title', '');
- ok (!tttp.getNodeText(e, {}, {}),
- "No tooltip should be shown if the title attribute is set");
-
- e.removeAttribute('title');
- contentElement.setAttribute('novalidate', '');
- ok (!tttp.getNodeText(e, {}, {}),
- "No tooltip should be shown if the novalidate attribute is set on the form owner");
- contentElement.removeAttribute('novalidate');
-
- e.remove();
- });
-}
-
-function todo_check(aBrowser, aElementName, aBarred) {
- return ContentTask.spawn(aBrowser, [aElementName, aBarred], function*([aElementName, aBarred]) {
- let e = content.document.createElement(aElementName);
- let contentElement = content.document.getElementById('content');
- contentElement.appendChild(e);
-
- let caught = false;
- try {
- e.setCustomValidity('foo');
- } catch (e) {
- caught = true;
- }
-
- todo(!caught, "setCustomValidity should exist for " + aElementName);
-
- e.remove();
- });
-}
-
-add_task(function*() {
- yield BrowserTestUtils.withNewTab({
- gBrowser,
- url: "data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>",
- }, function*(browser) {
- let testData = [
- /* element name, barred */
- [ 'input', false, null],
- [ 'textarea', false, null],
- [ 'button', true, 'button'],
- [ 'button', false, 'submit'],
- [ 'select', false, null],
- [ 'output', true, null],
- [ 'fieldset', true, null],
- [ 'object', true, null],
- ];
-
- for (let data of testData) {
- yield check(browser, data[0], data[1], data[2]);
- }
-
- let todo_testData = [
- [ 'keygen', 'false' ],
- ];
-
- for (let data of todo_testData) {
- yield todo_check(browser, data[0], data[1]);
- }
- });
-});
diff --git a/toolkit/components/tooltiptext/tests/browser_input_file_tooltips.js b/toolkit/components/tooltiptext/tests/browser_input_file_tooltips.js
deleted file mode 100644
index a1323095d..000000000
--- a/toolkit/components/tooltiptext/tests/browser_input_file_tooltips.js
+++ /dev/null
@@ -1,122 +0,0 @@
-
-let tempFile;
-add_task(function* setup() {
- yield new Promise(resolve => {
- SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
- });
- tempFile = createTempFile();
- registerCleanupFunction(function() {
- tempFile.remove(true);
- });
-});
-
-add_task(function* test_singlefile_selected() {
- yield do_test({value: true, result: "testfile_bug1251809"});
-});
-
-add_task(function* test_title_set() {
- yield do_test({title: "foo", result: "foo"});
-});
-
-add_task(function* test_nofile_selected() {
- yield do_test({result: "No file selected."});
-});
-
-add_task(function* test_multipleset_nofile_selected() {
- yield do_test({multiple: true, result: "No files selected."});
-});
-
-add_task(function* test_requiredset() {
- yield do_test({required: true, result: "Please select a file."});
-});
-
-function* do_test(test) {
- info(`starting test ${JSON.stringify(test)}`);
-
- let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);
-
- info("Moving mouse out of the way.");
- yield new Promise(resolve => {
- EventUtils.synthesizeNativeMouseMove(tab.linkedBrowser, 300, 300, resolve);
- });
-
- info("creating input field");
- yield ContentTask.spawn(tab.linkedBrowser, test, function*(test) {
- let doc = content.document;
- let input = doc.createElement("input");
- doc.body.appendChild(input);
- input.id = "test_input";
- input.setAttribute("style", "position: absolute; top: 0; left: 0;");
- input.type = "file";
- if (test.title) {
- input.setAttribute("title", test.title);
- }
- if (test.multiple) {
- input.multiple = true;
- }
- if (test.required) {
- input.required = true;
- }
- });
-
- if (test.value) {
- info("Creating mock filepicker to select files");
- let MockFilePicker = SpecialPowers.MockFilePicker;
- MockFilePicker.init(window);
- MockFilePicker.returnValue = MockFilePicker.returnOK;
- MockFilePicker.displayDirectory = FileUtils.getDir("TmpD", [], false);
- MockFilePicker.returnFiles = [tempFile];
-
- try {
- // Open the File Picker dialog (MockFilePicker) to select
- // the files for the test.
- yield BrowserTestUtils.synthesizeMouseAtCenter("#test_input", {}, tab.linkedBrowser);
- info("Waiting for the input to have the requisite files");
- yield ContentTask.spawn(tab.linkedBrowser, {}, function*() {
- let input = content.document.querySelector("#test_input");
- yield ContentTaskUtils.waitForCondition(() => input.files.length,
- "The input should have at least one file selected");
- info(`The input has ${input.files.length} file(s) selected.`);
- });
- } finally {
- MockFilePicker.cleanup();
- }
- } else {
- info("No real file selection required.");
- }
-
- let awaitTooltipOpen = new Promise(resolve => {
- let tooltipId = Services.appinfo.browserTabsRemoteAutostart ?
- "remoteBrowserTooltip" :
- "aHTMLTooltip";
- let tooltip = document.getElementById(tooltipId);
- tooltip.addEventListener("popupshown", function onpopupshown(event) {
- tooltip.removeEventListener("popupshown", onpopupshown);
- resolve(event.target);
- });
- });
- info("Initial mouse move");
- yield new Promise(resolve => {
- EventUtils.synthesizeNativeMouseMove(tab.linkedBrowser, 50, 5, resolve);
- });
- info("Waiting");
- yield new Promise(resolve => setTimeout(resolve, 400));
- info("Second mouse move");
- yield new Promise(resolve => {
- EventUtils.synthesizeNativeMouseMove(tab.linkedBrowser, 70, 5, resolve);
- });
- info("Waiting for tooltip to open");
- let tooltip = yield awaitTooltipOpen;
-
- is(tooltip.getAttribute("label"), test.result, "tooltip label should match expectation");
-
- info("Closing tab");
- yield BrowserTestUtils.removeTab(tab);
-}
-
-function createTempFile() {
- let file = FileUtils.getDir("TmpD", [], false);
- file.append("testfile_bug1251809");
- file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
- return file;
-}
diff --git a/toolkit/components/tooltiptext/tests/title_test.svg b/toolkit/components/tooltiptext/tests/title_test.svg
deleted file mode 100644
index 7638fd5cc..000000000
--- a/toolkit/components/tooltiptext/tests/title_test.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-<svg width="640px" height="480px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <title>This is a root SVG element's title</title>
- <foreignObject>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <body>
- <svg xmlns="http://www.w3.org/2000/svg" id="svg1">
- <title>This is a non-root SVG element title</title>
- </svg>
- </body>
- </html>
- </foreignObject>
- <text id="text1" x="10px" y="32px" font-size="24px">
- This contains only &lt;title&gt;
- <title>
-
-
- This is a title
-
- </title>
- </text>
- <text id="text2" x="10px" y="96px" font-size="24px">
- This contains only &lt;desc&gt;
- <desc>This is a desc</desc>
- </text>
- <text id="text3" x="10px" y="128px" font-size="24px" title="ignored for SVG">
- This contains nothing.
- </text>
- <a id="link1" xlink:href="#">
- This link contains &lt;title&gt;
- <title>
- This is a title
- </title>
- <text id="text4" x="10px" y="192px" font-size="24px">
- </text>
- </a>
- <a id="link2" xlink:href="#">
- <text x="10px" y="192px" font-size="24px">
- This text contains &lt;title&gt;
- <title>
- This is a title
- </title>
- </text>
- </a>
- <a id="link3" xlink:href="#" xlink:title="This is an xlink:title attribute">
- <text x="10px" y="224px" font-size="24px">
- This link contains &lt;title&gt; &amp; xlink:title attr.
- <title>This is a title</title>
- </text>
- </a>
- <a id="link4" xlink:href="#" xlink:title="This is an xlink:title attribute">
- <text x="10px" y="256px" font-size="24px">
- This link contains xlink:title attr.
- </text>
- </a>
- <text id="text5" x="10px" y="160px" font-size="24px"
- xlink:title="This is an xlink:title attribute but it isn't on a link" >
- This contains nothing.
- </text>
-</svg>
diff --git a/toolkit/components/tooltiptext/tests/xul_tooltiptext.xhtml b/toolkit/components/tooltiptext/tests/xul_tooltiptext.xhtml
deleted file mode 100644
index 4a80864dd..000000000
--- a/toolkit/components/tooltiptext/tests/xul_tooltiptext.xhtml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <xul:toolbox xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <toolbar>
- <toolbarbutton id="xulToolbarButton"
- tooltiptext="XUL tooltiptext"
- title="XUL title"/>
- </toolbar>
- </xul:toolbox>
-</html>
-
-