Add categories-list css class to body for customization purposes

This commit is contained in:
Robin Ward 2015-01-21 14:34:01 -05:00
parent 514a45b0c1
commit 03eb4752d1
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,11 @@
import UrlRefresh from 'discourse/mixins/url-refresh'; import UrlRefresh from 'discourse/mixins/url-refresh';
export default Discourse.View.extend(UrlRefresh, Discourse.ScrollTop); export default Discourse.View.extend(UrlRefresh, Discourse.ScrollTop, {
_addBodyClass: function() {
$('body').addClass('categories-list');
}.on('didInsertElement'),
_removeBodyClass: function() {
$('body').removeClass('categories-list');
}.on('willDestroyElement')
});

View file

@ -11,15 +11,20 @@ test("Visit Discovery Pages", function() {
andThen(function() { andThen(function() {
ok(exists(".topic-list"), "The list of topics was rendered"); ok(exists(".topic-list"), "The list of topics was rendered");
ok(exists('.topic-list .topic-list-item'), "has topics"); ok(exists('.topic-list .topic-list-item'), "has topics");
ok($('body.category-1').length, "has a custom css class for the category id on the body");
}); });
visit("/categories"); visit("/categories");
andThen(function() { andThen(function() {
ok($('body.category-1').length === 0, "removes the custom category class");
ok(exists('.category'), "has a list of categories"); ok(exists('.category'), "has a list of categories");
ok($('body.categories-list').length, "has a custom class to indicate categories");
}); });
visit("/top"); visit("/top");
andThen(function() { andThen(function() {
ok($('body.categories-list').length === 0, "removes the `categories-list` class");
ok(exists('.topic-list .topic-list-item'), "has topics"); ok(exists('.topic-list .topic-list-item'), "has topics");
}); });
}); });