Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | XUL Widget Test for basic properties - this test checks that the basic |
michael@0 | 6 | properties defined in general.xml and inherited by a number of elements |
michael@0 | 7 | work properly. |
michael@0 | 8 | --> |
michael@0 | 9 | <window title="Basic Properties Test" |
michael@0 | 10 | onload="setTimeout(test_props, 0);" |
michael@0 | 11 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 16 | |
michael@0 | 17 | <command id="cmd_nothing"/> |
michael@0 | 18 | <command id="cmd_action"/> |
michael@0 | 19 | |
michael@0 | 20 | <button id="button" label="Button" accesskey="B" |
michael@0 | 21 | crop="end" image="happy.png" command="cmd_nothing"/> |
michael@0 | 22 | <checkbox id="checkbox" label="Checkbox" accesskey="B" |
michael@0 | 23 | crop="end" image="happy.png" command="cmd_nothing"/> |
michael@0 | 24 | <radiogroup> |
michael@0 | 25 | <radio id="radio" label="Radio Button" value="rb1" accesskey="B" |
michael@0 | 26 | crop="end" image="happy.png" command="cmd_nothing"/> |
michael@0 | 27 | </radiogroup> |
michael@0 | 28 | |
michael@0 | 29 | <!-- test results are displayed in the html:body --> |
michael@0 | 30 | <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/> |
michael@0 | 31 | |
michael@0 | 32 | <!-- test code goes here --> |
michael@0 | 33 | <script type="application/javascript"><![CDATA[ |
michael@0 | 34 | |
michael@0 | 35 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 36 | |
michael@0 | 37 | function test_props() |
michael@0 | 38 | { |
michael@0 | 39 | test_props_forelement($("button"), "Button", null); |
michael@0 | 40 | test_props_forelement($("checkbox"), "Checkbox", null); |
michael@0 | 41 | test_props_forelement($("radio"), "Radio Button", "rb1"); |
michael@0 | 42 | |
michael@0 | 43 | SimpleTest.finish(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function test_props_forelement(element, label, value) |
michael@0 | 47 | { |
michael@0 | 48 | // check the initial values |
michael@0 | 49 | is(element.label, label, "element label"); |
michael@0 | 50 | if (value) |
michael@0 | 51 | is(element.value, value, "element value"); |
michael@0 | 52 | is(element.accessKey, "B", "element accessKey"); |
michael@0 | 53 | is(element.crop, "end", "element crop"); |
michael@0 | 54 | is(element.image, "happy.png", "element image"); |
michael@0 | 55 | is(element.command, "cmd_nothing", "element command"); |
michael@0 | 56 | ok(element.tabIndex === 0, "element tabIndex"); |
michael@0 | 57 | |
michael@0 | 58 | synthesizeMouseExpectEvent(element, 4, 4, { }, $("cmd_nothing"), "command", "element"); |
michael@0 | 59 | |
michael@0 | 60 | // make sure that setters return the value |
michael@0 | 61 | is(element.label = "Label", "Label", "element label setter return"); |
michael@0 | 62 | if (value) |
michael@0 | 63 | is(element.value = "lb", "lb", "element value setter return"); |
michael@0 | 64 | is(element.accessKey = "L", "L", "element accessKey setter return"); |
michael@0 | 65 | is(element.crop = "start", "start", "element crop setter return"); |
michael@0 | 66 | is(element.image = "sad.png", "sad.png", "element image setter return"); |
michael@0 | 67 | is(element.command = "cmd_action", "cmd_action", "element command setter return"); |
michael@0 | 68 | |
michael@0 | 69 | // check the value after it was changed |
michael@0 | 70 | is(element.label, "Label", "element label after set"); |
michael@0 | 71 | if (value) |
michael@0 | 72 | is(element.value, "lb", "element value after set"); |
michael@0 | 73 | is(element.accessKey, "L", "element accessKey after set"); |
michael@0 | 74 | is(element.crop, "start", "element crop after set"); |
michael@0 | 75 | is(element.image, "sad.png", "element image after set"); |
michael@0 | 76 | is(element.command, "cmd_action", "element command after set"); |
michael@0 | 77 | |
michael@0 | 78 | synthesizeMouseExpectEvent(element, 4, 4, { }, $("cmd_action"), "command", "element"); |
michael@0 | 79 | |
michael@0 | 80 | // check that clicks on disabled items don't fire a command event |
michael@0 | 81 | ok((element.disabled = true) === true, "element disabled setter return"); |
michael@0 | 82 | ok(element.disabled === true, "element disabled after set"); |
michael@0 | 83 | synthesizeMouseExpectEvent(element, 4, 4, { }, $("cmd_action"), "!command", "element"); |
michael@0 | 84 | |
michael@0 | 85 | element.disabled = false; |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | ]]> |
michael@0 | 89 | </script> |
michael@0 | 90 | |
michael@0 | 91 | </window> |