diff --git a/apps/frontend/src/components/PlatformBadge.vue b/apps/frontend/src/components/PlatformBadge.vue index 44d146e..c0a3f98 100644 --- a/apps/frontend/src/components/PlatformBadge.vue +++ b/apps/frontend/src/components/PlatformBadge.vue @@ -1,8 +1,11 @@ diff --git a/apps/frontend/src/components/PlatformIcon.vue b/apps/frontend/src/components/PlatformIcon.vue new file mode 100644 index 0000000..23a1aed --- /dev/null +++ b/apps/frontend/src/components/PlatformIcon.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/frontend/src/components/__tests__/PlatformBadge.test.ts b/apps/frontend/src/components/__tests__/PlatformBadge.test.ts new file mode 100644 index 0000000..0c0d165 --- /dev/null +++ b/apps/frontend/src/components/__tests__/PlatformBadge.test.ts @@ -0,0 +1,27 @@ +import { describe, it, expect } from 'vitest' +import { mount } from '@vue/test-utils' +import PlatformBadge from '../PlatformBadge.vue' +import { statusBadgeClass } from '../../lib/softwareUtils' + +describe('PlatformBadge', () => { + it('shows the platform name next to its own glyph', () => { + const wrapper = mount(PlatformBadge, { props: { platform: 'TIC-80' } }) + expect(wrapper.text()).toContain('TIC-80') + expect(wrapper.find('svg').exists()).toBe(true) + }) + + it('falls back to a glyph for a platform it has never seen', () => { + const wrapper = mount(PlatformBadge, { props: { platform: 'Amiga' } }) + expect(wrapper.find('svg').exists()).toBe(true) + }) +}) + +describe('statusBadgeClass', () => { + it('gives every live status its own hue and leaves the archived ones neutral', () => { + expect(statusBadgeClass('released')).toContain('status-released') + expect(statusBadgeClass('demo')).toContain('status-demo') + expect(statusBadgeClass('development')).toContain('status-development') + expect(statusBadgeClass('archived')).toBe('status-badge') + expect(statusBadgeClass('whatever')).toBe('status-badge') + }) +}) diff --git a/apps/frontend/src/lib/softwareUtils.ts b/apps/frontend/src/lib/softwareUtils.ts index 2a21269..2dcc65e 100644 --- a/apps/frontend/src/lib/softwareUtils.ts +++ b/apps/frontend/src/lib/softwareUtils.ts @@ -32,8 +32,8 @@ export function getLatestStable(releases: Release[]): Release | undefined { const STATUS_BADGE_CLASS: Record = { released: 'status-badge status-released', - demo: 'status-badge', - development: 'status-badge', + demo: 'status-badge status-demo', + development: 'status-badge status-development', archived: 'status-badge', } diff --git a/apps/frontend/src/page/builds/BuildsIndexPage.vue b/apps/frontend/src/page/builds/BuildsIndexPage.vue index c651e78..1f52dd1 100644 --- a/apps/frontend/src/page/builds/BuildsIndexPage.vue +++ b/apps/frontend/src/page/builds/BuildsIndexPage.vue @@ -40,7 +40,9 @@ - {{ info.label }} + + {{ info.label }} +