fix the build
This commit is contained in:
parent
13bf8e1e46
commit
386b0a2587
|
@ -1,11 +1,3 @@
|
||||||
/**
|
|
||||||
This controller supports the interface for SiteSettings.
|
|
||||||
|
|
||||||
@class AdminSiteSettingsController
|
|
||||||
@extends Ember.ArrayController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||||
filter: null,
|
filter: null,
|
||||||
onlyOverridden: false,
|
onlyOverridden: false,
|
||||||
|
|
|
@ -1,42 +1,31 @@
|
||||||
moduleFor("controller:admin-site-settings");
|
moduleFor("controller:admin-site-settings");
|
||||||
|
|
||||||
test("filter", function() {
|
test("filter", function() {
|
||||||
var allSettings = [Ember.Object.create({
|
var allSettings = [
|
||||||
|
Ember.Object.create({
|
||||||
nameKey: 'users', name: 'users',
|
nameKey: 'users', name: 'users',
|
||||||
siteSettings: [Discourse.SiteSetting.create({"setting":"username_change_period","description":"x","default":3,"type":"fixnum","value":"3","category":"users"})]
|
siteSettings: [Discourse.SiteSetting.create({"setting":"username_change_period","description":"x","default":3,"type":"fixnum","value":"3","category":"users"})]
|
||||||
}), Ember.Object.create({
|
}),
|
||||||
|
Ember.Object.create({
|
||||||
nameKey: 'posting', name: 'posting',
|
nameKey: 'posting', name: 'posting',
|
||||||
siteSettings: [Discourse.SiteSetting.create({"setting":"display_name_on_posts","description":"x","default":false,"type":"bool","value":"true","category":"posting"})]
|
siteSettings: [Discourse.SiteSetting.create({"setting":"display_name_on_posts","description":"x","default":false,"type":"bool","value":"true","category":"posting"})]
|
||||||
})];
|
})
|
||||||
var adminSiteSettingsController = this.subject({ model: allSettings });
|
];
|
||||||
adminSiteSettingsController.set('allSiteSettings', allSettings);
|
|
||||||
|
|
||||||
|
var adminSiteSettingsController = this.subject({ model: allSettings });
|
||||||
|
sinon.stub(adminSiteSettingsController, "transitionToRoute");
|
||||||
|
|
||||||
|
adminSiteSettingsController.set('allSiteSettings', allSettings);
|
||||||
equal(adminSiteSettingsController.get('content')[0].nameKey, 'users', "Can get first site setting category's name key.");
|
equal(adminSiteSettingsController.get('content')[0].nameKey, 'users', "Can get first site setting category's name key.");
|
||||||
|
|
||||||
adminSiteSettingsController.set('filter', 'username_change');
|
adminSiteSettingsController.set('filter', 'username_change');
|
||||||
|
equal(adminSiteSettingsController.get('content').length, 1, "Filter with one match for username_change");
|
||||||
|
equal(adminSiteSettingsController.get('content')[0].nameKey, "all_results", "First element is all the results that match");
|
||||||
|
equal(adminSiteSettingsController.get('content')[0].siteSettings[0].setting, "username_change_period", "Filter with one match for username_change");
|
||||||
|
|
||||||
equal(adminSiteSettingsController.get('content').length, 2, "a. Filter with one match for username_change");
|
adminSiteSettingsController.setProperties({ filter: '', onlyOverridden: true });
|
||||||
equal(adminSiteSettingsController.get('content')[0].nameKey, "all_results", "b. First element is all the results that match");
|
equal(adminSiteSettingsController.get('content').length, 1, "onlyOverridden with one match");
|
||||||
equal(adminSiteSettingsController.get('content')[1].nameKey, "users", "c. Filter with one match for username_change");
|
equal(adminSiteSettingsController.get('content')[0].nameKey, "all_results", "onlyOverridden with one match");
|
||||||
equal(adminSiteSettingsController.get('content')[1].siteSettings[0].setting, "username_change_period", "d. Filter with one match for username_change");
|
equal(adminSiteSettingsController.get('content')[0].siteSettings[0].setting, "display_name_on_posts", "onlyOverridden with one match");
|
||||||
|
|
||||||
adminSiteSettingsController.set('filter', 'name_on');
|
|
||||||
equal(adminSiteSettingsController.get('content').length, 2, "a. Filter with one match for name_on");
|
|
||||||
equal(adminSiteSettingsController.get('content')[1].nameKey, "posting", "b. Filter with one match for name_on");
|
|
||||||
equal(adminSiteSettingsController.get('content')[1].siteSettings[0].setting, "display_name_on_posts", "c. Filter with one match for name_on");
|
|
||||||
|
|
||||||
adminSiteSettingsController.set('filter', 'name');
|
|
||||||
equal(adminSiteSettingsController.get('content').length, 3, "a. Filter with one match for name");
|
|
||||||
equal(adminSiteSettingsController.get('content')[0].nameKey, "all_results", "b. First element is all the results that match");
|
|
||||||
equal(adminSiteSettingsController.get('content')[1].nameKey, "users", "c. Filter with one match for name");
|
|
||||||
equal(adminSiteSettingsController.get('content')[2].nameKey, "posting", "d. Filter with one match for name");
|
|
||||||
equal(adminSiteSettingsController.get('content')[1].siteSettings[0].setting, "username_change_period", "e. Filter with one match for name");
|
|
||||||
equal(adminSiteSettingsController.get('content')[2].siteSettings[0].setting, "display_name_on_posts", "f. Filter with one match for name");
|
|
||||||
|
|
||||||
adminSiteSettingsController.set('filter', '');
|
|
||||||
adminSiteSettingsController.set('onlyOverridden', true);
|
|
||||||
equal(adminSiteSettingsController.get('content').length, 2, "a. onlyOverridden with one match");
|
|
||||||
equal(adminSiteSettingsController.get('content')[1].nameKey, "posting", "b. onlyOverridden with one match");
|
|
||||||
equal(adminSiteSettingsController.get('content')[1].siteSettings[0].setting, "display_name_on_posts", "c. onlyOverridden with one match");
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue