mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -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 << (mobile_device? ? 'mobile-device' : 'not-mobile-device')
|
||||||
list << 'rtl' if rtl?
|
list << 'rtl' if rtl?
|
||||||
list << text_size_class
|
list << text_size_class
|
||||||
|
list << 'anon' unless current_user
|
||||||
list.join(' ')
|
list.join(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -148,6 +148,8 @@ describe ApplicationHelper do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#html_classes' do
|
describe '#html_classes' do
|
||||||
|
let(:user) { Fabricate(:user) }
|
||||||
|
|
||||||
it "includes 'rtl' when the I18n.locale is rtl" do
|
it "includes 'rtl' when the I18n.locale is rtl" do
|
||||||
I18n.stubs(:locale).returns(:he)
|
I18n.stubs(:locale).returns(:he)
|
||||||
expect(helper.html_classes.split(" ")).to include('rtl')
|
expect(helper.html_classes.split(" ")).to include('rtl')
|
||||||
@ -159,7 +161,6 @@ describe ApplicationHelper do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'includes the user specified text size' do
|
it 'includes the user specified text size' do
|
||||||
user = Fabricate(:user)
|
|
||||||
user.user_option.text_size = "larger"
|
user.user_option.text_size = "larger"
|
||||||
user.user_option.save!
|
user.user_option.save!
|
||||||
helper.request.env[Auth::DefaultCurrentUserProvider::CURRENT_USER_KEY] = user
|
helper.request.env[Auth::DefaultCurrentUserProvider::CURRENT_USER_KEY] = user
|
||||||
@ -171,6 +172,12 @@ describe ApplicationHelper do
|
|||||||
SiteSetting.default_text_size = "largest"
|
SiteSetting.default_text_size = "largest"
|
||||||
expect(helper.html_classes.split(" ")).to include('text-size-largest')
|
expect(helper.html_classes.split(" ")).to include('text-size-largest')
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe 'gsub_emoji_to_unicode' do
|
describe 'gsub_emoji_to_unicode' do
|
||||||
|
Loading…
Reference in New Issue
Block a user