Skip to content

Commit

Permalink
Merge pull request #575 from SwedbankPay/fix/issue-#101-breadcrumb
Browse files Browse the repository at this point in the history
Fix/issue #101 breadcrumb
  • Loading branch information
eskilsen authored Oct 28, 2021
2 parents 925fe83 + 4752c01 commit cb350b9
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 60 deletions.
122 changes: 65 additions & 57 deletions src/App/components/Breadcrumb/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,74 +1,82 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Component: Breadcrumb renders breadcrumb with the provided items in the items prop 1`] = `
<ol
className="breadcrumb"
>
<li
key="0"
<nav>
<ol
className="breadcrumb"
>
<span>
test
</span>
</li>
</ol>
<li
key="0"
>
<span>
test
</span>
</li>
</ol>
</nav>
`;

exports[`Component: Breadcrumb renders breadcrumb with the provided items wrapped in anchor tags when href is provided in the items prop 1`] = `
<ol
className="breadcrumb"
>
<li
key="0"
<nav>
<ol
className="breadcrumb"
>
<a
href="www.example.com"
<li
key="0"
>
test
</a>
</li>
</ol>
<a
href="www.example.com"
>
test
</a>
</li>
</ol>
</nav>
`;

exports[`Component: Breadcrumb renders multiple breadcrumbs when provided in the items prop 1`] = `
<ol
className="breadcrumb"
>
<li
key="0"
>
<span>
test #1
</span>
</li>
<li
key="1"
>
<span>
test #2
</span>
</li>
<li
key="2"
<nav>
<ol
className="breadcrumb"
>
<span>
test #3
</span>
</li>
<li
key="3"
>
<span>
test #4
</span>
</li>
</ol>
<li
key="0"
>
<span>
test #1
</span>
</li>
<li
key="1"
>
<span>
test #2
</span>
</li>
<li
key="2"
>
<span>
test #3
</span>
</li>
<li
key="3"
>
<span>
test #4
</span>
</li>
</ol>
</nav>
`;

exports[`Component: Breadcrumb renders with default items when no items is provided through items prop 1`] = `
<ol
className="breadcrumb"
>
<DefaultItems />
</ol>
<nav>
<ol
className="breadcrumb"
>
<DefaultItems />
</ol>
</nav>
`;
8 changes: 5 additions & 3 deletions src/App/components/Breadcrumb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ const DefaultItems = () => (
);

const Breadcrumb = ({ items }) => (
<ol className="breadcrumb">
{items ? _renderItems(items) : <DefaultItems />}
</ol>
<nav>
<ol className="breadcrumb">
{items ? _renderItems(items) : <DefaultItems />}
</ol>
</nav>
);

Breadcrumb.propTypes = {
Expand Down

0 comments on commit cb350b9

Please sign in to comment.