mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 00:34:09 +00:00
## Summary Remove the extra running-workflow indicator from the expanded Queue Progress Overlay header to avoid duplicate running-count signals. ## Changes - Remove `showConcurrentIndicator` and `concurrentWorkflowCount` props from `QueueOverlayHeader`. - Stop passing those props through `QueueOverlayExpanded` and `QueueProgressOverlay`. - Simplify `QueueOverlayHeader` tests to reflect the updated header behavior. ## Why The expanded header was showing redundant running status information alongside existing running/queued summaries. Prevent this: <img width="240" height="92" alt="image" src="https://github.com/user-attachments/assets/f4b1775c-b347-46f7-8668-3a1054365ada" /> Design: https://www.figma.com/design/LVilZgHGk5RwWOkVN6yCEK/Queue-Progress-Modal?node-id=4024-28147&m=dev ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9032-fix-remove-duplicate-running-indicator-from-queue-header-30d6d73d365081d19041de2f1b0c8886) by [Unito](https://www.unito.io) --------- Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com>
140 lines
3.7 KiB
TypeScript
140 lines
3.7 KiB
TypeScript
import { mount } from '@vue/test-utils'
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import { createI18n } from 'vue-i18n'
|
|
import { defineComponent, h } from 'vue'
|
|
|
|
const popoverCloseSpy = vi.fn()
|
|
|
|
vi.mock('@/components/ui/Popover.vue', () => {
|
|
const PopoverStub = defineComponent({
|
|
name: 'Popover',
|
|
setup(_, { slots }) {
|
|
return () =>
|
|
h('div', [
|
|
slots.button?.(),
|
|
slots.default?.({
|
|
close: () => {
|
|
popoverCloseSpy()
|
|
}
|
|
})
|
|
])
|
|
}
|
|
})
|
|
return { default: PopoverStub }
|
|
})
|
|
|
|
const mockGetSetting = vi.fn((key: string) =>
|
|
key === 'Comfy.Queue.QPOV2' ? true : undefined
|
|
)
|
|
const mockSetSetting = vi.fn()
|
|
|
|
vi.mock('@/platform/settings/settingStore', () => ({
|
|
useSettingStore: () => ({
|
|
get: mockGetSetting,
|
|
set: mockSetSetting
|
|
})
|
|
}))
|
|
|
|
import QueueOverlayHeader from './QueueOverlayHeader.vue'
|
|
import * as tooltipConfig from '@/composables/useTooltipConfig'
|
|
|
|
const tooltipDirectiveStub = {
|
|
mounted: vi.fn(),
|
|
updated: vi.fn()
|
|
}
|
|
|
|
const i18n = createI18n({
|
|
legacy: false,
|
|
locale: 'en',
|
|
messages: {
|
|
en: {
|
|
g: { more: 'More' },
|
|
sideToolbar: {
|
|
queueProgressOverlay: {
|
|
queuedSuffix: 'queued',
|
|
clearQueued: 'Clear queued',
|
|
clearQueueTooltip: 'Clear queue',
|
|
clearAllJobsTooltip: 'Cancel all running jobs',
|
|
moreOptions: 'More options',
|
|
clearHistory: 'Clear history',
|
|
dockedJobHistory: 'Docked Job History'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
const mountHeader = (props = {}) =>
|
|
mount(QueueOverlayHeader, {
|
|
props: {
|
|
headerTitle: 'Job queue',
|
|
queuedCount: 3,
|
|
...props
|
|
},
|
|
global: {
|
|
plugins: [i18n],
|
|
directives: { tooltip: tooltipDirectiveStub }
|
|
}
|
|
})
|
|
|
|
describe('QueueOverlayHeader', () => {
|
|
beforeEach(() => {
|
|
popoverCloseSpy.mockClear()
|
|
mockSetSetting.mockClear()
|
|
})
|
|
|
|
it('renders header title', () => {
|
|
const wrapper = mountHeader()
|
|
expect(wrapper.text()).toContain('Job queue')
|
|
})
|
|
|
|
it('shows clear queue text and emits clear queued', async () => {
|
|
const wrapper = mountHeader({ queuedCount: 4 })
|
|
|
|
expect(wrapper.text()).toContain('Clear queue')
|
|
expect(wrapper.text()).not.toContain('4 queued')
|
|
|
|
const clearQueuedButton = wrapper.get('button[aria-label="Clear queued"]')
|
|
await clearQueuedButton.trigger('click')
|
|
expect(wrapper.emitted('clearQueued')).toHaveLength(1)
|
|
})
|
|
|
|
it('disables clear queued button when queued count is zero', () => {
|
|
const wrapper = mountHeader({ queuedCount: 0 })
|
|
const clearQueuedButton = wrapper.get('button[aria-label="Clear queued"]')
|
|
|
|
expect(clearQueuedButton.attributes('disabled')).toBeDefined()
|
|
expect(wrapper.text()).toContain('Clear queue')
|
|
})
|
|
|
|
it('emits clear history from the menu', async () => {
|
|
const spy = vi.spyOn(tooltipConfig, 'buildTooltipConfig')
|
|
|
|
const wrapper = mountHeader()
|
|
|
|
expect(wrapper.find('button[aria-label="More options"]').exists()).toBe(
|
|
true
|
|
)
|
|
expect(spy).toHaveBeenCalledWith('More')
|
|
|
|
const clearHistoryButton = wrapper.get(
|
|
'[data-testid="clear-history-action"]'
|
|
)
|
|
await clearHistoryButton.trigger('click')
|
|
expect(popoverCloseSpy).toHaveBeenCalledTimes(1)
|
|
expect(wrapper.emitted('clearHistory')).toHaveLength(1)
|
|
})
|
|
|
|
it('toggles docked job history setting from the menu', async () => {
|
|
const wrapper = mountHeader()
|
|
|
|
const dockedJobHistoryButton = wrapper.get(
|
|
'[data-testid="docked-job-history-action"]'
|
|
)
|
|
await dockedJobHistoryButton.trigger('click')
|
|
|
|
expect(mockSetSetting).toHaveBeenCalledTimes(1)
|
|
expect(mockSetSetting).toHaveBeenCalledWith('Comfy.Queue.QPOV2', false)
|
|
})
|
|
})
|