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

Commit

Permalink
Merge branch 'master' into ec-component-site-header
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt committed Feb 25, 2019
2 parents 7616161 + f1dda63 commit e140dca
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`EC - Card Card default - renders correctly 1`] = `
<div class=\\"ecl-card__meta\\">Meta 1 | Meta 2 | Meta 3</div>
<h1 class=\\"ecl-card__title\\">
<a href=\\"/example\\" class=\\"ecl-link ecl-link--standalone\\">
<span class=\\"ecl-link__label\\">Better regulation</span>
Better regulation
</a>
</h1>
</header>
Expand Down Expand Up @@ -77,23 +77,23 @@ exports[`EC - Card Card tile - renders correctly 1`] = `
href=\\"/example-1\\"
class=\\"ecl-link ecl-link--standalone ecl-card__link\\"
>
<span class=\\"ecl-link__label\\">link 1</span>
link 1
</a>
</li>
<li class=\\"ecl-card__link-item\\">
<a
href=\\"/example-2\\"
class=\\"ecl-link ecl-link--standalone ecl-card__link\\"
>
<span class=\\"ecl-link__label\\">link 2</span>
link 2
</a>
</li>
<li class=\\"ecl-card__link-item\\">
<a
href=\\"/example-3\\"
class=\\"ecl-link ecl-link--standalone ecl-card__link\\"
>
<span class=\\"ecl-link__label\\">link 3</span>
link 3
</a>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,15 @@ exports[`EC - Footer Corporate renders correctly 1`] = `
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__section-link\\"
>
<span class=\\"ecl-link__label\\"
>Commission and its priorities</span
>
Commission and its priorities
</a>
</li>
<li class=\\"ecl-footer__section-item\\">
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__section-link\\"
>
<span class=\\"ecl-link__label\\"
>Policies, information and services</span
>
Policies, information and services
</a>
</li>
</ul>
Expand Down Expand Up @@ -155,51 +151,49 @@ exports[`EC - Footer Corporate renders correctly 1`] = `
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\"
>About the Commission's new web presence</span
>
About the Commission's new web presence
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Language policy</span>
Language policy
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Resources for partners</span>
Resources for partners
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Cookies</span>
Cookies
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Privacy policy</span>
Privacy policy
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Legal notice</span>
Legal notice
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Contact</span>
Contact
</a>
</div>
</section>
Expand Down Expand Up @@ -288,28 +282,28 @@ exports[`EC - Footer Custom renders correctly 1`] = `
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__identity-link\\"
>
<span class=\\"ecl-link__label\\">Contact</span>
Contact
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__identity-link\\"
>
<span class=\\"ecl-link__label\\">Sitemap</span>
Sitemap
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__identity-link\\"
>
<span class=\\"ecl-link__label\\">Lorem ipsum</span>
Lorem ipsum
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__identity-link\\"
>
<span class=\\"ecl-link__label\\">Lorem ipsum dolor sit</span>
Lorem ipsum dolor sit
</a>
</div>
</div>
Expand All @@ -328,19 +322,15 @@ exports[`EC - Footer Custom renders correctly 1`] = `
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__section-link\\"
>
<span class=\\"ecl-link__label\\"
>Commission and its priorities</span
>
Commission and its priorities
</a>
</li>
<li class=\\"ecl-footer__section-item\\">
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__section-link\\"
>
<span class=\\"ecl-link__label\\"
>Policies, information and services</span
>
Policies, information and services
</a>
</li>
</ul>
Expand Down Expand Up @@ -453,51 +443,49 @@ exports[`EC - Footer Custom renders correctly 1`] = `
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\"
>About the Commission's new web presence</span
>
About the Commission's new web presence
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Language policy</span>
Language policy
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Resources for partners</span>
Resources for partners
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Cookies</span>
Cookies
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Privacy policy</span>
Privacy policy
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Legal notice</span>
Legal notice
</a>
<a
href=\\"/example\\"
class=\\"ecl-link ecl-link--standalone ecl-footer__common-link\\"
>
<span class=\\"ecl-link__label\\">Contact</span>
Contact
</a>
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

exports[`EC - Link Default - link default renders correctly 1`] = `
"<a href=\\"/path\\" class=\\"ecl-link ecl-link--default\\">
<span class=\\"ecl-link__label\\"></span>
Default link
</a>
"
`;
exports[`EC - Link Standalone - link standalone renders correctly 1`] = `
"<a href=\\"/path\\" class=\\"ecl-link ecl-link--standalone\\">
<span class=\\"ecl-link__label\\"></span>
Standalone link
</a>
"
`;
Expand All @@ -19,7 +19,7 @@ exports[`EC - Link With icon after - link with icon renders correctly 1`] = `
href=\\"/path\\"
class=\\"ecl-link ecl-link--standalone ecl-link--icon ecl-link--icon-after\\"
>
<span class=\\"ecl-link__label\\"></span>
<span class=\\"ecl-link__label\\">Standalone link with icon</span>
&nbsp;
<svg
Expand All @@ -46,7 +46,7 @@ exports[`EC - Link With icon before - link with icon renders correctly 1`] = `
<use xlink:href=\\"static/icons.svg#ui--external\\"></use>
</svg>
&nbsp;
<span class=\\"ecl-link__label\\"></span>
<span class=\\"ecl-link__label\\">Standalone link with icon</span>
</a>
"
`;
16 changes: 10 additions & 6 deletions src/ec/packages/ec-component-link/link.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@

{# Print the result #}
<a href="{{ _link.path }}" class="{{ _css_class }}"{{ _extra_attributes|raw }}>
{% if _icon.name is not empty and _link.icon_position == 'before' %}
{% include '../ec-component-icon/icon.html.twig' with icon|merge({extra_classes: 'ecl-link__icon'}) %} &nbsp;
{% endif %}
<span class="ecl-link__label">{{ _link.label }}</span>
{% if _icon.name is not empty and _link.icon_position == 'after' %}
&nbsp; {% include '../ec-component-icon/icon.html.twig' with icon|merge({extra_classes: 'ecl-link__icon'}) %}
{% if _icon.name is not empty %}
{% if _link.icon_position == 'before' %}
{% include '../ec-component-icon/icon.html.twig' with icon|merge({extra_classes: 'ecl-link__icon'}) %} &nbsp;
{% endif %}
<span class="ecl-link__label">{{ _link.label }}</span>
{% if _link.icon_position == 'after' %}
&nbsp; {% include '../ec-component-icon/icon.html.twig' with icon|merge({extra_classes: 'ecl-link__icon'}) %}
{% endif %}
{% else %}
{{ _link.label }}
{% endif %}
</a>
2 changes: 2 additions & 0 deletions src/ec/packages/ec-component-link/link.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ storiesOf('Components/Link', module)
type: 'ui',
name: iconsListSelect,
path: defaultSprite,
size: 'fluid',
},
});
},
Expand Down Expand Up @@ -76,6 +77,7 @@ storiesOf('Components/Link', module)
type: 'ui',
name: iconsListSelect,
path: defaultSprite,
size: 'fluid',
},
});
},
Expand Down
10 changes: 5 additions & 5 deletions src/ec/packages/ec-component-link/link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('EC - Link', () => {
const defaultDataStructure = {
link: {
type: '',
text: '',
label: '',
path: '/path',
},
};
Expand All @@ -17,7 +17,7 @@ describe('EC - Link', () => {
expect.assertions(1);

defaultDataStructure.link.type = 'default';
defaultDataStructure.link.text = 'Default link';
defaultDataStructure.link.label = 'Default link';

renderTwigFile(template, defaultDataStructure, (err, html) => {
expect(html).toMatchSnapshot();
Expand All @@ -31,7 +31,7 @@ describe('EC - Link', () => {
expect.assertions(1);

defaultDataStructure.link.type = 'standalone';
defaultDataStructure.link.text = 'Standalone link';
defaultDataStructure.link.label = 'Standalone link';

renderTwigFile(template, defaultDataStructure, (err, html) => {
expect(html).toMatchSnapshot();
Expand All @@ -45,7 +45,7 @@ describe('EC - Link', () => {
expect.assertions(1);

defaultDataStructure.link.type = 'standalone';
defaultDataStructure.link.text = 'Standalone link with icon';
defaultDataStructure.link.label = 'Standalone link with icon';
defaultDataStructure.link.icon_position = 'before';
defaultDataStructure.icon = {
type: 'ui',
Expand All @@ -66,7 +66,7 @@ describe('EC - Link', () => {
expect.assertions(1);

defaultDataStructure.link.type = 'standalone';
defaultDataStructure.link.text = 'Standalone link with icon';
defaultDataStructure.link.label = 'Standalone link with icon';
defaultDataStructure.link.icon_position = 'after';
defaultDataStructure.icon = {
type: 'ui',
Expand Down

0 comments on commit e140dca

Please sign in to comment.