FIX: changing component settings should trigger refresh for parent theme CSS (#6340)

This commit is contained in:
Osama Sayegh
2018-08-30 13:53:03 +03:00
committed by Sam
parent 3ed9533066
commit 9efbf2c49f
2 changed files with 25 additions and 3 deletions

View File

@ -65,7 +65,6 @@ describe Stylesheet::Manager do
end
it 'can correctly account for plugins in digest' do
theme = Fabricate(:theme)
manager = Stylesheet::Manager.new(:desktop_theme, theme.id)
@ -79,6 +78,26 @@ describe Stylesheet::Manager do
expect(digest1).not_to eq(digest2)
end
it "can correctly account for settings in theme's components" do
theme = Fabricate(:theme)
child = Fabricate(:theme, component: true)
theme.add_child_theme!(child)
child.set_field(target: :settings, name: :yaml, value: "childcolor: red")
child.set_field(target: :common, name: :scss, value: "body {background-color: $childcolor}")
child.save!
manager = Stylesheet::Manager.new(:desktop_theme, theme.id)
digest1 = manager.digest
child.update_setting(:childcolor, "green")
manager = Stylesheet::Manager.new(:desktop_theme, theme.id)
digest2 = manager.digest
expect(digest1).not_to eq(digest2)
end
let(:image) { file_from_fixtures("logo.png") }
let(:image2) { file_from_fixtures("logo-dev.png") }