mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Introduce Discourse.computed.setting to create a computed
property that links to a `Discourse.SiteSetting`
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user