mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FIX: 'anon' css class is missing for anonymous users
This commit is contained in:
parent
9886934ef5
commit
70b56c8332
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user