diff --git a/webapp/src/widgets/propertyMenu.test.tsx b/webapp/src/widgets/propertyMenu.test.tsx
index b7936cfbf..acd8b7dc8 100644
--- a/webapp/src/widgets/propertyMenu.test.tsx
+++ b/webapp/src/widgets/propertyMenu.test.tsx
@@ -2,7 +2,7 @@
// See LICENSE.txt for license information.
import React from 'react'
-import {render} from '@testing-library/react'
+import {fireEvent, render, screen} from '@testing-library/react'
import '@testing-library/jest-dom'
import {IntlProvider} from 'react-intl'
@@ -16,8 +16,6 @@ describe('widgets/PropertyMenu', () => {
})
test('should display the type of property', () => {
- const rootPortalDiv = document.createElement('div')
- rootPortalDiv.id = 'root-portal'
const callback = jest.fn()
const {getByText} = render(
@@ -31,9 +29,48 @@ describe('widgets/PropertyMenu', () => {
onDelete={callback}
/>
,
- {container: document.body.appendChild(rootPortalDiv)},
)
expect(getByText('Type: Email')).toBeVisible()
})
+
+ test('handles delete event', () => {
+ const callback = jest.fn()
+
+ render(
+
+
+ ,
+ )
+ fireEvent.click(screen.getByText(/delete/i))
+ expect(callback).toHaveBeenCalledWith('id')
+ })
+
+ test('handles name change event', () => {
+ const callback = jest.fn()
+
+ render(
+
+
+ ,
+ )
+ const input = screen.getByDisplayValue(/test-property/i)
+ fireEvent.change(input, {target: {value: 'changed name'}})
+ fireEvent.blur(input)
+ expect(callback).toHaveBeenCalledWith('changed name')
+ })
})