Skip to content
Snippets Groups Projects
Unverified Commit 474b126b authored by Paul Melnikow's avatar Paul Melnikow Committed by GitHub
Browse files

Fix color again, for legacy badges (#2782)

parent 4bf55a78
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ describe('The badge generator', function() {
given('almostred'),
given('brightmaroon'),
given('cactus')
).expect(undefined)
).expect(null)
})
})
......
{
{{?it.color}}
"color": {{=JSON.stringify(it.color)}},
{{?}}
"color": {{=JSON.stringify(it.color || null)}},
{{?it.labelColor}}
"labelColor": {{=JSON.stringify(it.labelColor)}}
"labelColor": {{=JSON.stringify(it.labelColor)}},
{{?}}
"name": {{=JSON.stringify(it.text[0])}},
"value": {{=JSON.stringify(it.text[1])}}
......
......@@ -107,8 +107,14 @@ function makeBadgeData(defaultLabel, overrides) {
logoWidth: +overrides.logoWidth,
links: toArray(overrides.link),
// Scoutcamp sometimes turns these into numbers.
colorA: `${overrides.colorA}`,
colorB: `${overrides.colorB}`,
colorA:
typeof overrides.colorA === 'number'
? `${overrides.colorA}`
: overrides.colorA,
colorB:
typeof overrides.colorB === 'number'
? `${overrides.colorB}`
: overrides.colorB,
}
}
......
......@@ -5,11 +5,14 @@ const Joi = require('joi')
const t = (module.exports = require('../create-service-tester')())
t.create('Commits since')
.get('/badges/shields/a0663d8da53fb712472c02665e6ff7547ba945b7.json')
.get(
'/badges/shields/a0663d8da53fb712472c02665e6ff7547ba945b7.json?style=_shields_test'
)
.expectJSONTypes(
Joi.object().keys({
name: Joi.string().regex(/^(commits since){1}[\s\S]+$/),
value: Joi.string().regex(/^\w+$/),
color: 'blue',
})
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment