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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=595310 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 595310</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=595310">Mozilla Bug 595310</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content"> |
michael@0 | 16 | <input id='i' value="bar"> |
michael@0 | 17 | <textarea id='t'>bar</textarea> |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script type="application/javascript"> |
michael@0 | 21 | |
michael@0 | 22 | /** Test for Bug 595310 **/ |
michael@0 | 23 | |
michael@0 | 24 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 25 | |
michael@0 | 26 | addLoadEvent(function() { |
michael@0 | 27 | // We want to compare to value="bar" and no placeholder shown. |
michael@0 | 28 | // That is what is currently showed. |
michael@0 | 29 | var s1 = snapshotWindow(window, false); |
michael@0 | 30 | |
michael@0 | 31 | var content = document.getElementById('content'); |
michael@0 | 32 | var i = document.getElementById('i'); |
michael@0 | 33 | var t = SpecialPowers.wrap(document.getElementById('t')); |
michael@0 | 34 | i.value = ""; i.placeholder = "foo"; |
michael@0 | 35 | t.value = ""; t.placeholder = "foo"; |
michael@0 | 36 | |
michael@0 | 37 | // Flushing. |
michael@0 | 38 | // Note: one call would have been enough actually but I didn't want to favour |
michael@0 | 39 | // one element... ;) |
michael@0 | 40 | i.getBoundingClientRect(); |
michael@0 | 41 | t.getBoundingClientRect(); |
michael@0 | 42 | |
michael@0 | 43 | function synthesizeDropText(aElement, aText) |
michael@0 | 44 | { |
michael@0 | 45 | var editor = SpecialPowers.wrap(aElement) |
michael@0 | 46 | .QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement) |
michael@0 | 47 | .editor |
michael@0 | 48 | .QueryInterface(SpecialPowers.Ci.nsIPlaintextEditor); |
michael@0 | 49 | |
michael@0 | 50 | editor.insertText(aText); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | // We insert "bar" and we should only see "bar" now. |
michael@0 | 54 | synthesizeDropText(i, "bar"); |
michael@0 | 55 | synthesizeDropText(t, "bar"); |
michael@0 | 56 | |
michael@0 | 57 | var s2 = snapshotWindow(window, false); |
michael@0 | 58 | |
michael@0 | 59 | ok(compareSnapshots(s1, s2, true)[0], |
michael@0 | 60 | "When setting the value, the placeholder should disappear."); |
michael@0 | 61 | |
michael@0 | 62 | SimpleTest.finish(); |
michael@0 | 63 | }); |
michael@0 | 64 | |
michael@0 | 65 | |
michael@0 | 66 | </script> |
michael@0 | 67 | </pre> |
michael@0 | 68 | </body> |
michael@0 | 69 | </html> |