diff --git a/badge-maker/lib/index.js b/badge-maker/lib/index.js index 22697d929f811..f4eed2c5806cd 100644 --- a/badge-maker/lib/index.js +++ b/badge-maker/lib/index.js @@ -54,12 +54,6 @@ function _clean(format) { // Legacy. cleaned.label = cleaned.label || '' - // convert "public" format to "internal" format - if ('style' in cleaned) { - cleaned.template = cleaned.style - delete cleaned.style - } - return cleaned } diff --git a/badge-maker/lib/make-badge.js b/badge-maker/lib/make-badge.js index 893b3e663adee..03fab6312b109 100644 --- a/badge-maker/lib/make-badge.js +++ b/badge-maker/lib/make-badge.js @@ -13,7 +13,7 @@ it is likely this will impact on the package's public interface in index.js */ module.exports = function makeBadge({ format, - template = 'flat', + style = 'flat', label, message, color, @@ -43,9 +43,9 @@ module.exports = function makeBadge({ }) } - const render = badgeRenderers[template] + const render = badgeRenderers[style] if (!render) { - throw new Error(`Unknown template: '${template}'`) + throw new Error(`Unknown badge style: '${style}'`) } logoWidth = +logoWidth || (logo ? 14 : 0) diff --git a/badge-maker/lib/make-badge.spec.js b/badge-maker/lib/make-badge.spec.js index b55b259d293d8..04cd5e7930c5d 100644 --- a/badge-maker/lib/make-badge.spec.js +++ b/badge-maker/lib/make-badge.spec.js @@ -123,7 +123,7 @@ describe('The badge generator', function () { label: 'name', message: 'Bob', format: 'svg', - template: 'flat', + style: 'flat', }) expect(jsonBadgeWithUnknownStyle) .to.equal(jsonBadgeWithDefaultStyle) @@ -136,9 +136,9 @@ describe('The badge generator', function () { label: 'name', message: 'Bob', format: 'svg', - template: 'unknown_style', + style: 'unknown_style', }) - ).to.throw(Error, "Unknown template: 'unknown_style'") + ).to.throw(Error, "Unknown badge style: 'unknown_style'") }) }) @@ -148,7 +148,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#b3e', labelColor: '#0f0', }) @@ -159,7 +159,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -171,7 +171,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#b3e', }) }) @@ -181,7 +181,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#b3e', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', }) @@ -192,7 +192,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -204,7 +204,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#b3e', labelColor: '#0f0', links: ['https://shields.io/', 'https://www.google.co.uk/'], @@ -218,7 +218,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat-square', + style: 'flat-square', color: '#b3e', labelColor: '#0f0', }) @@ -229,7 +229,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat-square', + style: 'flat-square', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -241,7 +241,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'flat-square', + style: 'flat-square', color: '#b3e', }) }) @@ -251,7 +251,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'flat-square', + style: 'flat-square', color: '#b3e', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', }) @@ -262,7 +262,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'flat-square', + style: 'flat-square', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -274,7 +274,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat-square', + style: 'flat-square', color: '#b3e', labelColor: '#0f0', links: ['https://shields.io/', 'https://www.google.co.uk/'], @@ -288,7 +288,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'plastic', + style: 'plastic', color: '#b3e', labelColor: '#0f0', }) @@ -299,7 +299,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'plastic', + style: 'plastic', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -311,7 +311,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'plastic', + style: 'plastic', color: '#b3e', }) }) @@ -321,7 +321,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'plastic', + style: 'plastic', color: '#b3e', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', }) @@ -332,7 +332,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'plastic', + style: 'plastic', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -344,7 +344,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'plastic', + style: 'plastic', color: '#b3e', labelColor: '#0f0', links: ['https://shields.io/', 'https://www.google.co.uk/'], @@ -360,7 +360,7 @@ describe('The badge generator', function () { label: 1998, message: 1999, format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', }) ) .to.include('1998') @@ -373,7 +373,7 @@ describe('The badge generator', function () { label: 'Label', message: '1 string', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', }) ) .to.include('LABEL') @@ -385,7 +385,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#b3e', labelColor: '#0f0', }) @@ -396,7 +396,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -408,7 +408,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#b3e', }) }) @@ -418,7 +418,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#b3e', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', }) @@ -429,7 +429,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -441,7 +441,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#b3e', labelColor: '#0f0', links: ['https://shields.io/', 'https://www.google.co.uk/'], @@ -456,7 +456,7 @@ describe('The badge generator', function () { label: 'some-key', message: 'some-value', format: 'svg', - template: 'social', + style: 'social', }) ) .to.include('Some-key') @@ -470,7 +470,7 @@ describe('The badge generator', function () { label: '', message: 'some-value', format: 'json', - template: 'social', + style: 'social', }) ) .to.include('""') @@ -482,7 +482,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'social', + style: 'social', color: '#b3e', labelColor: '#0f0', }) @@ -493,7 +493,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'social', + style: 'social', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -505,7 +505,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'social', + style: 'social', color: '#b3e', }) }) @@ -515,7 +515,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'social', + style: 'social', color: '#b3e', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', }) @@ -526,7 +526,7 @@ describe('The badge generator', function () { label: '', message: 'grown', format: 'svg', - template: 'social', + style: 'social', color: '#b3e', labelColor: '#0f0', logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu', @@ -538,7 +538,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'social', + style: 'social', color: '#b3e', labelColor: '#0f0', links: ['https://shields.io/', 'https://www.google.co.uk/'], @@ -563,7 +563,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'flat', + style: 'flat', color: '#000', labelColor: '#f3f3f3', }) @@ -574,7 +574,7 @@ describe('The badge generator', function () { label: 'cactus', message: 'grown', format: 'svg', - template: 'for-the-badge', + style: 'for-the-badge', color: '#e2ffe1', labelColor: '#000', }) diff --git a/core/base-service/base.spec.js b/core/base-service/base.spec.js index eadbb46e0ba7e..0d3aada8e19cb 100644 --- a/core/base-service/base.spec.js +++ b/core/base-service/base.spec.js @@ -376,7 +376,7 @@ describe('BaseService', function () { label: 'cat', message: 'Hello namedParamA: bar with queryParamA: ?', color: 'lightgrey', - template: 'flat', + style: 'flat', namedLogo: undefined, logo: undefined, logoWidth: undefined, diff --git a/core/base-service/coalesce-badge.js b/core/base-service/coalesce-badge.js index 0baf2f0d7d68d..9a94cb2752e26 100644 --- a/core/base-service/coalesce-badge.js +++ b/core/base-service/coalesce-badge.js @@ -177,7 +177,7 @@ module.exports = function coalesceBadge( serviceLabelColor, defaultLabelColor ), - template: style, + style, namedLogo, logo: logoSvgBase64, logoWidth, diff --git a/core/base-service/coalesce-badge.spec.js b/core/base-service/coalesce-badge.spec.js index 691af3489651f..f3d03eb1a756b 100644 --- a/core/base-service/coalesce-badge.spec.js +++ b/core/base-service/coalesce-badge.spec.js @@ -280,22 +280,22 @@ describe('coalesceBadge', function () { describe('Style', function () { it('falls back to flat with invalid style', function () { expect(coalesceBadge({ style: 'pill' }, {}, {})).to.include({ - template: 'flat', + style: 'flat', }) expect(coalesceBadge({ style: 7 }, {}, {})).to.include({ - template: 'flat', + style: 'flat', }) expect(coalesceBadge({ style: undefined }, {}, {})).to.include({ - template: 'flat', + style: 'flat', }) }) it('replaces legacy popout styles', function () { expect(coalesceBadge({ style: 'popout' }, {}, {})).to.include({ - template: 'flat', + style: 'flat', }) expect(coalesceBadge({ style: 'popout-square' }, {}, {})).to.include({ - template: 'flat-square', + style: 'flat-square', }) }) }) diff --git a/core/base-service/examples.js b/core/base-service/examples.js index 053e621c7d34c..99200d6564eeb 100644 --- a/core/base-service/examples.js +++ b/core/base-service/examples.js @@ -124,7 +124,7 @@ function transformExample(inExample, index, ServiceClass) { documentation, } = validateExample(inExample, index, ServiceClass) - const { label, message, color, template: style, namedLogo } = coalesceBadge( + const { label, message, color, style, namedLogo } = coalesceBadge( {}, staticPreview, ServiceClass.defaultBadgeData,