From 581127928507ad6f929b9671d36103d8e1fa3e09 Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Mon, 8 Jul 2024 19:05:08 +0200 Subject: [PATCH] Add srcset tests --- tests/test_thumbnail_tag.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_thumbnail_tag.py b/tests/test_thumbnail_tag.py index f3bdfda6..adc7fb0b 100644 --- a/tests/test_thumbnail_tag.py +++ b/tests/test_thumbnail_tag.py @@ -1,4 +1,5 @@ import pytest +import re from django.template import TemplateSyntaxError from . import imagegenerators # noqa @@ -87,3 +88,11 @@ def test_alternate_generator(): clear_imagekit_cache() html = render_tag(ttag) assert html == '1' + + +def test_srcset_arg(): + ttag = r"""{% thumbnail '100x' img srcset="1.5 2" %}""" + clear_imagekit_cache() + html = render_tag(ttag) + srcset_regex = re.compile('srcset=".* 1x ,.* 1\\.5x ,.* 2.0x"') + assert srcset_regex.search(html) is not None