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: let gTabsize; michael@0: michael@0: function runTests(sw) michael@0: { michael@0: gTabsize = Services.prefs.getIntPref("devtools.editor.tabsize"); michael@0: Services.prefs.setIntPref("devtools.editor.tabsize", 6); michael@0: const space = " ".repeat(6); 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(space)); michael@0: finish(); michael@0: }).then(null, error => { michael@0: ok(false, error); michael@0: }); michael@0: } michael@0: michael@0: registerCleanupFunction(function () { michael@0: Services.prefs.setIntPref("devtools.editor.tabsize", gTabsize); michael@0: gTabsize = null; michael@0: });