Fähigkeitauswahl verbessert #41

Merged
Lars merged 6 commits from develop into main 2026-05-20 11:24:38 +02:00
3 changed files with 7 additions and 16 deletions
Showing only changes of commit ab612a5335 - Show all commits

View File

@ -78,7 +78,7 @@ function SkillTreeNodes({ nodes, depth, expanded, exclude, onToggle, onPickSkill
}
/**
* Ausklappbare Baumliste: Hauptgruppe Kategorie Fähigkeit (Hauptgruppe und Kategorie standard offen).
* Ausklappbare Baumliste: Hauptgruppe Kategorie Fähigkeit (nur Hauptgruppe standard offen).
*/
export default function SkillTreePickerPanel({
skills = [],

View File

@ -162,19 +162,10 @@ export function allExpandableKeys(tree) {
return keys
}
/** Standard: Hauptgruppe und Kategorie aufgeklappt (Fähigkeiten direkt darunter sichtbar). */
/** Standard: nur Hauptgruppe aufgeklappt; Kategorien und Fähigkeiten zugeklappt. */
export function defaultExpandedKeysForSkillTree(tree) {
const keys = []
const walk = (nodes) => {
for (const n of nodes) {
if (n.type === 'main' || n.type === 'category') {
keys.push(n.key)
walk(n.children || [])
}
}
}
walk(tree)
return keys
if (!Array.isArray(tree)) return []
return tree.filter((n) => n.type === 'main').map((n) => n.key)
}
/** Sentinel für Katalog-Admin: keine Hauptgruppe gewählt. */

View File

@ -49,11 +49,11 @@ describe('skillCatalogTree', () => {
expect(kataSkill.skillId).toBe(2)
})
it('defaultExpandedKeysForSkillTree opens main and category only', () => {
it('defaultExpandedKeysForSkillTree opens main groups only', () => {
const tree = buildSkillCatalogTree(sample)
const keys = defaultExpandedKeysForSkillTree(tree)
expect(keys).toContain('m-10')
expect(keys.some((k) => k.includes('c-21'))).toBe(true)
expect(keys).toEqual(['m-10'])
expect(keys.some((k) => k.includes('c-'))).toBe(false)
expect(keys.some((k) => k.startsWith('s-'))).toBe(false)
})