toolkit/content/tests/browser/browser_input_file_tooltips.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 function test()
michael@0 2 {
michael@0 3 let data = [
michael@0 4 { value: "/tmp", result: "tmp" },
michael@0 5 { title: "foo", result: "foo" },
michael@0 6 { result: "No file selected." },
michael@0 7 { multiple: true, result: "No files selected." },
michael@0 8 { required: true, result: "Please select a file." }
michael@0 9 ];
michael@0 10
michael@0 11 let doc = gBrowser.contentDocument;
michael@0 12 let tooltip = document.getElementById("aHTMLTooltip");
michael@0 13
michael@0 14 for (let test of data) {
michael@0 15 let input = doc.createElement('input');
michael@0 16 doc.body.appendChild(input);
michael@0 17 input.type = 'file';
michael@0 18 if (test.title) {
michael@0 19 input.setAttribute('title', test.title);
michael@0 20 }
michael@0 21 if (test.value) {
michael@0 22 if (test.value == "/tmp" && navigator.platform.indexOf('Win') != -1) {
michael@0 23 test.value = "C:\\Temp";
michael@0 24 test.result = "Temp";
michael@0 25 }
michael@0 26 input.value = test.value;
michael@0 27 }
michael@0 28 if (test.multiple) {
michael@0 29 input.multiple = true;
michael@0 30 }
michael@0 31 if (test.required) {
michael@0 32 input.required = true;
michael@0 33 }
michael@0 34
michael@0 35 ok(tooltip.fillInPageTooltip(input));
michael@0 36 is(tooltip.getAttribute('label'), test.result);
michael@0 37 }
michael@0 38 }

mercurial