ReUI alignment: AlertDialog for destructive confirms, Input for date range, ghost Button for Alert close
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7638939273
commit
59f882e58c
14 files changed
+71
-40
No files matched your search
@@ -77,7 +77,7 @@ describe('Rules', () => {
|
||||
const remove = vi.spyOn(zonelists, 'deleteDomain').mockResolvedValue(OK)
|
||||
draw(NO_MODIFY)
|
||||
await userEvent.click(await screen.findByRole('button', { name: 'Delete ads.example.com' }))
|
||||
const dialog = await screen.findByRole('dialog')
|
||||
const dialog = await screen.findByRole('alertdialog')
|
||||
expect(dialog).toHaveTextContent("Are you sure you want to delete the blocked zone 'ads.example.com'?")
|
||||
await userEvent.click(within(dialog).getByRole('button', { name: 'Delete' }))
|
||||
expect(remove).toHaveBeenCalledWith('blocked', 'T', 'ads.example.com')
|
||||
@@ -117,7 +117,7 @@ describe('Rules', () => {
|
||||
draw()
|
||||
await userEvent.click(await screen.findByRole('button', { name: 'Flush' }))
|
||||
await userEvent.click(screen.getByRole('menuitem', { name: 'Allowed zones' }))
|
||||
expect(await screen.findByRole('dialog')).toHaveTextContent('Are you sure you want to flush the entire Allowed zone?')
|
||||
expect(await screen.findByRole('alertdialog')).toHaveTextContent('Are you sure you want to flush the entire Allowed zone?')
|
||||
})
|
||||
|
||||
/* The sentences Allowed and Blocked said from their own headers, character for
|
||||
@@ -140,7 +140,7 @@ describe('Rules', () => {
|
||||
draw()
|
||||
await userEvent.click(await screen.findByRole('button', { name: 'Flush' }))
|
||||
await userEvent.click(screen.getByRole('menuitem', { name: 'Blocked zones' }))
|
||||
expect(await screen.findByRole('dialog')).toHaveTextContent('Are you sure you want to flush the entire Blocked zone?')
|
||||
expect(await screen.findByRole('alertdialog')).toHaveTextContent('Are you sure you want to flush the entire Blocked zone?')
|
||||
})
|
||||
|
||||
it('flushing Allowed says so with upstream sentence', async () => {
|
||||
@@ -149,7 +149,7 @@ describe('Rules', () => {
|
||||
draw()
|
||||
await userEvent.click(await screen.findByRole('button', { name: 'Flush' }))
|
||||
await userEvent.click(screen.getByRole('menuitem', { name: 'Allowed zones' }))
|
||||
await userEvent.click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Flush' }))
|
||||
await userEvent.click(within(await screen.findByRole('alertdialog')).getByRole('button', { name: 'Flush' }))
|
||||
expect(await screen.findByText('Allowed zone was flushed successfully.')).toBeInTheDocument()
|
||||
expect(flush).toHaveBeenCalledWith('allowed', 'T')
|
||||
})
|
||||
@@ -194,7 +194,7 @@ describe('Rules', () => {
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Tree' }))
|
||||
const tree = await screen.findByRole('region', { name: 'Records' })
|
||||
await userEvent.click(within(tree).getByRole('button', { name: 'Delete' }))
|
||||
await userEvent.click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Delete' }))
|
||||
await userEvent.click(within(await screen.findByRole('alertdialog')).getByRole('button', { name: 'Delete' }))
|
||||
await vi.waitFor(() => expect(read).toHaveBeenCalledTimes(4))
|
||||
expect(read).toHaveBeenLastCalledWith('allowed', 'T', 'dev.cluster.test')
|
||||
await userEvent.click(screen.getByRole('button', { name: 'List' }))
|
||||
@@ -215,7 +215,7 @@ describe('Rules', () => {
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Tree' }))
|
||||
const tree = await screen.findByRole('region', { name: 'Records' })
|
||||
await userEvent.click(within(tree).getByRole('button', { name: 'Delete' }))
|
||||
await userEvent.click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Delete' }))
|
||||
await userEvent.click(within(await screen.findByRole('alertdialog')).getByRole('button', { name: 'Delete' }))
|
||||
const said = await screen.findAllByText("Blocked zone 'ads.test' was deleted successfully.")
|
||||
expect(said).toHaveLength(1)
|
||||
const bar = screen.getByRole('textbox', { name: 'Domain' })
|
||||
@@ -398,7 +398,7 @@ describe('Rules', () => {
|
||||
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Flush' }))
|
||||
await userEvent.click(screen.getByRole('menuitem', { name: 'Blocked zones' }))
|
||||
await userEvent.click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Flush' }))
|
||||
await userEvent.click(within(await screen.findByRole('alertdialog')).getByRole('button', { name: 'Flush' }))
|
||||
await screen.findByText('Blocked zone was flushed successfully.')
|
||||
expect(list).toHaveBeenLastCalledWith('blocked', 'T', '', undefined, 'dev.cluster.test')
|
||||
|
||||
@@ -444,7 +444,7 @@ describe('Rules', () => {
|
||||
const remove = vi.spyOn(zonelists, 'deleteDomain').mockResolvedValue(OK)
|
||||
draw(NO_MODIFY)
|
||||
await userEvent.click(await screen.findByRole('button', { name: 'Delete s.youtube.com' }))
|
||||
const dialog = await screen.findByRole('dialog')
|
||||
const dialog = await screen.findByRole('alertdialog')
|
||||
expect(within(dialog).getByRole('heading', { name: 'Delete Allowed Zone' })).toBeInTheDocument()
|
||||
expect(dialog).toHaveTextContent("Are you sure you want to delete the allowed zone 's.youtube.com'?")
|
||||
await userEvent.click(within(dialog).getByRole('button', { name: 'Delete' }))
|
||||
|
||||
@@ -175,7 +175,7 @@ describe('Rules: Delete with Undo', () => {
|
||||
expect(screen.queryByRole('dialog')).toBeNull()
|
||||
expect(remove).toHaveBeenCalledWith('blocked', 'T', 'ads.test')
|
||||
await deleteRule('ok.test')
|
||||
const dialog = await screen.findByRole('dialog')
|
||||
const dialog = await screen.findByRole('alertdialog')
|
||||
expect(dialog).toHaveTextContent("Are you sure you want to delete the allowed zone 'ok.test'?")
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user