Closed (fixed)
Project:
Owl Carousel
Version:
3.1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
28 Jul 2026 at 04:59 UTC
Updated:
11 Aug 2026 at 05:35 UTC
Jump to comment: Most recent
No tests
Add following tests:
testDefaultRenderingProducesValidSettingsJson — render a node with 2 images through the default-settings formatter, assert the output contains the owl-slider-wrapper class and a data-settings="..." attribute whose value is valid JSON.testImageLinkToFileDoesNotThrow / testImageLinkToContentDoesNotThrow — render with image_link set to 'file' / 'content' and assert no exception and the expected <a href=...> markup appears (this exercises OwlCarouselFieldFormatter::viewElements()'s file_url_generator/toUrl() branches, src/Plugin/Field/FieldFormatter/OwlCarouselFieldFormatter.php:259-270).testRenderedSettingsNeverContainNavTextOrUnknownKeys: decode the rendered data-settings JSON and assert every key is one of OwlCarouselGlobal::defaultSettings()'s keys (minus image_style/image_link, which are stripped) plus responsive; explicitly assertArrayNotHasKey('navText', $decoded). This encodes the invariant the XSS fix in js/owlcarousel.js depends on — if a future change ever adds a free-text setting emitted into data-settings, this test fails as a signal that it also needs client-side escaping
Comments
Comment #3
ipwa commented