FIX: Multiple links being generated for non-theme targets.

Follow-up to 8e3691d537
This commit is contained in:
Alan Guo Xiang Tan 2021-06-21 16:21:11 +08:00
parent be655762d8
commit 7901f73597
2 changed files with 10 additions and 1 deletions

View File

@ -201,8 +201,9 @@ class Stylesheet::Manager
@@lock.synchronize do
stylesheets = []
stale_theme_ids = []
theme_ids = target.to_s =~ THEME_REGEX ? @theme_ids : [@theme_id]
@theme_ids.each do |theme_id|
theme_ids.each do |theme_id|
cache_key = "path_#{target}_#{theme_id}_#{current_hostname}"
if href = cache[cache_key]

View File

@ -38,6 +38,14 @@ describe Stylesheet::Manager do
t.add_relative_theme!(:child, child_theme)
}}
it "generates the right links for non-theme targets" do
manager = manager(theme.id)
hrefs = manager.stylesheet_details(:desktop, 'all')
expect(hrefs.length).to eq(1)
end
it 'can correctly compile theme css' do
manager = manager(theme.id)
old_links = manager.stylesheet_link_tag(:desktop_theme, 'all')