Created
February 25, 2014 01:22
-
-
Save DingoEatingFuzz/9200768 to your computer and use it in GitHub Desktop.
withAsserts helper for including QUnit asserts
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
window.withAsserts = function() { | |
var asserts = []; | |
var args = Array.prototype.slice.call(arguments); | |
for (var i = 0, len = args.length; i < len; ++i) { | |
var split = args[i].split(' '); | |
asserts = asserts.concat(split); | |
} | |
for (i = 0, len = asserts.length; i < len; ++i) { | |
var key = asserts[i]; | |
if (QUnit.assert[key]) { | |
if (window[key]) { | |
console.warn( | |
'An included assert has overriden an existing object:', | |
window[key] | |
); | |
} | |
window[key] = QUnit.assert[key]; | |
} | |
} | |
} | |
window.withAsserts( | |
'no', | |
'equalIgnoringWhitespace', | |
'equalAfterTrimming' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment