mirror of
https://github.com/miniflux/v2.git
synced 2025-08-11 17:51:01 +00:00
Add data-srcset support to "add_dynamic_image rewrite" rewrite rule
This commit is contained in:
parent
d45e1b3bed
commit
b585dab6b4
2 changed files with 41 additions and 0 deletions
|
@ -176,6 +176,26 @@ func TestRewriteWithUnknownLazyNoScriptImage(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestRewriteWithLazySrcset(t *testing.T) {
|
||||
description := `<img srcset="" data-srcset="https://example.org/image.jpg" alt="Image">`
|
||||
output := Rewriter("https://example.org/article", description, "add_dynamic_image")
|
||||
expected := `<img srcset="https://example.org/image.jpg" data-srcset="https://example.org/image.jpg" alt="Image"/>`
|
||||
|
||||
if expected != output {
|
||||
t.Errorf(`Not expected output: got "%s" instead of "%s"`, output, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRewriteWithImageAndLazySrcset(t *testing.T) {
|
||||
description := `<img src="meow" srcset="" data-srcset="https://example.org/image.jpg" alt="Image">`
|
||||
output := Rewriter("https://example.org/article", description, "add_dynamic_image")
|
||||
expected := `<img src="meow" srcset="https://example.org/image.jpg" data-srcset="https://example.org/image.jpg" alt="Image"/>`
|
||||
|
||||
if expected != output {
|
||||
t.Errorf(`Not expected output: got "%s" instead of "%s"`, output, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewLineRewriteRule(t *testing.T) {
|
||||
description := "A\nB\nC"
|
||||
output := Rewriter("https://example.org/article", description, "nl2br")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue