From 9c05e95f0797d17afca3e2ca04a096cfd73c697e Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 13 Oct 2022 22:53:05 +1300 Subject: [PATCH] Test for proxy links with class image --- src/page-wiki.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/page-wiki.rkt b/src/page-wiki.rkt index 6499a86..488886f 100644 --- a/src/page-wiki.rkt +++ b/src/page-wiki.rkt @@ -52,7 +52,7 @@ (a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page")) "Another Page")))) (figure (@ (class "thumb tnone")) - (a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image")) + (a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image") (data-test-figure-a)) (img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D") (data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png") (class "thumbimage lazyload")))) @@ -255,6 +255,11 @@ (λ (t a c) (and (eq? t 'a) (has-class? "image-thumbnail" a))) transformed)))) "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png") + (check-equal? (get-attribute 'href (bits->attributes + ((query-selector + (λ (t a c) (member '(data-test-figure-a) a)) + transformed)))) + "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png") ; check that noscript images are removed (check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f))