mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-11 06:20:42 +00:00
Handle dark/light/contrast theme modes in common CSS (#37095)
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ApplicationHelper do
|
||||
describe 'body_classes' do
|
||||
context 'with a body class string from a controller' do
|
||||
describe 'html_classes' do
|
||||
context 'with non-default user settings' do
|
||||
before do
|
||||
user = Fabricate :user
|
||||
user.settings['web.use_system_font'] = true
|
||||
@@ -15,19 +15,11 @@ RSpec.describe ApplicationHelper do
|
||||
end
|
||||
|
||||
it 'uses the current theme and user settings classes in the result' do
|
||||
expect(helper.body_classes)
|
||||
.to match(/theme-default/)
|
||||
.and match(/system-font/)
|
||||
expect(helper.html_classes)
|
||||
.to match(/system-font/)
|
||||
.and match(/reduce-motion/)
|
||||
end
|
||||
|
||||
it 'includes values set via content_for' do
|
||||
helper.content_for(:body_classes) { 'admin' }
|
||||
|
||||
expect(helper.body_classes)
|
||||
.to match(/admin/)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def controller_helpers
|
||||
@@ -35,13 +27,22 @@ RSpec.describe ApplicationHelper do
|
||||
def current_account
|
||||
@current_account ||= Fabricate(:account, user: User.last)
|
||||
end
|
||||
|
||||
def current_theme = 'default'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'body_classes' do
|
||||
context 'with a body class string from a controller' do
|
||||
it 'includes values set via content_for' do
|
||||
helper.content_for(:body_classes) { 'admin' }
|
||||
|
||||
expect(helper.body_classes)
|
||||
.to match(/admin/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'locale_direction' do
|
||||
it 'adds rtl body class if locale is Arabic' do
|
||||
I18n.with_locale(:ar) do
|
||||
|
||||
Reference in New Issue
Block a user