Sha256: c19c16d2715427fdcefa977be0b211638ca0e95fd737a75ed47b413b331e3abb

Contents?: true

Size: 1.77 KB

Versions: 15

Compression:

Stored size: 1.77 KB

Contents

namespace = "comment_";

(function() {
  function test(name, mode, run, before, after) {
    return testCM(name, function(cm) {
      run(cm);
      eq(cm.getValue(), after);
    }, {value: before, mode: mode});
  }

  var simpleProg = "function foo() {\n  return bar;\n}";

  test("block", "javascript", function(cm) {
    cm.blockComment(Pos(0, 3), Pos(3, 0), {blockCommentLead: " *"});
  }, simpleProg + "\n", "/* function foo() {\n *   return bar;\n * }\n */");

  test("blockToggle", "javascript", function(cm) {
    cm.blockComment(Pos(0, 3), Pos(2, 0), {blockCommentLead: " *"});
    cm.uncomment(Pos(0, 3), Pos(2, 0), {blockCommentLead: " *"});
  }, simpleProg, simpleProg);

  test("line", "javascript", function(cm) {
    cm.lineComment(Pos(1, 1), Pos(1, 1));
  }, simpleProg, "function foo() {\n//   return bar;\n}");

  test("lineToggle", "javascript", function(cm) {
    cm.lineComment(Pos(0, 0), Pos(2, 1));
    cm.uncomment(Pos(0, 0), Pos(2, 1));
  }, simpleProg, simpleProg);

  test("fallbackToBlock", "css", function(cm) {
    cm.lineComment(Pos(0, 0), Pos(2, 1));
  }, "html {\n  border: none;\n}", "/* html {\n  border: none;\n} */");

  test("fallbackToLine", "ruby", function(cm) {
    cm.blockComment(Pos(0, 0), Pos(1));
  }, "def blah()\n  return hah\n", "# def blah()\n#   return hah\n");

  test("commentRange", "javascript", function(cm) {
    cm.blockComment(Pos(1, 2), Pos(1, 13), {fullLines: false});
  }, simpleProg, "function foo() {\n  /*return bar;*/\n}");

  test("indented", "javascript", function(cm) {
    cm.lineComment(Pos(1, 0), Pos(2), {indent: true});
  }, simpleProg, "function foo() {\n  // return bar;\n  // }");

  test("singleEmptyLine", "javascript", function(cm) {
    cm.setCursor(1);
    cm.execCommand("toggleComment");
  }, "a;\n\nb;", "a;\n// \nb;");
})();

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
gump-0.1.6 server/assets/js/jquery.codemirror/test/comment_test.js
poly-cms-0.1.2 core/admin/assets/js/vendor/codemirror/test/comment_test.js
poly-cms-0.1.1 core/admin/assets/js/vendor/codemirror/test/comment_test.js
poly-cms-0.1.0 core/admin/assets/js/vendor/codemirror/test/comment_test.js
bonethug-0.0.17 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.16 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.15 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.14 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.13 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.12 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.11 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.10 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.7 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.6 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js
bonethug-0.0.5 skel/project_types/silverstripe3/public/abc/lib/codemirror/test/comment_test.js