Fix system theme being included twice (#37526)
This commit is contained in:
parent
e21cb9f0d0
commit
cc3c7ba532
@ -18,14 +18,10 @@ module ThemeHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def theme_style_tags(theme)
|
def theme_style_tags(theme)
|
||||||
if theme == 'system'
|
# TODO: get rid of that when we retire the themes and perform the settings migration
|
||||||
''.html_safe.tap do |tags|
|
theme = 'default' if %w(mastodon-light contrast system).include?(theme)
|
||||||
tags << vite_stylesheet_tag('themes/mastodon-light', type: :virtual, media: 'not all and (prefers-color-scheme: dark)', crossorigin: 'anonymous')
|
|
||||||
tags << vite_stylesheet_tag('themes/default', type: :virtual, media: '(prefers-color-scheme: dark)', crossorigin: 'anonymous')
|
vite_stylesheet_tag "themes/#{theme}", type: :virtual, media: 'all', crossorigin: 'anonymous'
|
||||||
end
|
|
||||||
else
|
|
||||||
vite_stylesheet_tag "themes/#{theme}", type: :virtual, media: 'all', crossorigin: 'anonymous'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def theme_color_tags(color_scheme)
|
def theme_color_tags(color_scheme)
|
||||||
|
|||||||
@ -9,17 +9,10 @@ RSpec.describe ThemeHelper do
|
|||||||
context 'when using "system" theme' do
|
context 'when using "system" theme' do
|
||||||
let(:theme) { 'system' }
|
let(:theme) { 'system' }
|
||||||
|
|
||||||
it 'returns the mastodon-light and application stylesheets with correct color schemes' do
|
it 'returns the default theme' do
|
||||||
expect(html_links.first.attributes.symbolize_keys)
|
expect(html_links.first.attributes.symbolize_keys)
|
||||||
.to include(
|
.to include(
|
||||||
# This is now identical to the default theme & will be unified very soon
|
href: have_attributes(value: match(/default/))
|
||||||
href: have_attributes(value: match(/default/)),
|
|
||||||
media: have_attributes(value: 'not all and (prefers-color-scheme: dark)')
|
|
||||||
)
|
|
||||||
expect(html_links.last.attributes.symbolize_keys)
|
|
||||||
.to include(
|
|
||||||
href: have_attributes(value: match(/default/)),
|
|
||||||
media: have_attributes(value: '(prefers-color-scheme: dark)')
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -41,8 +34,7 @@ RSpec.describe ThemeHelper do
|
|||||||
it 'returns the theme stylesheet without color scheme information' do
|
it 'returns the theme stylesheet without color scheme information' do
|
||||||
expect(html_links.first.attributes.symbolize_keys)
|
expect(html_links.first.attributes.symbolize_keys)
|
||||||
.to include(
|
.to include(
|
||||||
href: have_attributes(value: match(/default/)),
|
href: have_attributes(value: match(/default/))
|
||||||
media: have_attributes(value: 'all')
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user