feat(quick-261022-imo): settings section panel scoped to the current category
- settingsSectionOf returns the current entry's category group (null for one-entry categories) - SettingsPanel mirrors the plugin side menu, collapse included - AppShell shows it on settings forms and settings-linked controllers without own navigation - docs/backend/settings.md describes moving between settings pages
This commit is contained in:
@@ -4,12 +4,13 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
|
||||
import AppShell from '../../src/components/shell/AppShell.vue'
|
||||
import { setNavigation } from '../../src/state/useNavigation'
|
||||
import { setSettings } from '../../src/state/useSettings'
|
||||
import { NARROW_QUERY, setCollapsed } from '../../src/state/useSidebar'
|
||||
import { showToast } from '../../src/state/useToasts'
|
||||
import { navigationFixture } from '../fixtures/typed'
|
||||
import { setBundle } from '../../src/app/i18n'
|
||||
import { fakeMedia, resetState, routerAt, signIn } from '../helpers'
|
||||
import { langFixture } from '../fixtures/typed'
|
||||
import { langFixture, settingsFixture } from '../fixtures/typed'
|
||||
|
||||
async function mountShell(path: string) {
|
||||
await signIn()
|
||||
@@ -134,3 +135,20 @@ describe('View site link (Phase 16.2 quick follow-up)', () => {
|
||||
expect((wrapper.element as HTMLElement).style.getPropertyValue('--shell-offset')).toBe('var(--spacing-rail)')
|
||||
})
|
||||
})
|
||||
|
||||
describe('settings section panel', () => {
|
||||
it('lists the current category on a settings form, current entry highlighted', async () => {
|
||||
setSettings(settingsFixture.list.data)
|
||||
const wrapper = await mountShell('/settings/mail')
|
||||
const panel = wrapper.find('aside[data-settings-panel]')
|
||||
expect(panel.exists()).toBe(true)
|
||||
expect(panel.find('span').text()).toBe('System')
|
||||
const links = panel.findAll('[data-settings-panel-item]')
|
||||
expect(links.map((link) => [link.text(), link.attributes('href')])).toEqual([
|
||||
['Mail', '/settings/mail'],
|
||||
['Search', '/settings/search'],
|
||||
])
|
||||
expect(links[0]!.attributes('aria-current')).toBe('page')
|
||||
expect(links[1]!.attributes('aria-current')).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user