Legend page served as a view with the map's versioned importmap (shared partial): as a static page it imported icons.js and mdi.mjs unversioned and a browser with an older copy showed no symbols; it also stays light (color-scheme) since auto-darkening washed out its swatches, no autofocus, a clearer filter and a symbol count
This commit is contained in:
1 parent
1bb0e1137a
commit
3e5fada66a
5 files changed
+83
-52
No files matched your search
@@ -47,6 +47,18 @@ class AppTest < Minitest::Test
|
||||
end
|
||||
end
|
||||
|
||||
# The legend page imports app and vendor modules too: it must get the
|
||||
# same versioned importmap, and stay light (auto-darkening washed out its
|
||||
# color swatches on a tablet).
|
||||
def test_symbols_page_has_the_versioned_importmap_and_a_light_color_scheme
|
||||
response = request.get("/symbols.html")
|
||||
assert_equal 200, response.status
|
||||
assert_match(%r{"/vendor/mdi/mdi\.mjs":\s*"/vendor/mdi/mdi\.mjs\?v=\d+"}, response.body)
|
||||
assert_match(%r{"/js/icons\.js":\s*"/js/icons\.js\?v=\d+"}, response.body)
|
||||
assert_includes response.body, '<meta name="color-scheme" content="light">'
|
||||
assert_operator response.body.index("importmap"), :<, response.body.index('<script type="module">')
|
||||
end
|
||||
|
||||
# Unversioned /vendor modules must be revalidated, or a deploy adding an
|
||||
# export to one (imported by a freshly versioned /js module) breaks a
|
||||
# browser still holding the old copy — see static_cache_control in app.rb.
|
||||
|
||||
Reference in new issue
Block a user