mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-29 16:54:12 +00:00
Choose narrowest srcset candidate at least 1200 px wide instead of the largest candidate, to cut down on bandwidth use.
This commit is contained in:
1 parent
1b6b3b072f
commit
fcd5d295bd
2 files changed
+25
-13
No files matched your search
@@ -90,6 +90,11 @@ import RSParser
|
||||
#expect(firstSignificantImage(html)?.urlString == "https://example.com/real-800.jpg")
|
||||
}
|
||||
|
||||
@Test func srcsetUsesNarrowestCandidateWideEnoughForThumbnail() {
|
||||
let html = #"<img srcset="/a-768.jpg 768w, /a-2048.jpg 2048w, /a-1536.jpg 1536w, /a-2560.jpg 2560w">"#
|
||||
#expect(firstSignificantImage(html)?.urlString == "https://example.com/a-1536.jpg")
|
||||
}
|
||||
|
||||
@Test func lazySourceIsUsedWhenSrcIsPlaceholder() {
|
||||
let html = """
|
||||
<a href=" https://twitter.com/intent/tweet?url=x "><img src="/share/twitter.png"></a>
|
||||
|
||||
Reference in new issue
Block a user