browser_scratchpad_long_string.js 776 B

123456789101112131415161718192021222324252627282930
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. function test()
  4. {
  5. waitForExplicitFinish();
  6. gBrowser.selectedTab = gBrowser.addTab();
  7. gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
  8. gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
  9. openScratchpad(runTests);
  10. }, true);
  11. content.location = "data:text/html;charset=utf8,<p>test long string in Scratchpad</p>";
  12. }
  13. function runTests()
  14. {
  15. let sp = gScratchpadWindow.Scratchpad;
  16. sp.setText("'0'.repeat(10000)");
  17. sp.display().then(() => {
  18. is(sp.getText(), "'0'.repeat(10000)\n" +
  19. "/*\n" + "0".repeat(10000) + "\n*/",
  20. "display()ing a long string works");
  21. finish();
  22. });
  23. }