mirror of
https://github.com/langgenius/dify.git
synced 2026-04-19 18:27:27 +08:00
fix: update AlertDialog test assertions to check data-closed attribute
After removing conditional guards, base-ui AlertDialog keeps portal
content in DOM during exit transition (transitionend never fires in
JSDOM). Replace not.toBeInTheDocument() with toHaveAttribute('data-closed')
to assert dialog closure state instead of DOM removal.
Made-with: Cursor
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import type { EndpointListItem, PluginDetail } from '../../types'
|
||||
import { act, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import EndpointCard from '../endpoint-card'
|
||||
|
||||
@ -284,8 +284,7 @@ describe('EndpointCard', () => {
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))
|
||||
|
||||
// Confirm should be hidden
|
||||
expect(screen.queryByText('plugin.detailPanel.endpointDisableTip')).not.toBeInTheDocument()
|
||||
expect(screen.getByRole('alertdialog')).toHaveAttribute('data-closed')
|
||||
})
|
||||
|
||||
it('should hide delete confirm when cancel clicked', () => {
|
||||
@ -297,7 +296,7 @@ describe('EndpointCard', () => {
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))
|
||||
|
||||
expect(screen.queryByText('plugin.detailPanel.endpointDeleteTip')).not.toBeInTheDocument()
|
||||
expect(screen.getByRole('alertdialog')).toHaveAttribute('data-closed')
|
||||
})
|
||||
|
||||
it('should hide edit modal when cancel clicked', () => {
|
||||
|
||||
@ -702,7 +702,7 @@ describe('ProviderDetail', () => {
|
||||
fireEvent.click(screen.getByTestId('edit-remove'))
|
||||
expect(screen.getByText('tools.createTool.deleteToolConfirmTitle')).toBeInTheDocument()
|
||||
fireEvent.click(getDeleteCancelButton())
|
||||
expect(screen.queryByText('tools.createTool.deleteToolConfirmTitle')).not.toBeInTheDocument()
|
||||
expect(screen.getByRole('alertdialog')).toHaveAttribute('data-closed')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user