diff --git a/src/components/TopMenuSection.test.ts b/src/components/TopMenuSection.test.ts index ade4a8ae69..d1387e779a 100644 --- a/src/components/TopMenuSection.test.ts +++ b/src/components/TopMenuSection.test.ts @@ -2,7 +2,7 @@ import { createTestingPinia } from '@pinia/testing' import { mount } from '@vue/test-utils' import type { MenuItem } from 'primevue/menuitem' import { beforeEach, describe, expect, it, vi } from 'vitest' -import { computed, defineComponent, h, nextTick, onMounted } from 'vue' +import { computed, defineComponent, h, nextTick, onMounted, ref } from 'vue' import type { Component } from 'vue' import { createI18n } from 'vue-i18n' @@ -19,7 +19,11 @@ import { useExecutionStore } from '@/stores/executionStore' import { TaskItemImpl, useQueueStore } from '@/stores/queueStore' import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore' -const mockData = vi.hoisted(() => ({ isLoggedIn: false, isDesktop: false })) +const mockData = vi.hoisted(() => ({ + isLoggedIn: false, + isDesktop: false, + setShowConflictRedDot: (_value: boolean) => {} +})) vi.mock('@/composables/auth/useCurrentUser', () => ({ useCurrentUser: () => { @@ -36,6 +40,36 @@ vi.mock('@/platform/distribution/types', () => ({ return mockData.isDesktop } })) + +vi.mock('@/platform/updates/common/releaseStore', () => ({ + useReleaseStore: () => ({ + shouldShowRedDot: computed(() => true) + }) +})) + +vi.mock( + '@/workbench/extensions/manager/composables/useConflictAcknowledgment', + () => { + const shouldShowConflictRedDot = ref(false) + mockData.setShowConflictRedDot = (value: boolean) => { + shouldShowConflictRedDot.value = value + } + + return { + useConflictAcknowledgment: () => ({ + shouldShowRedDot: shouldShowConflictRedDot + }) + } + } +) + +vi.mock('@/workbench/extensions/manager/composables/useManagerState', () => ({ + useManagerState: () => ({ + shouldShowManagerButtons: computed(() => true), + openManager: vi.fn() + }) +})) + vi.mock('@/stores/firebaseAuthStore', () => ({ useFirebaseAuthStore: vi.fn(() => ({ currentUser: null, @@ -114,6 +148,7 @@ describe('TopMenuSection', () => { localStorage.clear() mockData.isDesktop = false mockData.isLoggedIn = false + mockData.setShowConflictRedDot(false) }) describe('authentication state', () => { @@ -330,4 +365,16 @@ describe('TopMenuSection', () => { const model = menu.props('model') as MenuItem[] expect(model[0]?.disabled).toBe(false) }) + + it('shows manager red dot only for manager conflicts', async () => { + const wrapper = createWrapper() + + // Release red dot is mocked as true globally for this test file. + expect(wrapper.find('span.bg-red-500').exists()).toBe(false) + + mockData.setShowConflictRedDot(true) + await nextTick() + + expect(wrapper.find('span.bg-red-500').exists()).toBe(true) + }) }) diff --git a/src/components/TopMenuSection.vue b/src/components/TopMenuSection.vue index 85a01d1a1a..5c3ce1f6e1 100644 --- a/src/components/TopMenuSection.vue +++ b/src/components/TopMenuSection.vue @@ -145,7 +145,6 @@ import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useErrorHandling } from '@/composables/useErrorHandling' import { buildTooltipConfig } from '@/composables/useTooltipConfig' import { useSettingStore } from '@/platform/settings/settingStore' -import { useReleaseStore } from '@/platform/updates/common/releaseStore' import { app } from '@/scripts/app' import { useCommandStore } from '@/stores/commandStore' import { useExecutionStore } from '@/stores/executionStore' @@ -173,8 +172,6 @@ const sidebarTabStore = useSidebarTabStore() const { activeJobsCount } = storeToRefs(queueStore) const { isOverlayExpanded: isQueueOverlayExpanded } = storeToRefs(queueUIStore) const { activeSidebarTabId } = storeToRefs(sidebarTabStore) -const releaseStore = useReleaseStore() -const { shouldShowRedDot: showReleaseRedDot } = storeToRefs(releaseStore) const { shouldShowRedDot: shouldShowConflictRedDot } = useConflictAcknowledgment() const isTopMenuHovered = ref(false) @@ -236,10 +233,8 @@ const queueContextMenuItems = computed(() => [ } ]) -// Use either release red dot or conflict red dot const shouldShowRedDot = computed((): boolean => { - const releaseRedDot = showReleaseRedDot.value - return releaseRedDot || shouldShowConflictRedDot.value + return shouldShowConflictRedDot.value }) // Right side panel toggle