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.
Unified · Split
| @@ -28,6 +28,7 @@ class app.views.SettingsPage extends app.View · 27 unmodified lines | |||
| 28 | html.classList.toggle('_theme-default') | 28 | html.classList.toggle('_theme-default') |
| 29 | html.classList.toggle('_theme-dark') | 29 | html.classList.toggle('_theme-dark') |
| 30 | app.settings.set('dark', !!enable) | 30 | app.settings.set('dark', !!enable) |
| 31 | app.appCache?.updateInBackground() | ||
| 31 | return | 32 | return |
| 32 | 33 | ||
| 33 | toggleLayout: (layout, enable) -> | 34 | toggleLayout: (layout, enable) -> |
| @@ -122,6 +122,19 @@ class AppTest < MiniTest::Spec · 121 unmodified lines | |||
| 122 | refute_includes last_response.body, 'foo' | 122 | refute_includes last_response.body, 'foo' |
| 123 | end | 123 | end |
| 124 | 124 | ||
| 125 | it "has the word 'default' when no 'dark' cookie is set" do | ||
| 126 | get '/manifest.appcache' | ||
| 127 | assert_includes last_response.body, '# default' | ||
| 128 | refute_includes last_response.body, '# dark' | ||
| 129 | end | ||
| 130 | |||
| 131 | it "has the word 'dark' when the cookie is set" do | ||
| 132 | set_cookie('dark=1') | ||
| 133 | get '/manifest.appcache' | ||
| 134 | assert_includes last_response.body, '# dark' | ||
| 135 | refute_includes last_response.body, '# default' | ||
| 136 | end | ||
| 137 | |||
| 125 | it "sets default size" do | 138 | it "sets default size" do |
| 126 | get '/manifest.appcache' | 139 | get '/manifest.appcache' |
| 127 | assert_includes last_response.body, '20rem' | 140 | assert_includes last_response.body, '20rem' |
| @@ -1,5 +1,5 @@ | |||
| 1 | CACHE MANIFEST | 1 | CACHE MANIFEST |
| 2 | # <%= app_size %> <%= app_layout %> | 2 | # <%= app_theme %> <%= app_size %> <%= app_layout %> |
| 3 | 3 | ||
| 4 | CACHE: | 4 | CACHE: |
| 5 | / | 5 | / |