toolkit/content/tests/browser/browser_input_file_tooltips.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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