browser/devtools/scratchpad/test/browser_scratchpad_goto_line_ui.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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