diff --git a/src/components/dialog/SearchBarDialog.vue b/src/components/dialog/SearchBarDialog.vue index 063ddd8f..becc6da3 100644 --- a/src/components/dialog/SearchBarDialog.vue +++ b/src/components/dialog/SearchBarDialog.vue @@ -167,7 +167,7 @@ const mediaSearchActions = computed(() => { }, { type: 'music', - icon: 'mdi-music-note-search', + icon: 'mdi-music-note-outline', title: t('mediaType.music'), description: t('music.subtitle'), }, diff --git a/src/components/dialog/__tests__/SearchBarDialog.spec.ts b/src/components/dialog/__tests__/SearchBarDialog.spec.ts index 6e26d867..4991a54d 100644 --- a/src/components/dialog/__tests__/SearchBarDialog.spec.ts +++ b/src/components/dialog/__tests__/SearchBarDialog.spec.ts @@ -3,8 +3,17 @@ import { DEFAULT_PERMISSIONS } from '@/utils/permission' import { screen, waitFor, within } from '@testing-library/vue' import userEvent from '@testing-library/user-event' import { renderWithProviders } from '@tests/support/render' +import { defineComponent } from 'vue' import { beforeEach, describe, expect, it } from 'vitest' +const IconStub = defineComponent({ + name: 'VIcon', + props: { + icon: String, + }, + template: '', +}) + async function renderSearchBar() { return renderWithProviders(SearchBarDialog, { props: { @@ -24,6 +33,11 @@ async function renderSearchBar() { superUser: false, }, }, + global: { + stubs: { + VIcon: IconStub, + }, + }, }) } @@ -92,6 +106,16 @@ describe('SearchBarDialog media source selection', () => { }) }) + it('renders the bundled music icon in the music search action', async () => { + const user = userEvent.setup() + await renderSearchBar() + const input = await screen.findByPlaceholderText('搜索电影、剧集以及更多...') + + await user.type(input, '晴天') + + expect(getSearchItem('音乐').querySelector('[data-icon="mdi-music-note-outline"]')).not.toBeNull() + }) + it('searches actors with the selected supported source', async () => { const user = userEvent.setup() const { router } = await renderSearchBar() diff --git a/src/pages/__tests__/appcenter.spec.ts b/src/pages/__tests__/appcenter.spec.ts index 2c5b5a14..33732e06 100644 --- a/src/pages/__tests__/appcenter.spec.ts +++ b/src/pages/__tests__/appcenter.spec.ts @@ -62,6 +62,13 @@ async function renderAppCenter(items: PluginSidebarNavItem[], permissions: Recor } describe('app center plugin navigation', () => { + it('keeps resource search and omits the standalone music search menu', async () => { + await renderAppCenter([]) + + expect(await screen.findByText('搜索结果')).toBeInTheDocument() + expect(screen.queryByText('音乐搜索')).not.toBeInTheDocument() + }) + it('uses the shared category, admin and feature permission semantics', async () => { await renderAppCenter( [ diff --git a/src/router/i18n-menu.ts b/src/router/i18n-menu.ts index 6e34b30f..45cc400d 100644 --- a/src/router/i18n-menu.ts +++ b/src/router/i18n-menu.ts @@ -31,17 +31,6 @@ export function getNavMenus(t: Composer['t']): NavMenu[] { permission: 'search', feature: PERMISSION_FEATURE.SEARCH_RESOURCE, }, - { - title: t('navItems.music'), - full_title: t('music.title'), - icon: 'mdi-music-note-search', - iconColor: 'primary', - to: '/music', - header: t('menu.start'), - admin: false, - permission: 'search', - feature: PERMISSION_FEATURE.SEARCH_RESOURCE, - }, { title: t('navItems.recommend'), icon: 'mdi-star-outline',