@oslokommune/punkt-elements 13.5.6 → 13.5.9
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 +17 -0
- package/package.json +9 -9
- package/src/components/alert/alert.test.ts +3 -2
- package/src/components/button/button.test.ts +6 -5
- package/src/components/card/card.test.ts +5 -4
- package/src/components/combobox/combobox.test.ts +2 -1
- package/src/components/consent/consent.test.ts +22 -21
- package/src/components/heading/heading.test.ts +2 -1
- package/src/components/icon/icon.test.ts +3 -2
- package/src/components/link/link.test.ts +2 -1
- package/src/components/messagebox/messagebox.test.ts +3 -2
- package/src/components/radiobutton/radiobutton.test.ts +3 -2
- package/src/components/select/select.test.ts +3 -2
- package/src/components/tag/tag.test.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [13.5.9](https://github.com/oslokommune/punkt/compare/13.5.8...13.5.9) (2025-09-11)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [13.5.6](https://github.com/oslokommune/punkt/compare/13.5.5...13.5.6) (2025-09-09)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.9",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"build": "tsc && vite build",
|
|
20
20
|
"build-app": "tsc && vite build --config vite.config-app.ts",
|
|
21
21
|
"preview": "vite preview --outDir dist-app",
|
|
22
|
-
"test": "
|
|
22
|
+
"test": "vitest",
|
|
23
|
+
"test:run": "vitest run",
|
|
24
|
+
"test:ui": "vitest --ui"
|
|
23
25
|
},
|
|
24
26
|
"dependencies": {
|
|
25
27
|
"@date-fns/tz": "^1.2.0",
|
|
26
28
|
"@lit-labs/router": "^0.1.3",
|
|
27
|
-
"@types/jest": "^29.5.14",
|
|
28
29
|
"@types/node": "^20.17.30",
|
|
29
|
-
"@types/testing-library__jest-dom": "^5.14.9",
|
|
30
30
|
"date-fns": "^4.1.0",
|
|
31
31
|
"dialog-polyfill": "^0.5.6",
|
|
32
32
|
"lit": "^3.3.0",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"@oslokommune/punkt-assets": "^13.3.1",
|
|
44
44
|
"@oslokommune/punkt-css": "^13.5.0",
|
|
45
45
|
"@testing-library/jest-dom": "^6.6.3",
|
|
46
|
-
"
|
|
46
|
+
"@vitest/ui": "^1.0.0",
|
|
47
47
|
"jest-axe": "^9.0.0",
|
|
48
|
-
"
|
|
48
|
+
"jsdom": "^23.0.0",
|
|
49
49
|
"sass": "^1.78.0",
|
|
50
|
-
"ts-jest": "^29.2.6",
|
|
51
50
|
"typescript": "^5.6.2",
|
|
52
51
|
"vite": "^5.4.18",
|
|
53
52
|
"vite-plugin-dts": "^4.2.1",
|
|
54
|
-
"vite-plugin-web-components-hmr": "^0.1.3"
|
|
53
|
+
"vite-plugin-web-components-hmr": "^0.1.3",
|
|
54
|
+
"vitest": "^1.0.0"
|
|
55
55
|
},
|
|
56
56
|
"private": false,
|
|
57
57
|
"publishConfig": {
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
74
74
|
},
|
|
75
75
|
"license": "MIT",
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "92ee2058dae920d5ab968d8a1691f435a795e2ca"
|
|
77
77
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import './alert'
|
|
@@ -215,8 +216,8 @@ describe('PktAlert', () => {
|
|
|
215
216
|
await alert.updateComplete
|
|
216
217
|
|
|
217
218
|
// Listen for close events
|
|
218
|
-
const closeSpy =
|
|
219
|
-
const onCloseSpy =
|
|
219
|
+
const closeSpy = vi.fn()
|
|
220
|
+
const onCloseSpy = vi.fn()
|
|
220
221
|
alert.addEventListener('close', closeSpy)
|
|
221
222
|
alert.addEventListener('on-close', onCloseSpy)
|
|
222
223
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import './button'
|
|
@@ -241,7 +242,7 @@ describe('PktButton', () => {
|
|
|
241
242
|
|
|
242
243
|
test('prevents click events when disabled', async () => {
|
|
243
244
|
const { button } = await createButtonTest({ disabled: true, content: 'Test Button' })
|
|
244
|
-
const clickSpy =
|
|
245
|
+
const clickSpy = vi.fn()
|
|
245
246
|
|
|
246
247
|
await button.updateComplete
|
|
247
248
|
|
|
@@ -255,7 +256,7 @@ describe('PktButton', () => {
|
|
|
255
256
|
|
|
256
257
|
test('prevents keyboard events when disabled', async () => {
|
|
257
258
|
const { button } = await createButtonTest({ disabled: true, content: 'Test Button' })
|
|
258
|
-
const clickSpy =
|
|
259
|
+
const clickSpy = vi.fn()
|
|
259
260
|
|
|
260
261
|
await button.updateComplete
|
|
261
262
|
|
|
@@ -310,7 +311,7 @@ describe('PktButton', () => {
|
|
|
310
311
|
|
|
311
312
|
test('prevents click events when loading', async () => {
|
|
312
313
|
const { button } = await createButtonTest({ content: 'Test Button' })
|
|
313
|
-
const clickSpy =
|
|
314
|
+
const clickSpy = vi.fn()
|
|
314
315
|
|
|
315
316
|
// Set isLoading as a property
|
|
316
317
|
button.isLoading = true
|
|
@@ -375,7 +376,7 @@ describe('PktButton', () => {
|
|
|
375
376
|
describe('Click functionality', () => {
|
|
376
377
|
test('allows click events when not disabled or loading', async () => {
|
|
377
378
|
const { button } = await createButtonTest({ content: 'Test Button' })
|
|
378
|
-
const clickSpy =
|
|
379
|
+
const clickSpy = vi.fn()
|
|
379
380
|
|
|
380
381
|
await button.updateComplete
|
|
381
382
|
|
|
@@ -389,7 +390,7 @@ describe('PktButton', () => {
|
|
|
389
390
|
|
|
390
391
|
test('allows keyboard activation when not disabled or loading', async () => {
|
|
391
392
|
const { button } = await createButtonTest({ content: 'Test Button' })
|
|
392
|
-
const clickSpy =
|
|
393
|
+
const clickSpy = vi.fn()
|
|
393
394
|
|
|
394
395
|
await button.updateComplete
|
|
395
396
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
|
+
import { vi } from 'vitest'
|
|
3
4
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
4
5
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
5
6
|
import './card'
|
|
@@ -43,9 +44,9 @@ afterEach(() => {
|
|
|
43
44
|
})
|
|
44
45
|
|
|
45
46
|
// Global console.warn spy to suppress validation warnings in tests
|
|
46
|
-
let consoleWarnSpy:
|
|
47
|
+
let consoleWarnSpy: any
|
|
47
48
|
beforeEach(() => {
|
|
48
|
-
consoleWarnSpy =
|
|
49
|
+
consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
49
50
|
})
|
|
50
51
|
|
|
51
52
|
afterEach(() => {
|
|
@@ -151,7 +152,7 @@ describe('PktCard', () => {
|
|
|
151
152
|
test('validates skin values and logs warnings for invalid skins', async () => {
|
|
152
153
|
// Clear the global spy and create a new one for this specific test
|
|
153
154
|
consoleWarnSpy.mockRestore()
|
|
154
|
-
const localConsoleSpy =
|
|
155
|
+
const localConsoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
155
156
|
|
|
156
157
|
const { card } = await createCardTest({ skin: 'zebra' })
|
|
157
158
|
await card.updateComplete
|
|
@@ -166,7 +167,7 @@ describe('PktCard', () => {
|
|
|
166
167
|
|
|
167
168
|
// Restore and recreate global spy for subsequent tests
|
|
168
169
|
localConsoleSpy.mockRestore()
|
|
169
|
-
consoleWarnSpy =
|
|
170
|
+
consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
170
171
|
})
|
|
171
172
|
|
|
172
173
|
test('applies different layout properties correctly', async () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
|
|
5
6
|
expect.extend(toHaveNoViolations)
|
|
6
7
|
|
|
@@ -706,7 +707,7 @@ describe('PktCombobox', () => {
|
|
|
706
707
|
const combobox = container.querySelector('pkt-combobox') as PktCombobox
|
|
707
708
|
await combobox.updateComplete
|
|
708
709
|
|
|
709
|
-
const searchEventSpy =
|
|
710
|
+
const searchEventSpy = vi.fn()
|
|
710
711
|
combobox.addEventListener('search', searchEventSpy)
|
|
711
712
|
|
|
712
713
|
// Simulate search change
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import './consent'
|
|
@@ -46,13 +47,13 @@ afterEach(() => {
|
|
|
46
47
|
}
|
|
47
48
|
// Clean up global variables
|
|
48
49
|
delete window.cookieBanner_googleAnalyticsId
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
;(window as any).cookieBanner_hotjarId = undefined
|
|
51
|
+
;(window as any).cookieBanner_devMode = undefined
|
|
52
|
+
;(window as any).cookieBanner_cookieDomain = undefined
|
|
53
|
+
;(window as any).cookieBanner_cookieSecure = undefined
|
|
54
|
+
;(window as any).cookieBanner_cookieExpiryDays = undefined
|
|
55
|
+
;(window as any).cookieBanner = undefined
|
|
56
|
+
;(window as any).__cookieEvents = undefined
|
|
56
57
|
})
|
|
57
58
|
|
|
58
59
|
describe('PktConsent', () => {
|
|
@@ -218,10 +219,10 @@ describe('PktConsent', () => {
|
|
|
218
219
|
Object.defineProperty(window, 'cookieBanner', {
|
|
219
220
|
value: {
|
|
220
221
|
cookieConsent: {
|
|
221
|
-
validateConsentCookie:
|
|
222
|
-
getConsentCookie:
|
|
222
|
+
validateConsentCookie: vi.fn().mockResolvedValue(true),
|
|
223
|
+
getConsentCookie: vi.fn().mockReturnValue('mock-cookie'),
|
|
223
224
|
},
|
|
224
|
-
openCookieModal:
|
|
225
|
+
openCookieModal: vi.fn(),
|
|
225
226
|
},
|
|
226
227
|
writable: true,
|
|
227
228
|
})
|
|
@@ -229,21 +230,21 @@ describe('PktConsent', () => {
|
|
|
229
230
|
// Mock window.__cookieEvents
|
|
230
231
|
Object.defineProperty(window, '__cookieEvents', {
|
|
231
232
|
value: {
|
|
232
|
-
on:
|
|
233
|
-
off:
|
|
233
|
+
on: vi.fn(),
|
|
234
|
+
off: vi.fn(),
|
|
234
235
|
},
|
|
235
236
|
writable: true,
|
|
236
237
|
})
|
|
237
238
|
|
|
238
239
|
// Use fake timers to control setTimeout
|
|
239
|
-
|
|
240
|
+
vi.useFakeTimers()
|
|
240
241
|
})
|
|
241
242
|
|
|
242
243
|
afterEach(() => {
|
|
243
244
|
// Clean up mocks and timers
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
vi.useRealTimers()
|
|
246
|
+
;(window as any).cookieBanner = undefined
|
|
247
|
+
;(window as any).__cookieEvents = undefined
|
|
247
248
|
})
|
|
248
249
|
|
|
249
250
|
test('handles click event on button trigger', async () => {
|
|
@@ -255,7 +256,7 @@ describe('PktConsent', () => {
|
|
|
255
256
|
fireEvent.click(button!)
|
|
256
257
|
|
|
257
258
|
// Fast-forward time to trigger setTimeout
|
|
258
|
-
|
|
259
|
+
vi.runAllTimers()
|
|
259
260
|
|
|
260
261
|
expect(window.cookieBanner.openCookieModal).toHaveBeenCalled()
|
|
261
262
|
})
|
|
@@ -271,7 +272,7 @@ describe('PktConsent', () => {
|
|
|
271
272
|
fireEvent.click(link!)
|
|
272
273
|
|
|
273
274
|
// Fast-forward time to trigger setTimeout
|
|
274
|
-
|
|
275
|
+
vi.runAllTimers()
|
|
275
276
|
|
|
276
277
|
expect(window.cookieBanner.openCookieModal).toHaveBeenCalled()
|
|
277
278
|
})
|
|
@@ -415,12 +416,12 @@ describe('PktConsent', () => {
|
|
|
415
416
|
|
|
416
417
|
// Mock the event system
|
|
417
418
|
window.__cookieEvents = {
|
|
418
|
-
on:
|
|
419
|
-
off:
|
|
419
|
+
on: vi.fn(),
|
|
420
|
+
off: vi.fn(),
|
|
420
421
|
}
|
|
421
422
|
|
|
422
423
|
// Set up a handler
|
|
423
|
-
const mockHandler =
|
|
424
|
+
const mockHandler = vi.fn()
|
|
424
425
|
consent['_cookieEventHandler'] = mockHandler
|
|
425
426
|
|
|
426
427
|
// Disconnect the component
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
|
+
import { vi } from 'vitest'
|
|
3
4
|
|
|
4
5
|
expect.extend(toHaveNoViolations)
|
|
5
6
|
|
|
@@ -241,7 +242,7 @@ describe('PktHeading', () => {
|
|
|
241
242
|
})
|
|
242
243
|
|
|
243
244
|
test('handles invalid levels gracefully', async () => {
|
|
244
|
-
const consoleSpy =
|
|
245
|
+
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
245
246
|
|
|
246
247
|
const container = await createHeading()
|
|
247
248
|
const heading = container.querySelector('pkt-heading') as PktHeading
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
|
+
import { vi } from 'vitest'
|
|
3
4
|
import {
|
|
4
5
|
createElementTest,
|
|
5
6
|
BaseTestConfig,
|
|
@@ -43,7 +44,7 @@ afterEach(() => {
|
|
|
43
44
|
})
|
|
44
45
|
|
|
45
46
|
// Mock fetch for icon loading
|
|
46
|
-
const mockFetch =
|
|
47
|
+
const mockFetch = vi.fn()
|
|
47
48
|
const mockSvgContent =
|
|
48
49
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="test-path"></path></svg>'
|
|
49
50
|
|
|
@@ -270,7 +271,7 @@ describe('PktIcon', () => {
|
|
|
270
271
|
|
|
271
272
|
describe('Global configuration', () => {
|
|
272
273
|
test('uses custom pktFetch function when provided', async () => {
|
|
273
|
-
const customFetch =
|
|
274
|
+
const customFetch = vi.fn().mockResolvedValue({
|
|
274
275
|
ok: true,
|
|
275
276
|
text: () => Promise.resolve('<svg>custom</svg>'),
|
|
276
277
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import './link'
|
|
@@ -147,7 +148,7 @@ describe('PktLink', () => {
|
|
|
147
148
|
await link.updateComplete
|
|
148
149
|
|
|
149
150
|
const anchor = link.querySelector('a')
|
|
150
|
-
const clickHandler =
|
|
151
|
+
const clickHandler = vi.fn()
|
|
151
152
|
anchor?.addEventListener('click', clickHandler)
|
|
152
153
|
|
|
153
154
|
fireEvent.click(anchor!)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import { type IPktMessagebox } from './messagebox'
|
|
@@ -167,8 +168,8 @@ describe('PktMessagebox', () => {
|
|
|
167
168
|
test('dispatches close events when closed', async () => {
|
|
168
169
|
const { messagebox } = await createMessageboxTest({ closable: true })
|
|
169
170
|
|
|
170
|
-
const closeHandler =
|
|
171
|
-
const onCloseHandler =
|
|
171
|
+
const closeHandler = vi.fn()
|
|
172
|
+
const onCloseHandler = vi.fn()
|
|
172
173
|
messagebox.addEventListener('close', closeHandler)
|
|
173
174
|
messagebox.addEventListener('on-close', onCloseHandler)
|
|
174
175
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import './radiobutton'
|
|
@@ -203,8 +204,8 @@ describe('pkt-radiobutton', () => {
|
|
|
203
204
|
test('manages focus events correctly', async () => {
|
|
204
205
|
const { radiobutton } = await createRadioButtonTest()
|
|
205
206
|
|
|
206
|
-
const focusSpy =
|
|
207
|
-
const blurSpy =
|
|
207
|
+
const focusSpy = vi.fn()
|
|
208
|
+
const blurSpy = vi.fn()
|
|
208
209
|
radiobutton.addEventListener('focus', focusSpy)
|
|
209
210
|
radiobutton.addEventListener('blur', blurSpy)
|
|
210
211
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
|
+
import { vi } from 'vitest'
|
|
3
4
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
4
5
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
5
6
|
import { type IPktSelect, type TSelectOption } from './select'
|
|
@@ -159,8 +160,8 @@ describe('pkt-select', () => {
|
|
|
159
160
|
test('manages focus events correctly', async () => {
|
|
160
161
|
const { select } = await createSelectTest()
|
|
161
162
|
|
|
162
|
-
const focusSpy =
|
|
163
|
-
const blurSpy =
|
|
163
|
+
const focusSpy = vi.spyOn(select, 'onFocus')
|
|
164
|
+
const blurSpy = vi.spyOn(select, 'onBlur')
|
|
164
165
|
|
|
165
166
|
const selectElement = select.querySelector('select') as HTMLSelectElement
|
|
166
167
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { fireEvent } from '@testing-library/dom'
|
|
4
|
+
import { vi } from 'vitest'
|
|
4
5
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
6
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
7
|
import { type IPktTag } from './tag'
|
|
@@ -125,7 +126,7 @@ describe('PktTag', () => {
|
|
|
125
126
|
|
|
126
127
|
test('dispatches close event when close button is clicked', async () => {
|
|
127
128
|
const { tag } = await createTagTest({ closeTag: true })
|
|
128
|
-
const closeSpy =
|
|
129
|
+
const closeSpy = vi.fn()
|
|
129
130
|
tag.addEventListener('close', closeSpy)
|
|
130
131
|
|
|
131
132
|
const button = tag.querySelector('button') as HTMLButtonElement
|