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

feat(breadcrumb-core): Component review - TWIG-222 #303

Merged
merged 3 commits into from
Jan 27, 2020
Merged
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
1 change: 1 addition & 0 deletions src/ec/packages/ec-component-breadcrumb-core/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Core', module)
breadcrumb(
merge(dataSimple, {
icon_file_path: defaultSprite,
ellipsis_label: 'Click to expand',
})
),
{
Expand All @@ -32,7 +31,6 @@ storiesOf('Components/Navigation/Breadcrumbs/Breadcrumb Core', module)
breadcrumb(
merge(dataLong, {
icon_file_path: defaultSprite,
ellipsis_label: 'Click to expand',
})
),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});

Expand All @@ -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' },
Expand All @@ -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',
});

Expand All @@ -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' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ exports[`EC - Page Header Core meta-title - renders correctly 1`] = `
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -194,7 +194,7 @@ exports[`EC - Page Header Core meta-title renders correctly with extra attribute
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -344,7 +344,7 @@ exports[`EC - Page Header Core meta-title renders correctly with extra class nam
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -494,7 +494,7 @@ exports[`EC - Page Header Core meta-title-description - renders correctly 1`] =
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -651,7 +651,7 @@ exports[`EC - Page Header Core meta-title-description renders correctly with ext
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -806,7 +806,7 @@ exports[`EC - Page Header Core meta-title-description renders correctly with ext
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -961,7 +961,7 @@ exports[`EC - Page Header Core title - renders correctly 1`] = `
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -1104,7 +1104,7 @@ exports[`EC - Page Header Core title renders correctly with extra attributes 1`]
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down Expand Up @@ -1245,7 +1245,7 @@ exports[`EC - Page Header Core title renders correctly with extra class names 1`
data-ecl-breadcrumb-core-ellipsis=""
>
<button
aria-label=""
aria-label="Click to expand"
class="ecl-breadcrumb-core__ellipsis"
data-ecl-breadcrumb-core-ellipsis-button=""
type="button"
Expand Down