@oslokommune/punkt-react 19.15.4 → 19.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -881,7 +881,7 @@ var Ne = (e, t) => {
881
881
  props: a
882
882
  })
883
883
  }, t))
884
- }), d({
884
+ }), c && d({
885
885
  href: c.href,
886
886
  className: "pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",
887
887
  children: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(J, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "19.15.4",
3
+ "version": "19.15.5",
4
4
  "description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo kommune",
@@ -101,5 +101,5 @@
101
101
  "url": "https://github.com/oslokommune/punkt/issues"
102
102
  },
103
103
  "license": "MIT",
104
- "gitHead": "dee1f862952b4a13c654f3b82d28a68922fad014"
104
+ "gitHead": "0baab53f4a1bd33c07a73d24eacbd66087c98738"
105
105
  }
@@ -56,6 +56,20 @@ describe('PktBreadcrumbs Component', () => {
56
56
  expect(getAllByText('Item')).toBeTruthy()
57
57
  })
58
58
 
59
+ it('renders a single crumb without a back link', () => {
60
+ const { container, getByText } = render(<PktBreadcrumbs breadcrumbs={breadcrumbs.slice(0, 1)} />)
61
+
62
+ expect(getByText('Home').closest('[aria-current="true"]')).toBeInTheDocument()
63
+ expect(container.querySelector('.pkt-breadcrumbs--mobile')).not.toBeInTheDocument()
64
+ })
65
+
66
+ it('renders an empty trail without a back link', () => {
67
+ const { container } = render(<PktBreadcrumbs breadcrumbs={[]} />)
68
+
69
+ expect(container.querySelector('.pkt-breadcrumbs__item')).not.toBeInTheDocument()
70
+ expect(container.querySelector('.pkt-breadcrumbs--mobile')).not.toBeInTheDocument()
71
+ })
72
+
59
73
  it('renders with no wcag errors with axe', async () => {
60
74
  const { container } = render(<PktBreadcrumbs breadcrumbs={breadcrumbs} navigationType="anchor" />)
61
75
  const results = await axe(container)
@@ -78,21 +78,22 @@ export const PktBreadcrumbs = forwardRef(
78
78
  ))}
79
79
  </ol>
80
80
 
81
- {linkRenderer({
82
- href: backLink.href,
83
- className: 'pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile',
84
- children: (
85
- <>
86
- <PktIcon
87
- className="pkt-back-link__icon pkt-icon pkt-link__icon"
88
- name="chevron-thin-left"
89
- aria-hidden="true"
90
- />
91
- <span className="pkt-breadcrumbs__text">{backLink.text}</span>
92
- </>
93
- ),
94
- props,
95
- })}
81
+ {backLink &&
82
+ linkRenderer({
83
+ href: backLink.href,
84
+ className: 'pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile',
85
+ children: (
86
+ <>
87
+ <PktIcon
88
+ className="pkt-back-link__icon pkt-icon pkt-link__icon"
89
+ name="chevron-thin-left"
90
+ aria-hidden="true"
91
+ />
92
+ <span className="pkt-breadcrumbs__text">{backLink.text}</span>
93
+ </>
94
+ ),
95
+ props,
96
+ })}
96
97
  </nav>
97
98
  )
98
99
  },