Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

fix(button): Setting data-ecl-icon on the icon when used in a button - TWIG-199 #291

Merged
merged 14 commits into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from 11 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 @@ -21,6 +21,7 @@ exports[`EC - Accordion renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -59,6 +60,7 @@ exports[`EC - Accordion renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -97,6 +99,7 @@ exports[`EC - Accordion renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -146,6 +149,7 @@ exports[`EC - Accordion renders correctly with extra attributes 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -184,6 +188,7 @@ exports[`EC - Accordion renders correctly with extra attributes 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -222,6 +227,7 @@ exports[`EC - Accordion renders correctly with extra attributes 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -269,6 +275,7 @@ exports[`EC - Accordion renders correctly with extra class names 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -307,6 +314,7 @@ exports[`EC - Accordion renders correctly with extra class names 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -345,6 +353,7 @@ exports[`EC - Accordion renders correctly with extra class names 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
{ name: 'data-ecl-accordion-toggle' },
]
} only %}

planctus marked this conversation as resolved.
Show resolved Hide resolved
</h{{ _item.level|default(3) }}>
<div
class="ecl-accordion__content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`EC - Button CTA button - icon after renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -46,6 +47,7 @@ exports[`EC - Button CTA button - icon after renders correctly with extra attrib
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -73,6 +75,7 @@ exports[`EC - Button CTA button - icon after renders correctly with extra class
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand All @@ -94,6 +97,7 @@ exports[`EC - Button CTA button - icon before renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -127,6 +131,7 @@ exports[`EC - Button CTA renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
10 changes: 8 additions & 2 deletions src/ec/packages/ec-component-button/ecl-button.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,20 @@
{% if _icon_position == 'before' %}
{% include '@ecl-twig/ec-component-icon/ecl-icon.html.twig' with {
icon: _icon,
extra_classes: 'ecl-button__icon ecl-button__icon--before'
extra_classes: 'ecl-button__icon ecl-button__icon--before',
extra_attributes: [
{ name: 'data-ecl-icon', value: 'true' }
planctus marked this conversation as resolved.
Show resolved Hide resolved
]
} only %}
{% endif %}
<span class="ecl-button__label" data-ecl-label="true">{% block label _label|raw %}</span>
{% if _icon_position == 'after' %}
{% include '@ecl-twig/ec-component-icon/ecl-icon.html.twig' with {
icon: _icon,
extra_classes: 'ecl-button__icon ecl-button__icon--after'
extra_classes: 'ecl-button__icon ecl-button__icon--after',
extra_attributes: [
{ name: 'data-ecl-icon', value: 'true' }
planctus marked this conversation as resolved.
Show resolved Hide resolved
]
} only %}
{% endif %}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ exports[`EC - Contextual Navigation renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -205,6 +206,7 @@ exports[`EC - Contextual Navigation renders correctly with extra attributes 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -313,6 +315,7 @@ exports[`EC - Contextual Navigation renders correctly with extra class names 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`EC - Dropdown legacy Default renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -99,6 +100,7 @@ exports[`EC - Dropdown legacy Default renders correctly with extra attributes 1`
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -173,6 +175,7 @@ exports[`EC - Dropdown legacy Default renders correctly with extra class names 1
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exports[`EC - Expandable Collapsed renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -74,6 +75,7 @@ exports[`EC - Expandable Collapsed renders correctly with extra attributes 1`] =
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -119,6 +121,7 @@ exports[`EC - Expandable Collapsed renders correctly with extra class names 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -164,6 +167,7 @@ exports[`EC - Expandable Expanded renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -211,6 +215,7 @@ exports[`EC - Expandable Expanded renders correctly with extra attributes 1`] =
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -256,6 +261,7 @@ exports[`EC - Expandable Expanded renders correctly with extra class names 1`] =
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ exports[`EC - File With translation renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -306,6 +307,7 @@ exports[`EC - File With translation renders correctly with extra attributes 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -530,6 +532,7 @@ exports[`EC - File With translation renders correctly with extra class names 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ exports[`EC - Gallery Default renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -466,6 +467,7 @@ exports[`EC - Gallery Default renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--l ecl-icon--rotate-270 ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -497,6 +499,7 @@ exports[`EC - Gallery Default renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--l ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -1030,6 +1033,7 @@ exports[`EC - Gallery Default renders correctly with extra attributes 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -1057,6 +1061,7 @@ exports[`EC - Gallery Default renders correctly with extra attributes 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--l ecl-icon--rotate-270 ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -1088,6 +1093,7 @@ exports[`EC - Gallery Default renders correctly with extra attributes 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--l ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -1619,6 +1625,7 @@ exports[`EC - Gallery Default renders correctly with extra class names 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -1646,6 +1653,7 @@ exports[`EC - Gallery Default renders correctly with extra class names 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--l ecl-icon--rotate-270 ecl-button__icon ecl-button__icon--before"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -1677,6 +1685,7 @@ exports[`EC - Gallery Default renders correctly with extra class names 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--l ecl-icon--rotate-90 ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`EC - Language List Overlay renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -430,6 +431,7 @@ exports[`EC - Language List Overlay renders correctly with extra attributes 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -827,6 +829,7 @@ exports[`EC - Language List Overlay renders correctly with extra class names 1`]
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--after"
data-ecl-icon="true"
focusable="false"
>
<use
Expand Down
Loading