michael@0: function test() michael@0: { michael@0: let data = [ michael@0: { value: "/tmp", result: "tmp" }, michael@0: { title: "foo", result: "foo" }, michael@0: { result: "No file selected." }, michael@0: { multiple: true, result: "No files selected." }, michael@0: { required: true, result: "Please select a file." } michael@0: ]; michael@0: michael@0: let doc = gBrowser.contentDocument; michael@0: let tooltip = document.getElementById("aHTMLTooltip"); michael@0: michael@0: for (let test of data) { michael@0: let input = doc.createElement('input'); michael@0: doc.body.appendChild(input); michael@0: input.type = 'file'; michael@0: if (test.title) { michael@0: input.setAttribute('title', test.title); michael@0: } michael@0: if (test.value) { michael@0: if (test.value == "/tmp" && navigator.platform.indexOf('Win') != -1) { michael@0: test.value = "C:\\Temp"; michael@0: test.result = "Temp"; michael@0: } michael@0: input.value = test.value; michael@0: } michael@0: if (test.multiple) { michael@0: input.multiple = true; michael@0: } michael@0: if (test.required) { michael@0: input.required = true; michael@0: } michael@0: michael@0: ok(tooltip.fillInPageTooltip(input)); michael@0: is(tooltip.getAttribute('label'), test.result); michael@0: } michael@0: }