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 | |
michael@0 | 3 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 6 | |
michael@0 | 7 | |
michael@0 | 8 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 9 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 10 | |
michael@0 | 11 | <window title="Textbox with placeholder test" width="500" height="600" |
michael@0 | 12 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 13 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 14 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 15 | |
michael@0 | 16 | <hbox> |
michael@0 | 17 | <textbox id="t1" placeholder="empty"/> |
michael@0 | 18 | </hbox> |
michael@0 | 19 | |
michael@0 | 20 | <hbox> |
michael@0 | 21 | <textbox id="t2" placeholder="empty"/> |
michael@0 | 22 | </hbox> |
michael@0 | 23 | |
michael@0 | 24 | <!-- test results are displayed in the html:body --> |
michael@0 | 25 | <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"> |
michael@0 | 26 | <p id="display"> |
michael@0 | 27 | </p> |
michael@0 | 28 | <div id="content" style="display: none"> |
michael@0 | 29 | </div> |
michael@0 | 30 | <pre id="test"> |
michael@0 | 31 | </pre> |
michael@0 | 32 | </body> |
michael@0 | 33 | |
michael@0 | 34 | <!-- test code goes here --> |
michael@0 | 35 | <script type="application/javascript"><![CDATA[ |
michael@0 | 36 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 37 | |
michael@0 | 38 | function doTest() { |
michael@0 | 39 | var t1 = $("t1"); |
michael@0 | 40 | var t2 = $("t2"); |
michael@0 | 41 | setTextboxValue(t1, "1"); |
michael@0 | 42 | var t1Enabled = {}; |
michael@0 | 43 | var t1CanUndo = {}; |
michael@0 | 44 | t1.editor.canUndo(t1Enabled, t1CanUndo); |
michael@0 | 45 | is(t1CanUndo.value, true, |
michael@0 | 46 | "undo correctly enabled when placeholder was not changed through property"); |
michael@0 | 47 | |
michael@0 | 48 | t2.placeholder = "reallyempty"; |
michael@0 | 49 | setTextboxValue(t2, "2"); |
michael@0 | 50 | var t2Enabled = {}; |
michael@0 | 51 | var t2CanUndo = {}; |
michael@0 | 52 | t2.editor.canUndo(t2Enabled, t2CanUndo); |
michael@0 | 53 | is(t2CanUndo.value, true, |
michael@0 | 54 | "undo correctly enabled when placeholder explicitly changed through property"); |
michael@0 | 55 | |
michael@0 | 56 | SimpleTest.finish(); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | function setTextboxValue(textbox, value) { |
michael@0 | 60 | textbox.focus(); |
michael@0 | 61 | for (var i = 0; i < value.length; ++i) { |
michael@0 | 62 | synthesizeKey(value.charAt(i), {}); |
michael@0 | 63 | } |
michael@0 | 64 | textbox.blur(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | SimpleTest.waitForFocus(doTest); |
michael@0 | 68 | |
michael@0 | 69 | ]]></script> |
michael@0 | 70 | |
michael@0 | 71 | </window> |