REFACTOR: Introduce Discourse.computed.setting to create a computed

property that links to a `Discourse.SiteSetting`
This commit is contained in:
Robin Ward
2014-04-24 17:39:34 -04:00
parent cdd2101e4f
commit cf6cbb955b
10 changed files with 38 additions and 41 deletions

View File

@@ -10,6 +10,17 @@ module("Discourse.Computed", {
}
});
test("setting", function() {
var t = Em.Object.extend({
vehicle: Discourse.computed.setting('vehicle'),
missingProp: Discourse.computed.setting('madeUpThing')
}).create();
Discourse.SiteSettings.vehicle = "airplane";
equal(t.get('vehicle'), "airplane", "it has the value of the site setting");
ok(!t.get('missingProp'), "it is falsy when the site setting is not defined");
});
test("propertyEqual", function() {
var t = Em.Object.extend({
same: Discourse.computed.propertyEqual('cookies', 'biscuits')