@@ -337,12 +337,18 @@ def test_options(tmp_path):
337337 path = "../"
338338 validate_static (contents , path )
339339 validate_script (contents )
340+ # validate slide options
340341 regex_obj = re .search (
341- rf'<a class="glightbox" .* href="{ path } img.png"><img .* src="{ path } img.png"\/><\/a>' ,
342+ rf'<a class="glightbox" (.*) href="{ path } img.png"><img .* src="{ path } img.png"\/><\/a>' ,
342343 contents ,
343344 )
345+ assert regex_obj
346+ text = regex_obj .group (1 )
347+ assert 'data-height="60%"' in text
348+ assert 'data-width="80%"' in text
349+ assert 'data-desc-position="right"' in text
344350
345- # validate position
351+ # validate GLightbox options
346352 regex_obj = re .search (
347353 r"const lightbox = GLightbox\((.*)\);" ,
348354 contents ,
@@ -362,6 +368,50 @@ def test_options(tmp_path):
362368 assert option in text
363369
364370
371+ def test_gallery (tmp_path ):
372+ """
373+ Validate gallery
374+ """
375+ mkdocs_file = "mkdocs-material.yml"
376+ testproject_path = validate_mkdocs_file (tmp_path , f"tests/fixtures/{ mkdocs_file } " )
377+ file = testproject_path / "site/gallery/index.html"
378+ contents = file .read_text (encoding = "utf8" )
379+ path = "../"
380+ validate_static (contents , path = path )
381+ validate_script (contents )
382+ regex_obj = re .search (
383+ rf'<a class="glightbox" (.*) href="{ path } img.png"><img alt="image-a" .* src="{ path } img.png"\/><\/a>' ,
384+ contents ,
385+ )
386+ assert regex_obj
387+ text = regex_obj .group (1 )
388+ assert 'data-gallery="1"' in text
389+
390+ regex_obj = re .search (
391+ rf'<a class="glightbox" (.*) href="{ path } img.png"><img alt="image-b" .* src="{ path } img.png"\/><\/a>' ,
392+ contents ,
393+ )
394+ assert regex_obj
395+ text = regex_obj .group (1 )
396+ assert 'data-gallery="1"' in text
397+
398+ regex_obj = re .search (
399+ rf'<a class="glightbox" (.*) href="{ path } another-img.png"><img alt="image-c" .* src="{ path } another-img.png"\/><\/a>' ,
400+ contents ,
401+ )
402+ assert regex_obj
403+ text = regex_obj .group (1 )
404+ assert 'data-gallery="2"' in text
405+
406+ regex_obj = re .search (
407+ rf'<a class="glightbox" (.*) href="{ path } another-img.png"><img alt="image-d" .* src="{ path } another-img.png"\/><\/a>' ,
408+ contents ,
409+ )
410+ assert regex_obj
411+ text = regex_obj .group (1 )
412+ assert 'data-gallery="2"' in text
413+
414+
365415def test_caption (tmp_path ):
366416 """
367417 Validate captions feature
@@ -506,3 +556,4 @@ def test_static(tmp_path):
506556 assert os .path .exists (
507557 os .path .join (testproject_path , "site/assets/javascripts/glightbox.min.js" )
508558 )
559+
0 commit comments