2015-04-08 14:17:21 -04:00
|
|
|
import Presence from 'discourse/mixins/presence';
|
2013-06-18 11:35:51 -04:00
|
|
|
|
2015-04-08 14:17:21 -04:00
|
|
|
module("mixin:presence");
|
|
|
|
|
|
|
|
var testObj = Em.Object.createWithMixins(Presence, {
|
2013-06-18 11:35:51 -04:00
|
|
|
emptyString: "",
|
|
|
|
nonEmptyString: "Evil Trout",
|
|
|
|
emptyArray: [],
|
|
|
|
nonEmptyArray: [1, 2, 3],
|
2013-06-18 13:44:20 -04:00
|
|
|
age: 34
|
2013-06-18 11:35:51 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test("present", function() {
|
|
|
|
ok(testObj.present('nonEmptyString'), "Non empty strings are present");
|
|
|
|
ok(!testObj.present('emptyString'), "Empty strings are not present");
|
|
|
|
ok(testObj.present('nonEmptyArray'), "Non Empty Arrays are present");
|
|
|
|
ok(!testObj.present('emptyArray'), "Empty arrays are not present");
|
|
|
|
ok(testObj.present('age'), "integers are present");
|
|
|
|
});
|
|
|
|
|
|
|
|
test("blank", function() {
|
|
|
|
ok(testObj.blank('emptyString'), "Empty strings are blank");
|
|
|
|
ok(!testObj.blank('nonEmptyString'), "Non empty strings are not blank");
|
|
|
|
ok(testObj.blank('emptyArray'), "Empty arrays are blank");
|
|
|
|
ok(!testObj.blank('nonEmptyArray'), "Non empty arrays are not blank");
|
|
|
|
ok(testObj.blank('missing'), "Missing properties are blank");
|
2014-07-30 18:56:01 -04:00
|
|
|
});
|