Created
December 9, 2013 23:42
-
-
Save jokeyrhyme/7883136 to your computer and use it in GitHub Desktop.
quick assertions for demonstrating JavaScript stuff in jsFiddle, codepen, etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p.failed { | |
color: red; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function assert(expected, message) { | |
var p$ = $('<p></p>'); | |
if (!expected) { | |
p$.addClass('failed'); | |
} | |
p$.text(message); | |
p$.appendTo(document.body); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment