tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_input_value_set_preserve_undo.xhtml (1348B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
      4 <window title="Bug 1676785"
      5  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      6  xmlns:html="http://www.w3.org/1999/xhtml"
      7  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      8 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      9 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
     10 <html:body>
     11  <xul:hbox>
     12    <html:input id="xul" />
     13  </xul:hbox>
     14  <html:div>
     15    <html:input id="non-xul" />
     16  </html:div>
     17 </html:body>
     18 <script class="testbody">
     19 SimpleTest.waitForExplicitFinish();
     20 
     21 function shouldPreserveHistory(input, preserve) {
     22  input.focus();
     23  input.value = "abc";
     24  input.value = "def";
     25  let ctrl = navigator.platform.indexOf("Mac") == 0 ? { metaKey: true } : { ctrlKey: true };
     26  synthesizeKey("z", ctrl);
     27  (preserve ? is : isnot)(input.value, "abc", `Expected ${input.id} to ${preserve ? "" : "not "}preserve undo history when setting .value`);
     28 }
     29 
     30 window.onload = function() {
     31  shouldPreserveHistory(document.getElementById("xul"), true);
     32  shouldPreserveHistory(document.getElementById("non-xul"), false);
     33 
     34  SimpleTest.finish();
     35 }
     36 </script>
     37 </window>