FIX: Default to light theme in wizard so that previews are displayed

Previously, without a theme selection, the previews wouldn't show.
This commit is contained in:
Daniel Waterworth 2020-04-02 18:25:41 +01:00
parent bca126f3f5
commit 76610acb6f
2 changed files with 15 additions and 3 deletions

View File

@ -155,7 +155,7 @@ class Wizard
id: 'theme_previews',
type: 'component',
required: !default_theme_override,
value: scheme_id
value: scheme_id || ColorScheme::LIGHT_THEME_ID
)
# fix for the case when base_scheme is nil

View File

@ -176,14 +176,26 @@ describe Wizard::Builder do
end
end
describe "when the default theme has been override" do
describe "when the default theme has been overridden by a theme without a color scheme" do
before do
theme.set_default!
end
it 'should set the right default values' do
expect(field.required).to eq(false)
expect(field.value).to eq(nil)
expect(field.value).to eq("Light")
end
end
describe "when the default theme has been overridden by a theme with a color scheme" do
before do
theme.update(color_scheme_id: ColorScheme.find_by_name("Dark").id)
theme.set_default!
end
it 'should set the right default values' do
expect(field.required).to eq(false)
expect(field.value).to eq("Dark")
end
end
end