mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Moved a bunch of tests to QUnit. Added basic Discourse.Site
support to test suite.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*jshint maxlen:250 */
|
||||
/*global count:true find:true document:true */
|
||||
/*global count:true find:true document:true equal:true */
|
||||
|
||||
//= require env
|
||||
|
||||
@ -57,4 +57,24 @@ function exists(selector) {
|
||||
|
||||
function count(selector) {
|
||||
return find(selector).length;
|
||||
}
|
||||
}
|
||||
|
||||
function objBlank(obj) {
|
||||
if (obj === undefined) return true;
|
||||
|
||||
switch (typeof obj) {
|
||||
case "string":
|
||||
return obj.trim().length === 0;
|
||||
case "object":
|
||||
return $.isEmptyObject(obj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function present(obj, text) {
|
||||
equal(objBlank(obj), false, text);
|
||||
}
|
||||
|
||||
function blank(obj, text) {
|
||||
equal(objBlank(obj), true, text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user