Moved a bunch of tests to QUnit. Added basic Discourse.Site support to test suite.

This commit is contained in:
Robin Ward
2013-06-17 11:38:30 -04:00
parent 2174c0d661
commit 797b99db7c
14 changed files with 112 additions and 259 deletions

View File

@ -0,0 +1,19 @@
/*global module:true test:true ok:true visit:true expect:true exists:true count:true equal:true */
module("Discourse.Composer");
test('replyLength', function() {
var replyLength = function(val, expectedLength, text) {
var composer = Discourse.Composer.create({ reply: val });
equal(composer.get('replyLength'), expectedLength);
};
replyLength("basic reply", 11, "basic reply length");
replyLength(" \nbasic reply\t", 11, "trims whitespaces");
replyLength("ba sic\n\nreply", 12, "count only significant whitespaces");
replyLength("1[quote=]not counted[/quote]2[quote=]at all[/quote]3", 3, "removes quotes");
replyLength("1[quote=]not[quote=]counted[/quote]yay[/quote]2", 2, "handles nested quotes correctly");
})