Skip to content

Commit

Permalink
EWPP-5047: Add new variant to navigation_list pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
22Alexandra committed Jan 7, 2025
1 parent 93475f6 commit 7d8ac0c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ navigation_list:
illustration:
label: "Illustration"
description: "Displays the image in the top right corner."
image_as_illustration:
label: "Image as illustration"
description: "Displays the image in the top right corner without a background."
fields:
title:
type: "text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
{% endif %}

{% set _variant = (variant == 'illustration') ? 'illustration' : '' %}
{% set _variant = variant|replace({'_':'-'})|default('') %}
{% include '@ecl-twig/navigation-list/navigation-list-item.html.twig' with {
'variant': _variant,
'title': title|default({}),
Expand Down
26 changes: 24 additions & 2 deletions tests/src/Kernel/fixtures/rendering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2951,8 +2951,30 @@
count:
'article.ecl-navigation-list__item.ecl-navigation-list__item--illustration': 1
'.ecl-content-block.ecl-navigation-list__content-block': 1
"img.ecl-navigation-list__image[src=\"https://placeimg.com/1000/500/arch\"]": 1
'img.ecl-navigation-list__image[alt="Alternative text for image"]': 1
"picture.ecl-navigation-list__picture img.ecl-navigation-list__image[src=\"https://placeimg.com/1000/500/arch\"]": 1
'picture.ecl-navigation-list__picture img.ecl-navigation-list__image[alt="Alternative text for image"]': 1
equals:
'div.ecl-content-block__title a.ecl-link--standalone.ecl-link[href="http://example.com"]': 'Navigation list title'
'div.ecl-content-block__description': 'Navigation list description'
- array:
'#type': pattern
'#id': navigation_list
'#fields':
variant: 'image_as_illustration'
title: 'Navigation list title'
title_url: 'http://example.com'
description: 'Navigation list description'
border: true
image:
src: "https://placeimg.com/1000/500/arch"
alt: "Alternative text for image"
assertions:
count:
'article.ecl-navigation-list__item.ecl-navigation-list__item--illustration': 0
'article.ecl-navigation-list__item.ecl-navigation-list__item--image-as-illustration': 1
'.ecl-content-block.ecl-navigation-list__content-block': 1
"picture.ecl-navigation-list__picture img.ecl-navigation-list__image[src=\"https://placeimg.com/1000/500/arch\"]": 1
'picture.ecl-navigation-list__picture img.ecl-navigation-list__image[alt="Alternative text for image"]': 1
equals:
'div.ecl-content-block__title a.ecl-link--standalone.ecl-link[href="http://example.com"]': 'Navigation list title'
'div.ecl-content-block__description': 'Navigation list description'
Expand Down

0 comments on commit 7d8ac0c

Please sign in to comment.