Fix color again, for legacy badges (#2782)
Ref: https://github.com/badges/shields/pull/2780#issuecomment-454873296
This commit is contained in:
@@ -64,7 +64,7 @@ describe('The badge generator', function() {
|
||||
given('almostred'),
|
||||
given('brightmaroon'),
|
||||
given('cactus')
|
||||
).expect(undefined)
|
||||
).expect(null)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
{{?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',
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user