Load additional icons from HTML
When a Web App Manifest is found and loaded, we still want to check HTML for some additional icons that are usually not added to manifests.
This commit is contained in:
parent
6cbcbdb54a
commit
e503ada44e
@ -18,6 +18,8 @@ module Manifique
|
|||||||
|
|
||||||
if manifest = fetch_web_manifest
|
if manifest = fetch_web_manifest
|
||||||
@metadata.load_from_web_manifest(manifest)
|
@metadata.load_from_web_manifest(manifest)
|
||||||
|
parse_apple_touch_icons_from_html
|
||||||
|
parse_mask_icon_from_html
|
||||||
else
|
else
|
||||||
parse_metadata_from_html
|
parse_metadata_from_html
|
||||||
end
|
end
|
||||||
|
@ -147,6 +147,20 @@ RSpec.describe Manifique::WebClient do
|
|||||||
it "knows which properties were loaded from the web app manifest" do
|
it "knows which properties were loaded from the web app manifest" do
|
||||||
expect(subject.from_web_manifest.length).to eq(10)
|
expect(subject.from_web_manifest.length).to eq(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "loads iOS icons from HTML" do
|
||||||
|
apple_touch_icons = subject.icons.select{|i| i["purpose"] == "apple-touch-icon"}
|
||||||
|
expect(apple_touch_icons.length).to eq(1)
|
||||||
|
expect(apple_touch_icons.first["type"]).to eq("image/png")
|
||||||
|
expect(apple_touch_icons.first["sizes"]).to eq("180x180")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "loads SVG mask icons from HTML" do
|
||||||
|
mask_icon = subject.icons.find{|i| i["purpose"] == "mask-icon"}
|
||||||
|
expect(mask_icon["color"]).to eq("#2b90d9")
|
||||||
|
expect(mask_icon["type"]).to eq("image/svg")
|
||||||
|
expect(mask_icon["sizes"]).to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "no web app manifest present" do
|
context "no web app manifest present" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user