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

Commit

Permalink
fix(site-header-harmonised): Add missing group class - TWIG-106 (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
papegaill authored and planctus committed Oct 29, 2019
1 parent a188400 commit 87f9017
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/ec/packages/ec-component-site-header-harmonised/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ npm install --save @ecl-twig/ec-component-site-header-harmonised

### Parameters

- "group" (string) (default: 'group1'): 'group1' or 'group2'
- "logged" (boolean) (default: false): Whether the user is logged in or not
- "menu" (boolean) (default: false): Whether the component includes a menu or not
- "menu_label" (string) (default: false): The menu toggler label
Expand Down Expand Up @@ -57,6 +58,7 @@ npm install --save @ecl-twig/ec-component-site-header-harmonised
<!-- prettier-ignore -->
```twig
{% include '@ecl-twig/ec-component-site-header-harmonised/site-header-harmonised.html.twig' with {
group: 'group1',
bannerTop: 'Class name',
banner: 'Site name',
menu: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`EC - Site Header Harmonised Group 1 renders correctly 1`] = `
<header
class="ecl-site-header-harmonised"
class="ecl-site-header-harmonised ecl-site-header-harmonised--group2"
data-ecl-auto-init="SiteHeaderHarmonised"
>
<div
Expand Down Expand Up @@ -752,7 +752,7 @@ exports[`EC - Site Header Harmonised Group 1 renders correctly 1`] = `

exports[`EC - Site Header Harmonised Group 1 renders correctly with extra attributes 1`] = `
<header
class="ecl-site-header-harmonised"
class="ecl-site-header-harmonised ecl-site-header-harmonised--group2"
data-ecl-auto-init="SiteHeaderHarmonised"
data-test="data-test-value"
data-test-1="data-test-value-1"
Expand Down Expand Up @@ -1504,7 +1504,7 @@ exports[`EC - Site Header Harmonised Group 1 renders correctly with extra attrib

exports[`EC - Site Header Harmonised Group 1 renders correctly with extra class names 1`] = `
<header
class="ecl-site-header-harmonised custom-class custom-class--test"
class="ecl-site-header-harmonised ecl-site-header-harmonised--group2 custom-class custom-class--test"
data-ecl-auto-init="SiteHeaderHarmonised"
>
<div
Expand Down Expand Up @@ -2254,7 +2254,7 @@ exports[`EC - Site Header Harmonised Group 1 renders correctly with extra class

exports[`EC - Site Header Harmonised Group 2 renders correctly 1`] = `
<header
class="ecl-site-header-harmonised"
class="ecl-site-header-harmonised ecl-site-header-harmonised--group1"
data-ecl-auto-init="SiteHeaderHarmonised"
>
<div
Expand Down Expand Up @@ -2786,7 +2786,7 @@ exports[`EC - Site Header Harmonised Group 2 renders correctly 1`] = `

exports[`EC - Site Header Harmonised Group 2 renders correctly with extra attributes 1`] = `
<header
class="ecl-site-header-harmonised"
class="ecl-site-header-harmonised ecl-site-header-harmonised--group1"
data-ecl-auto-init="SiteHeaderHarmonised"
data-test="data-test-value"
data-test-1="data-test-value-1"
Expand Down Expand Up @@ -3320,7 +3320,7 @@ exports[`EC - Site Header Harmonised Group 2 renders correctly with extra attrib

exports[`EC - Site Header Harmonised Group 2 renders correctly with extra class names 1`] = `
<header
class="ecl-site-header-harmonised custom-class custom-class--test"
class="ecl-site-header-harmonised ecl-site-header-harmonised--group1 custom-class custom-class--test"
data-ecl-auto-init="SiteHeaderHarmonised"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{#
Parameters:
- "group" (string): 'group1' or 'group2'
- "icon_file_path" (string) (default: ''): URL to icons file
- "banner_top" (string): Class name
- "banner" (string): Site name
Expand Down Expand Up @@ -65,6 +66,7 @@

{# Default variables #}

{% set _group = group|default('group1') %}
{% set _logo = logo|default({}) %}
{% set _language_selector = language_selector|default({}) %}
{% set _login_box = login_box|default({}) %}
Expand All @@ -74,7 +76,7 @@
{% set _logged = logged|default(false) %}
{% set _menu = menu|default(false) %}
{% set _extra_attributes = '' %}
{% set _css_class = 'ecl-site-header-harmonised' %}
{% set _css_class = 'ecl-site-header-harmonised ecl-site-header-harmonised--' ~ _group %}

{% set _search_form = {
text_input: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ storiesOf('Components/Site Headers/Harmonised', module)
.add(
'group 1',
() => {
dataGroup1.group = 'group1';
dataGroup1.logged = true;
dataGroup1.icon_file_path = defaultSprite;
dataGroup1.logo.src = logo;
Expand All @@ -26,6 +27,7 @@ storiesOf('Components/Site Headers/Harmonised', module)
.add(
'group 2',
() => {
dataGroup2.group = 'group2';
dataGroup2.icon_file_path = defaultSprite;
dataGroup2.logo.src = logo;
return siteHeaderHarmonised(dataGroup2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('EC - Site Header Harmonised', () => {
const render = params => renderTwigFileAsNode(template, params);

describe('Group 1', () => {
dataGroup1.group = 'group1';
test('renders correctly', () => {
expect.assertions(1);
return expect(render(dataGroup1)).resolves.toMatchSnapshot();
Expand Down Expand Up @@ -38,6 +39,7 @@ describe('EC - Site Header Harmonised', () => {
});

describe('Group 2', () => {
dataGroup1.group = 'group2';
test('renders correctly', () => {
expect.assertions(1);
return expect(render(dataGroup2)).resolves.toMatchSnapshot();
Expand Down

0 comments on commit 87f9017

Please sign in to comment.