diff --git a/__snapshots__/make-badge.spec.js b/__snapshots__/make-badge.spec.js index 1756aabdbdb85..df826a8ca14a3 100644 --- a/__snapshots__/make-badge.spec.js +++ b/__snapshots__/make-badge.spec.js @@ -402,6 +402,126 @@ exports['The badge generator "flat" template badge generation should match snaps ` +exports['The badge generator "flat" template badge generation should match snapshots: black text when the label color is light 1'] = ` + + cactus: grown + + + + + + + + + + + + + + cactus + + + + grown + + + + +` + +exports['The badge generator "flat" template badge generation should match snapshots: black text when the message color is light 1'] = ` + + cactus: grown + + + + + + + + + + + + + + cactus + + + + grown + + + + +` + exports['The badge generator "flat-square" template badge generation should match snapshots: message/label, no logo 1'] = ` + cactus: grown + + + + + + + cactus + + + grown + + + + +` + +exports['The badge generator "flat-square" template badge generation should match snapshots: black text when the message color is light 1'] = ` + + cactus: grown + + + + + + + cactus + + + grown + + + + +` + exports['The badge generator "plastic" template badge generation should match snapshots: message/label, no logo 1'] = ` + cactus: grown + + + + + + + + + + + + + + + + cactus + + + + grown + + + + +` + +exports['The badge generator "plastic" template badge generation should match snapshots: black text when the message color is light 1'] = ` + + cactus: grown + + + + + + + + + + + + + + + + cactus + + + + grown + + + + +` + exports['The badge generator "for-the-badge" template badge generation should match snapshots: message/label, no logo 1'] = ` + CACTUS: GROWN + + + + + + + CACTUS + + + GROWN + + + + +` + +exports['The badge generator "for-the-badge" template badge generation should match snapshots: black text when the message color is light 1'] = ` + + CACTUS: GROWN + + + + + + + CACTUS + + + GROWN + + + + +` + exports['The badge generator "social" template badge generation should match snapshots: message/label, no logo 1'] = ` ` - -exports['The badge generator text colors should use black text when the label color is light 1'] = ` - - cactus: grown - - - - - - - - - - - - - - cactus - - - - grown - - - - -` - -exports['The badge generator text colors should use black text when the message color is light 1'] = ` - - CACTUS: GROWN - - - - - - - CACTUS - - - GROWN - - - - -` diff --git a/badge-maker/lib/badge-renderers.js b/badge-maker/lib/badge-renderers.js index 9d841f228d9fd..56e3792b8b6fb 100644 --- a/badge-maker/lib/badge-renderers.js +++ b/badge-maker/lib/badge-renderers.js @@ -266,7 +266,7 @@ class Badge { leftMargin: this.messageMargin, content: this.message, link: rightLink, - color: this.messageColor, + color: this.color, textWidth: this.messageWidth, linkWidth: this.rightWidth, }) diff --git a/badge-maker/lib/make-badge.spec.js b/badge-maker/lib/make-badge.spec.js index 04cd5e7930c5d..3dc574723b92d 100644 --- a/badge-maker/lib/make-badge.spec.js +++ b/badge-maker/lib/make-badge.spec.js @@ -210,6 +210,28 @@ describe('The badge generator', function () { links: ['https://shields.io/', 'https://www.google.co.uk/'], }) }) + + it('should match snapshots: black text when the label color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'flat', + color: '#000', + labelColor: '#f3f3f3', + }) + }) + + it('should match snapshots: black text when the message color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'flat', + color: '#e2ffe1', + labelColor: '#000', + }) + }) }) describe('"flat-square" template badge generation', function () { @@ -280,6 +302,28 @@ describe('The badge generator', function () { links: ['https://shields.io/', 'https://www.google.co.uk/'], }) }) + + it('should match snapshots: black text when the label color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'flat-square', + color: '#000', + labelColor: '#f3f3f3', + }) + }) + + it('should match snapshots: black text when the message color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'flat-square', + color: '#e2ffe1', + labelColor: '#000', + }) + }) }) describe('"plastic" template badge generation', function () { @@ -350,6 +394,28 @@ describe('The badge generator', function () { links: ['https://shields.io/', 'https://www.google.co.uk/'], }) }) + + it('should match snapshots: black text when the label color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'plastic', + color: '#000', + labelColor: '#f3f3f3', + }) + }) + + it('should match snapshots: black text when the message color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'plastic', + color: '#e2ffe1', + labelColor: '#000', + }) + }) }) describe('"for-the-badge" template badge generation', function () { @@ -447,6 +513,28 @@ describe('The badge generator', function () { links: ['https://shields.io/', 'https://www.google.co.uk/'], }) }) + + it('should match snapshots: black text when the label color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'for-the-badge', + color: '#000', + labelColor: '#f3f3f3', + }) + }) + + it('should match snapshots: black text when the message color is light', function () { + expectBadgeToMatchSnapshot({ + label: 'cactus', + message: 'grown', + format: 'svg', + style: 'for-the-badge', + color: '#e2ffe1', + labelColor: '#000', + }) + }) }) describe('"social" template badge generation', function () { @@ -556,28 +644,4 @@ describe('The badge generator', function () { }) }) }) - - describe('text colors', function () { - it('should use black text when the label color is light', function () { - expectBadgeToMatchSnapshot({ - label: 'cactus', - message: 'grown', - format: 'svg', - style: 'flat', - color: '#000', - labelColor: '#f3f3f3', - }) - }) - - it('should use black text when the message color is light', function () { - expectBadgeToMatchSnapshot({ - label: 'cactus', - message: 'grown', - format: 'svg', - style: 'for-the-badge', - color: '#e2ffe1', - labelColor: '#000', - }) - }) - }) })