browser/devtools/sourceeditor/test/browser_editor_addons.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/sourceeditor/test/browser_editor_addons.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +"use strict";
     1.8 +
     1.9 +function test() {
    1.10 +  waitForExplicitFinish();
    1.11 +
    1.12 +  setup((ed, win) => {
    1.13 +    let doc = win.document.querySelector("iframe").contentWindow.document;
    1.14 +
    1.15 +    // trailingspace.js
    1.16 +    ed.setText("Hello   ");
    1.17 +    ed.setOption("showTrailingSpace", false);
    1.18 +    ok(!doc.querySelector(".cm-trailingspace"));
    1.19 +    ed.setOption("showTrailingSpace", true);
    1.20 +    ok(doc.querySelector(".cm-trailingspace"));
    1.21 +
    1.22 +    // foldcode.js and foldgutter.js
    1.23 +    ed.setMode(Editor.modes.js);
    1.24 +    ed.setText("function main() {\nreturn 'Hello, World!';\n}");
    1.25 +    executeSoon(() => testFold(doc, ed, win));
    1.26 +  });
    1.27 +}
    1.28 +
    1.29 +function testFold(doc, ed, win) {
    1.30 +  // Wait until folding arrow is there.
    1.31 +  if (!doc.querySelector(".CodeMirror-foldgutter-open")) {
    1.32 +    executeSoon(() => testFold(doc, ed, win));
    1.33 +    return;
    1.34 +  }
    1.35 +
    1.36 +  teardown(ed, win);
    1.37 +}
    1.38 \ No newline at end of file

mercurial