browser/devtools/scratchpad/test/browser_scratchpad_pprint.js

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:e0d16d208fae
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
5 function test()
6 {
7 waitForExplicitFinish();
8
9 gBrowser.selectedTab = gBrowser.addTab();
10 gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
11 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
12 openScratchpad(runTests);
13 }, true);
14
15 content.location = "data:text/html;charset=utf8,test Scratchpad pretty print.";
16 }
17
18 function runTests(sw)
19 {
20 const sp = sw.Scratchpad;
21 sp.setText("function main() { console.log(5); }");
22 sp.prettyPrint().then(() => {
23 const prettyText = sp.getText();
24 ok(prettyText.contains("\n"));
25 finish();
26 }).then(null, error => {
27 ok(false, error);
28 });
29 }

mercurial