Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EWPP-5047: Add new variant to navigation_list pattern. #1537

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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