Ticketstatus: statusTone fuer die neuen Badge-Toene
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3179b9cb41
commit
bb110a734e
2 files changed
+27
No files matched your search
@@ -49,6 +49,19 @@ export function statusGroup(status) {
|
|||||||
return STATUS_GROUPS.find((group) => group.values.includes(status))?.id || null
|
return STATUS_GROUPS.find((group) => group.values.includes(status))?.id || null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GROUP_TONE = {
|
||||||
|
open: '',
|
||||||
|
working: 'blue',
|
||||||
|
waiting: 'orange',
|
||||||
|
review: 'violet',
|
||||||
|
done: 'green',
|
||||||
|
cancelled: 'plain',
|
||||||
|
}
|
||||||
|
|
||||||
|
export function statusTone(status) {
|
||||||
|
return GROUP_TONE[statusGroup(status)] || ''
|
||||||
|
}
|
||||||
|
|
||||||
export function statusValuesFor(groupIds) {
|
export function statusValuesFor(groupIds) {
|
||||||
return STATUS_GROUPS.filter((group) => groupIds.includes(group.id)).flatMap((group) => group.values)
|
return STATUS_GROUPS.filter((group) => groupIds.includes(group.id)).flatMap((group) => group.values)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import test from 'node:test'
|
||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import { loadModule } from './load.mjs'
|
||||||
|
|
||||||
|
const { statusTone } = await loadModule('src/lib/ticketStatus.js')
|
||||||
|
|
||||||
|
test('statusTone: Ton je gespeichertem Wert', () => {
|
||||||
|
for (const s of ['Open', '', undefined, null, 'Completed']) assert.equal(statusTone(s), '')
|
||||||
|
for (const s of ['Occupied', 'Assigned', 'Added Info', 'In Kontakt']) assert.equal(statusTone(s), 'blue')
|
||||||
|
for (const s of ['Awaiting', 'Halted']) assert.equal(statusTone(s), 'orange')
|
||||||
|
assert.equal(statusTone('In Test'), 'violet')
|
||||||
|
for (const s of ['Closed', 'Zugesagt']) assert.equal(statusTone(s), 'green')
|
||||||
|
for (const s of ['Cancelled', 'Aborted', 'Abgesagt']) assert.equal(statusTone(s), 'plain')
|
||||||
|
})
|
||||||
Reference in new issue
Block a user