1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-08 15:06:08 +02:00

GH-3916 fix property change (#3920)

This commit is contained in:
Scott Bishel 2022-10-04 12:51:46 -06:00 committed by GitHub
parent f0619a084e
commit 5bf4039350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -2,7 +2,7 @@
// See LICENSE.txt for license information.
import React from 'react'
import {render, screen, act} from '@testing-library/react'
import {render, screen, act, fireEvent} from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import {mocked} from 'jest-mock'
import '@testing-library/jest-dom'
@ -165,6 +165,24 @@ describe('components/cardDetail/CardDetailProperties', () => {
})
})
it('should allow change property types menu, confirm', () => {
renderComponent()
const menuElement = screen.getByRole('button', {name: 'Owner'})
userEvent.click(menuElement)
const typeProperty = screen.getByText(/Type: Select/i)
expect(typeProperty).toBeInTheDocument()
fireEvent.mouseOver(typeProperty)
const newTypeMenu = screen.getByRole('button', {name: 'Text'})
userEvent.click(newTypeMenu)
expect(screen.getByRole('heading', {name: 'Confirm property type change'})).toBeInTheDocument()
expect(screen.getByRole('button', {name: /Change property/i})).toBeInTheDocument()
})
test('rename select property and confirm button on dialog should rename property', async () => {
const result = renderComponent()

View File

@ -69,7 +69,7 @@ const CardDetailProperties = (props: Props) => {
const subTextString = intl.formatMessage({
id: 'CardDetailProperty.property-name-change-subtext',
defaultMessage: 'type from "{oldPropType}" to "{newPropType}"',
}, {oldPropType: oldType, newPropType: newType})
}, {oldPropType: oldType.displayName(intl), newPropType: newType.displayName(intl)})
setConfirmationDialogBox({
heading: intl.formatMessage({id: 'CardDetailProperty.confirm-property-type-change', defaultMessage: 'Confirm property type change'}),