We are using random() Twig function to generate IDs:
{{ carousel_id|default("carousel-" ~ random() ) }}
and it's OK, nothing to saycarousel-{{ random() }}
and it makes unit testing impossible because it generates a different template each time when we have the same input slots & props.With UI Patterns, we don't do these unit tests yet (from preview data) but we shouldn't make them impossible.
TODO for each:
accordion/pattern-accordion.html.twig: {% set id = 'accordion-' ~ random() %}
breadcrumb/pattern-breadcrumb.html.twig: {% set id = 'breadcrumb-'~random() %}
header/pattern-header.html.twig: {% set search_mid = 'modal-' ~ random() %}
header/pattern-header.html.twig: {% set mobile_menu_mid = 'modal-' ~ random() %}
nav_menu/pattern-nav-menu.html.twig: {% set html_id = 'main-menu-'~random() %}
side_menu/pattern-side-menu.html.twig: {% set html_id = 'sidemenu-' ~ random() %}
summary/pattern-summary.html.twig:{% set title_id = 'fr-summary-title--' ~ random() %}
Out of scope because part of a menu structure:
nav_menu/pattern-nav-menu.html.twig: {% set item_id = 'menu-'~loop.index~'-'~random() %}
nav_menu/pattern-nav-menu.html.twig: {% set item_id = 'mega-menu-'~loop.index~'-'~random() %}
side_menu/pattern-side-menu.html.twig: {% set item_id = 'fr-sidemenu-item-' ~ loop.index ~ '-' ~ random() %}
yes, but is safe
Fixed
1.0
Code