@oslokommune/punkt-react 20.1.4 → 20.1.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [20.1.5](https://github.com/oslokommune/punkt/compare/20.1.4...20.1.5) (2026-11-12)
9
+
10
+ ### Bug Fixes
11
+ * Legg til tester for "valueAdded"-streng i combobox.
12
+
13
+ ---
14
+
15
+
8
16
  ## [20.1.4](https://github.com/oslokommune/punkt/compare/20.1.3...20.1.4) (2026-11-12)
9
17
 
10
18
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "20.1.4",
3
+ "version": "20.1.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",
@@ -102,5 +102,5 @@
102
102
  "url": "https://github.com/oslokommune/punkt/issues"
103
103
  },
104
104
  "license": "MIT",
105
- "gitHead": "3f146720edddb4d65cc1904790938c0858e9072a"
105
+ "gitHead": "12b6f8cf53ddc1a50ff7d17dd7ceb70c068e058e"
106
106
  }
@@ -496,6 +496,41 @@ describe('PktCombobox', () => {
496
496
  })
497
497
  })
498
498
 
499
+ describe('Value added message', () => {
500
+ const addCustomValue = (props: Partial<IPktCombobox> = {}) => {
501
+ const handleValueChange = vi.fn()
502
+ const { container } = createComboboxTest({
503
+ allowUserInput: true,
504
+ options: getDefaultOptions(),
505
+ onValueChange: handleValueChange,
506
+ ...props,
507
+ })
508
+
509
+ const textInput = container.querySelector('input[type="text"]') as HTMLInputElement
510
+ fireEvent.focus(textInput)
511
+ fireEvent.change(textInput, { target: { value: 'NewFruit' } })
512
+ fireEvent.keyDown(textInput, { key: 'Enter' })
513
+
514
+ return { container, handleValueChange }
515
+ }
516
+
517
+ test('shows value added message after adding a custom value', () => {
518
+ const { container } = addCustomValue()
519
+
520
+ const banner = container.querySelector('.pkt-listbox__banner--user-message')
521
+ expect(banner).toHaveTextContent('Ny verdi lagt til')
522
+ })
523
+
524
+ test('hides value added message when combobox.valueAdded is an empty string', () => {
525
+ const { container, handleValueChange } = addCustomValue({
526
+ strings: { combobox: { valueAdded: '' } },
527
+ })
528
+
529
+ expect(handleValueChange).toHaveBeenCalledWith(['NewFruit'])
530
+ expect(container.querySelector('.pkt-listbox__banner--user-message')).not.toBeInTheDocument()
531
+ })
532
+ })
533
+
499
534
  describe('Children as options', () => {
500
535
  test('handles options from children correctly', () => {
501
536
  const handleValueChange = vi.fn()