Skip to content

Instantly share code, notes, and snippets.

@toolness
Created August 16, 2012 02:14

Revisions

  1. toolness created this gist Aug 16, 2012.
    32 changes: 32 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    (function(jQuery) {
    var $ = jQuery;

    function test(name, selectors, css) {
    console.log("CSS test: " + name);
    selectors.forEach(function(selector) {
    var passed = 0;
    var elements = $(selector);
    if (!elements.length)
    return console.error(" FAIL - nothing matches " + selector);
    elements.each(function() {
    var $el = $(this);
    for (var property in css) {
    var value = $el.css(property);
    if (!value.match(css[property]))
    return console.error(" FAIL - " + selector + " " + property +
    " is " + value + ", not " + css[property]);
    }
    passed++;
    });
    if (elements.length == passed)
    console.log(" OK - " + selector + " (" + passed + ")");
    });
    }

    test("font is Ubuntu Mono", [
    ".CodeMirror", ".CodeMirror-lines", ".CodeMirror textarea",
    ".CodeMirror-gutter-text", ".cm-s-jsbin span.cm-comment"
    ], {
    'font-family': /Ubuntu Mono/
    });
    })(jQuery);