Refactor: Move Topic Details into better objects, identity map, tests, query string filters

This commit is contained in:
Robin Ward
2013-06-20 17:20:08 -04:00
parent d051e35000
commit 5770879472
56 changed files with 1854 additions and 1244 deletions

View File

@ -1,7 +1,11 @@
// Test helpers
var resolvingPromise = Ember.Deferred.promise(function (p) {
p.resolve();
})
});
var resolvingPromiseWith = function(result) {
return Ember.Deferred.promise(function (p) { p.resolve(result); });
};
function exists(selector) {
return !!count(selector);
@ -11,22 +15,14 @@ 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);
ok(!Ember.isEmpty(obj), text);
}
function blank(obj, text) {
equal(objBlank(obj), true, text);
ok(Ember.isEmpty(obj), text);
}
function containsInstance(collection, klass, text) {
ok(klass.detectInstance(_.first(collection)), text);
}