toolkit/components/viewsource/test/browser/browser_gotoline.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 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 let content = "line 1\nline 2\nline 3";
     6 let runningPlainText = false;
     8 function test() {
     9   waitForExplicitFinish();
    11   testViewSourceWindow("data:text/html," + encodeURIComponent(content), checkViewSource, function() {
    12     testViewSourceWindow("data:text/plain," + encodeURIComponent(content), checkViewSource, finish);
    13   });
    14 }
    16 function checkViewSource(aWindow) {
    17   is(aWindow.gBrowser.contentDocument.body.textContent, content, "Correct content loaded");
    19   let selection = aWindow.gBrowser.contentWindow.getSelection();
    20   let statusPanel = aWindow.document.getElementById("statusbar-line-col");
    21   is(statusPanel.getAttribute("label"), "", "Correct status bar text");
    22   for (let i = 1; i <= 3; i++) {
    23     aWindow.goToLine(i);
    24     is(selection.toString(), "line " + i, "Correct text selected");
    25     is(statusPanel.getAttribute("label"), "Line " + i + ", Col 1", "Correct status bar text");
    26   }
    27 }

mercurial