Fix app cache not updating when changing the app's color theme

This is needed because the index page is part of the app cache, and the <html> tag has a different class depending on the theme.
pull/893/merge
Thibaut Courouble 6 years ago
parent d72de330aa
commit e8d52c9cfd

@ -28,6 +28,7 @@ class app.views.SettingsPage extends app.View
html.classList.toggle('_theme-default') html.classList.toggle('_theme-default')
html.classList.toggle('_theme-dark') html.classList.toggle('_theme-dark')
app.settings.set('dark', !!enable) app.settings.set('dark', !!enable)
app.appCache?.updateInBackground()
return return
toggleLayout: (layout, enable) -> toggleLayout: (layout, enable) ->

@ -122,6 +122,19 @@ class AppTest < MiniTest::Spec
refute_includes last_response.body, 'foo' refute_includes last_response.body, 'foo'
end end
it "has the word 'default' when no 'dark' cookie is set" do
get '/manifest.appcache'
assert_includes last_response.body, '# default'
refute_includes last_response.body, '# dark'
end
it "has the word 'dark' when the cookie is set" do
set_cookie('dark=1')
get '/manifest.appcache'
assert_includes last_response.body, '# dark'
refute_includes last_response.body, '# default'
end
it "sets default size" do it "sets default size" do
get '/manifest.appcache' get '/manifest.appcache'
assert_includes last_response.body, '20rem' assert_includes last_response.body, '20rem'

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# <%= app_size %> <%= app_layout %> # <%= app_theme %> <%= app_size %> <%= app_layout %>
CACHE: CACHE:
/ /

Loading…
Cancel
Save