Sha256: 0fe5b25dfe5f752c073a4c85c068188dfa9cbfc8c3a28f47257a644c6616c07b

Contents?: true

Size: 1.59 KB

Versions: 39

Compression:

Stored size: 1.59 KB

Contents

/**
 * Test Harness for CodeMirror
 * JS-unit compatible tests here.  The two available assertions are
 * assertEquals (strict equality) and assertEquivalent (looser equivalency).
 *
 * 'editor' is a global object for the CodeMirror editor shared between all
 * tests.  After manipulating it in each test, try to restore it to
 * approximately its original state.
 */

function testSetGet() {
  var code = 'It was the best of times.\nIt was the worst of times.';
  editor.setCode(code);
  assertEquals(code, editor.getCode());
  editor.setCode('');
  assertEquals('', editor.getCode());
}

function testSetStylesheet() {
  function cssStatus() {
    // Returns a list of tuples, for each CSS link return the filename and
    // whether it is enabled.
    links = editor.win.document.getElementsByTagName('link');
    css = [];
    for (var x = 0, link; link = links[x]; x++) {
      if (link.rel.indexOf("stylesheet") !== -1) {
        css.push([link.href.substring(link.href.lastIndexOf('/') + 1),
                 !link.disabled])
      }
    }
    return css;
  }
  assertEquivalent([], cssStatus());
  editor.setStylesheet('css/jscolors.css');
  assertEquivalent([['jscolors.css', true]], cssStatus());
  editor.setStylesheet(['css/csscolors.css', 'css/xmlcolors.css']);
  assertEquivalent([['jscolors.css', false], ['csscolors.css', true], ['xmlcolors.css', true]], cssStatus());
  editor.setStylesheet([]);
  assertEquivalent([['jscolors.css', false], ['csscolors.css', false], ['xmlcolors.css', false]], cssStatus());
}

// Update this list of tests as new ones are added.
var tests = ['testSetGet', 'testSetStylesheet'];

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
erp_app-3.1.16 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.15 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.14 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.13 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.12 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.11 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.10 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.9 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.8 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.7 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.6 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.5 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.4 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.3 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.2 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.0.16 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.0.15 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.1 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.1.0 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js
erp_app-3.0.14 public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js