From 2a3965bed93a07f52116063eb204c0c8d9b00d25 Mon Sep 17 00:00:00 2001 From: planctus Date: Fri, 24 Jan 2020 11:20:29 +0100 Subject: [PATCH 1/2] feat(breadcrumb-core): Component review - TWIG-222 --- .../ec-component-breadcrumb-core/adapter.js | 1 + .../breadcrumb-core.story.js | 2 -- .../breadcrumb-core.test.js | 24 ++++++------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/ec/packages/ec-component-breadcrumb-core/adapter.js b/src/ec/packages/ec-component-breadcrumb-core/adapter.js index 99607405a..ff4a53a0d 100644 --- a/src/ec/packages/ec-component-breadcrumb-core/adapter.js +++ b/src/ec/packages/ec-component-breadcrumb-core/adapter.js @@ -7,6 +7,7 @@ const adapter = initialData => { adaptedData.links = adaptedData.items.map(formatLinkAlt); adaptedData.navigation_text = adaptedData.label; adaptedData.icon_file_path = '/icons.svg'; + adaptedData.ellipsis_label = 'Click to expand'; delete adaptedData.label; delete adaptedData.items; diff --git a/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.story.js b/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.story.js index 756b6412f..ed7fd0546 100644 --- a/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.story.js +++ b/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.story.js @@ -19,7 +19,6 @@ storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Core', module) breadcrumb( merge(dataSimple, { icon_file_path: defaultSprite, - ellipsis_label: 'Click to expand', }) ), { @@ -32,7 +31,6 @@ storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Core', module) breadcrumb( merge(dataLong, { icon_file_path: defaultSprite, - ellipsis_label: 'Click to expand', }) ), { diff --git a/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.test.js b/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.test.js index 0bbbff97b..de12f18f2 100644 --- a/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.test.js +++ b/src/ec/packages/ec-component-breadcrumb-core/breadcrumb-core.test.js @@ -9,19 +9,16 @@ describe('EC - Breadcrumb Core', () => { const render = params => renderTwigFileAsNode(template, params); describe('Simple', () => { - const data = merge(dataSimple, { - ellipsis_label: 'Click to expand', - }); - test(`renders correctly`, () => { expect.assertions(1); - return expect(render(data)).resolves.toMatchSnapshot(); + + return expect(render(dataSimple)).resolves.toMatchSnapshot(); }); test('renders correctly with extra class names', () => { expect.assertions(1); - const optionsWithExtraClasses = merge(data, { + const optionsWithExtraClasses = merge(dataSimple, { extra_classes: 'custom-class custom-class--test', }); @@ -31,7 +28,7 @@ describe('EC - Breadcrumb Core', () => { test('renders correctly with extra attributes', () => { expect.assertions(1); - const optionsWithExtraClasses = merge(data, { + const optionsWithExtraClasses = merge(dataSimple, { extra_attributes: [ { name: 'data-test', value: 'data-test-value' }, { name: 'data-test-1', value: 'data-test-value-1' }, @@ -43,22 +40,15 @@ describe('EC - Breadcrumb Core', () => { }); describe('Long', () => { - const data = merge(dataLong, { - extra_attributes: [ - { name: 'data-ecl-auto-init', value: 'BreadcrumbCore' }, - ], - ellipsis_label: 'Click to expand', - }); - test(`renders correctly`, () => { expect.assertions(1); - return expect(render(data)).resolves.toMatchSnapshot(); + return expect(render(dataLong)).resolves.toMatchSnapshot(); }); test('renders correctly with extra class names', () => { expect.assertions(1); - const optionsWithExtraClasses = merge(data, { + const optionsWithExtraClasses = merge(dataLong, { extra_classes: 'custom-class custom-class--test', }); @@ -68,7 +58,7 @@ describe('EC - Breadcrumb Core', () => { test('renders correctly with extra attributes', () => { expect.assertions(1); - const optionsWithExtraClasses = merge(data, { + const optionsWithExtraClasses = merge(dataLong, { extra_attributes: [ { name: 'data-test', value: 'data-test-value' }, { name: 'data-test-1', value: 'data-test-value-1' }, From 927b0f8d844436a4975c2cb84ffda4893a7f037a Mon Sep 17 00:00:00 2001 From: planctus Date: Fri, 24 Jan 2020 11:28:07 +0100 Subject: [PATCH 2/2] feat(breadcrumb-core): Updating page-header-core snapshot after the fixes - TWIG-222 --- .../page-header-core.test.js.snap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ec/packages/ec-component-page-header-core/__snapshots__/page-header-core.test.js.snap b/src/ec/packages/ec-component-page-header-core/__snapshots__/page-header-core.test.js.snap index 4d0ae376d..1a6cd3e75 100644 --- a/src/ec/packages/ec-component-page-header-core/__snapshots__/page-header-core.test.js.snap +++ b/src/ec/packages/ec-component-page-header-core/__snapshots__/page-header-core.test.js.snap @@ -42,7 +42,7 @@ exports[`EC - Page Header Core meta-title - renders correctly 1`] = ` data-ecl-breadcrumb-core-ellipsis="" >