mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 01:09:46 +00:00
Fix searchbox dismissed when closing filter panel (#2196)
This commit is contained in:
@@ -3,6 +3,13 @@ import { Locator, Page } from '@playwright/test'
|
|||||||
export class ComfyNodeSearchFilterSelectionPanel {
|
export class ComfyNodeSearchFilterSelectionPanel {
|
||||||
constructor(public readonly page: Page) {}
|
constructor(public readonly page: Page) {}
|
||||||
|
|
||||||
|
get header() {
|
||||||
|
return this.page
|
||||||
|
.getByRole('dialog')
|
||||||
|
.locator('div')
|
||||||
|
.filter({ hasText: 'Add node filter condition' })
|
||||||
|
}
|
||||||
|
|
||||||
async selectFilterType(filterType: string) {
|
async selectFilterType(filterType: string) {
|
||||||
await this.page
|
await this.page
|
||||||
.locator(
|
.locator(
|
||||||
|
|||||||
@@ -132,6 +132,22 @@ test.describe('Node search box', () => {
|
|||||||
await expectFilterChips(comfyPage, ['MODEL'])
|
await expectFilterChips(comfyPage, ['MODEL'])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Outer click dismisses filter panel but keeps search box visible', async ({
|
||||||
|
comfyPage
|
||||||
|
}) => {
|
||||||
|
await comfyPage.searchBox.filterButton.click()
|
||||||
|
const panel = comfyPage.searchBox.filterSelectionPanel
|
||||||
|
await panel.header.waitFor({ state: 'visible' })
|
||||||
|
const panelBounds = await panel.header.boundingBox()
|
||||||
|
await comfyPage.page.mouse.click(panelBounds!.x - 10, panelBounds!.y - 10)
|
||||||
|
|
||||||
|
// Verify the filter selection panel is hidden
|
||||||
|
expect(panel.header).not.toBeVisible()
|
||||||
|
|
||||||
|
// Verify the node search dialog is still visible
|
||||||
|
expect(comfyPage.searchBox.input).toBeVisible()
|
||||||
|
})
|
||||||
|
|
||||||
test('Can add multiple filters', async ({ comfyPage }) => {
|
test('Can add multiple filters', async ({ comfyPage }) => {
|
||||||
await comfyPage.searchBox.addFilter('MODEL', 'Input Type')
|
await comfyPage.searchBox.addFilter('MODEL', 'Input Type')
|
||||||
await comfyPage.searchBox.addFilter('CLIP', 'Output Type')
|
await comfyPage.searchBox.addFilter('CLIP', 'Output Type')
|
||||||
|
|||||||
@@ -19,7 +19,13 @@
|
|||||||
class="filter-button z-10"
|
class="filter-button z-10"
|
||||||
@click="nodeSearchFilterVisible = true"
|
@click="nodeSearchFilterVisible = true"
|
||||||
/>
|
/>
|
||||||
<Dialog v-model:visible="nodeSearchFilterVisible" class="min-w-96">
|
<Dialog
|
||||||
|
v-model:visible="nodeSearchFilterVisible"
|
||||||
|
class="min-w-96"
|
||||||
|
dismissable-mask
|
||||||
|
modal
|
||||||
|
@hide="reFocusInput"
|
||||||
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<h3>Add node filter condition</h3>
|
<h3>Add node filter condition</h3>
|
||||||
</template>
|
</template>
|
||||||
@@ -140,7 +146,6 @@ onMounted(reFocusInput)
|
|||||||
const onAddFilter = (filterAndValue: FilterAndValue) => {
|
const onAddFilter = (filterAndValue: FilterAndValue) => {
|
||||||
nodeSearchFilterVisible.value = false
|
nodeSearchFilterVisible.value = false
|
||||||
emit('addFilter', filterAndValue)
|
emit('addFilter', filterAndValue)
|
||||||
reFocusInput()
|
|
||||||
}
|
}
|
||||||
const onRemoveFilter = (event: Event, filterAndValue: FilterAndValue) => {
|
const onRemoveFilter = (event: Event, filterAndValue: FilterAndValue) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|||||||
Reference in New Issue
Block a user