browser/devtools/scratchpad/test/browser_scratchpad_goto_line_ui.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /* vim: set ts=2 et sw=2 tw=80: */
     2 /* Any copyright is dedicated to the Public Domain.
     3    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /* Bug 714942 */
     6 function test()
     7 {
     8   waitForExplicitFinish();
    10   gBrowser.selectedTab = gBrowser.addTab();
    11   gBrowser.selectedBrowser.addEventListener("load", function browserLoad() {
    12     gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true);
    13     openScratchpad(runTests);
    14   }, true);
    16   content.location = "data:text/html,<p>test the 'Jump to line' feature in Scratchpad";
    17 }
    19 function runTests(aWindow, aScratchpad)
    20 {
    21   let editor = aScratchpad.editor;
    22   let text = "foobar bug650345\nBug650345 bazbaz\nfoobar omg\ntest";
    23   editor.setText(text);
    24   editor.setCursor({ line: 0, ch: 0 });
    26   let oldPrompt = editor.openDialog;
    27   let desiredValue;
    29   editor.openDialog = function (text, cb) {
    30     cb(desiredValue);
    31   };
    33   desiredValue = 3;
    34   EventUtils.synthesizeKey("J", {accelKey: true}, aWindow);
    35   is(editor.getCursor().line, 2, "line is correct");
    37   desiredValue = 2;
    38   aWindow.goDoCommand("cmd_gotoLine")
    39   is(editor.getCursor().line, 1, "line is correct (again)");
    41   editor.openDialog = oldPrompt;
    42   finish();
    43 }

mercurial