michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: openScratchpad(runTests); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html;charset=utf8,test Scratchpad pretty print."; michael@0: } michael@0: michael@0: function runTests(sw) michael@0: { michael@0: const sp = sw.Scratchpad; michael@0: sp.setText("function main() { console.log(5); }"); michael@0: sp.prettyPrint().then(() => { michael@0: const prettyText = sp.getText(); michael@0: ok(prettyText.contains("\n")); michael@0: finish(); michael@0: }).then(null, error => { michael@0: ok(false, error); michael@0: }); michael@0: }