|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 let content = "line 1\nline 2\nline 3"; |
|
6 let runningPlainText = false; |
|
7 |
|
8 function test() { |
|
9 waitForExplicitFinish(); |
|
10 |
|
11 testViewSourceWindow("data:text/html," + encodeURIComponent(content), checkViewSource, function() { |
|
12 testViewSourceWindow("data:text/plain," + encodeURIComponent(content), checkViewSource, finish); |
|
13 }); |
|
14 } |
|
15 |
|
16 function checkViewSource(aWindow) { |
|
17 is(aWindow.gBrowser.contentDocument.body.textContent, content, "Correct content loaded"); |
|
18 |
|
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 } |