mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Cleaned up QUnit test structure
This commit is contained in:
32
test/javascripts/helpers/assertions.js
Normal file
32
test/javascripts/helpers/assertions.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// Test helpers
|
||||
var resolvingPromise = Ember.Deferred.promise(function (p) {
|
||||
p.resolve();
|
||||
})
|
||||
|
||||
function exists(selector) {
|
||||
return !!count(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);
|
||||
}
|
||||
11
test/javascripts/helpers/qunit_helpers.js
Normal file
11
test/javascripts/helpers/qunit_helpers.js
Normal file
@@ -0,0 +1,11 @@
|
||||
function integration(name) {
|
||||
module(name, {
|
||||
setup: function() {
|
||||
Ember.run(Discourse, Discourse.advanceReadiness);
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
Discourse.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user