Skip to content

Commit

Permalink
Remove popout styles (#3747)
Browse files Browse the repository at this point in the history
* Remove popout styles

* Make popout-square fall back to flat-square
  • Loading branch information
PyvesB authored Jul 22, 2019
1 parent ec6512b commit ecb85ce
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 70 deletions.
11 changes: 3 additions & 8 deletions gh-badges/lib/make-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,10 @@ module.exports = function makeBadge({
}

if (!(template in templates)) {
template = 'flat'
}
if (template.startsWith('popout')) {
if (logo) {
logoPosition =
logoPosition <= 10 && logoPosition >= -10 ? logoPosition : 0
logoWidth = +logoWidth || 32
if (template && template.endsWith('-square')) {
template = 'flat-square'
} else {
template = template.replace('popout', 'flat')
template = 'flat'
}
}
if (template === 'social') {
Expand Down
16 changes: 16 additions & 0 deletions gh-badges/lib/make-badge.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ describe('The badge generator', function() {
.to.equal(jsonBadgeWithDefaultStyle)
.and.to.satisfy(isSvg)
})

it('should replace "popout-square" svg template with "flat-square"', function() {
const jsonBadgeWithUnknownStyle = makeBadge({
text: ['name', 'Bob'],
format: 'svg',
template: 'popout-square',
})
const jsonBadgeWithDefaultStyle = makeBadge({
text: ['name', 'Bob'],
format: 'svg',
template: 'flat-square',
})
expect(jsonBadgeWithUnknownStyle)
.to.equal(jsonBadgeWithDefaultStyle)
.and.to.satisfy(isSvg)
})
})

describe('"for-the-badge" template badge generation', function() {
Expand Down
23 changes: 0 additions & 23 deletions gh-badges/templates/popout-square-template.svg

This file was deleted.

37 changes: 0 additions & 37 deletions gh-badges/templates/popout-template.svg

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/export-supported-features-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const supportedFeatures = {
'flat',
'flat-square',
'for-the-badge',
'popout',
'popout-square',
'social',
],
}
Expand Down

0 comments on commit ecb85ce

Please sign in to comment.