Skip to content

Commit 516808b

Browse files
fix(ui): allow custom badge values in docs generator (#2335)
1 parent b3da028 commit 516808b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default defineNuxtConfig({
104104
isr: {
105105
expiration: 60 * 60 /* one hour */,
106106
passQuery: true,
107-
allowQuery: ['color', 'labelColor', 'label', 'name', 'style'],
107+
allowQuery: ['color', 'labelColor', 'label', 'name', 'style', 'value'],
108108
},
109109
},
110110
'/api/registry/image-proxy': {

test/e2e/badge.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@ test.describe('badge API', () => {
172172
expect(body).toContain(customLabel)
173173
})
174174

175+
test('custom value parameter is applied to SVG', async ({ page, baseURL }) => {
176+
const customValue = 'custom-value-123'
177+
const url = toLocalUrl(
178+
baseURL,
179+
`/api/registry/badge/version/nuxt?value=${encodeURIComponent(customValue)}`,
180+
)
181+
const { body } = await fetchBadge(page, url)
182+
183+
expect(body).toContain(customValue)
184+
})
185+
175186
test('style=default keeps current badge renderer', async ({ page, baseURL }) => {
176187
const url = toLocalUrl(baseURL, '/api/registry/badge/version/nuxt?style=default')
177188
const { body } = await fetchBadge(page, url)

0 commit comments

Comments
 (0)