FIX: 'anon' css class is missing for anonymous users

This commit is contained in:
Vinoth Kannan 2019-01-23 10:13:36 +05:30
parent 9886934ef5
commit 70b56c8332
2 changed files with 9 additions and 1 deletions

View File

@ -114,6 +114,7 @@ module ApplicationHelper
list << (mobile_device? ? 'mobile-device' : 'not-mobile-device')
list << 'rtl' if rtl?
list << text_size_class
list << 'anon' unless current_user
list.join(' ')
end

View File

@ -148,6 +148,8 @@ describe ApplicationHelper do
end
describe '#html_classes' do
let(:user) { Fabricate(:user) }
it "includes 'rtl' when the I18n.locale is rtl" do
I18n.stubs(:locale).returns(:he)
expect(helper.html_classes.split(" ")).to include('rtl')
@ -159,7 +161,6 @@ describe ApplicationHelper do
end
it 'includes the user specified text size' do
user = Fabricate(:user)
user.user_option.text_size = "larger"
user.user_option.save!
helper.request.env[Auth::DefaultCurrentUserProvider::CURRENT_USER_KEY] = user
@ -171,6 +172,12 @@ describe ApplicationHelper do
SiteSetting.default_text_size = "largest"
expect(helper.html_classes.split(" ")).to include('text-size-largest')
end
it "includes 'anon' for anonymous users and excludes when logged in" do
expect(helper.html_classes.split(" ")).to include('anon')
helper.request.env[Auth::DefaultCurrentUserProvider::CURRENT_USER_KEY] = user
expect(helper.html_classes.split(" ")).not_to include('anon')
end
end
describe 'gsub_emoji_to_unicode' do