From 72f879e60544ccefac43f962eb85df813e61ffb1 Mon Sep 17 00:00:00 2001 From: Amio Date: Wed, 25 Jul 2018 15:53:33 +0800 Subject: [PATCH] chore: tweak icon position --- lib/index.js | 12 +++---- tap-snapshots/test-index.spec.js-TAP.test.js | 36 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/index.js b/lib/index.js index 8abadb3..b7124e4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,7 +8,7 @@ module.exports = function ({subject, status, color, style, emoji, icon}) { color = colorPresets[color] || color || colorPresets['blue'] const stTextWidth = calcWidth(status, emoji) - const sbRectWidth = calcWidth(subject, emoji) + 10 + (icon ? 15 : 0) + const sbRectWidth = calcWidth(subject, emoji) + 10 + (icon ? 17 : 0) const stRectWidth = stTextWidth + 10 const width = sbRectWidth + stRectWidth @@ -20,8 +20,8 @@ module.exports = function ({subject, status, color, style, emoji, icon}) { - ${subject} - ${subject} + ${subject} + ${subject} ${status} ${status} ${icon ? genIconMarkup(icon) : ''} @@ -42,8 +42,8 @@ module.exports = function ({subject, status, color, style, emoji, icon}) { - ${subject} - ${subject} + ${subject} + ${subject} ${status} ${status} ${icon ? genIconMarkup(icon) : ''} @@ -52,7 +52,7 @@ module.exports = function ({subject, status, color, style, emoji, icon}) { } function genIconMarkup (iconB64) { - return `` + return `` } function typeAssert (assertion, message) { diff --git a/tap-snapshots/test-index.spec.js-TAP.test.js b/tap-snapshots/test-index.spec.js-TAP.test.js index b621b4d..49fa636 100644 --- a/tap-snapshots/test-index.spec.js-TAP.test.js +++ b/tap-snapshots/test-index.spec.js-TAP.test.js @@ -87,40 +87,40 @@ exports[`test/index.spec.js TAP generate badge with { subject, status, color, st exports[`test/index.spec.js TAP generate badge with { subject, status, icon } > snapshot 1`] = ` - + - + - - - + + + - docker - docker - icon - icon - + docker + docker + icon + icon + ` exports[`test/index.spec.js TAP generate badge with { subject, status, icon, style } > snapshot 1`] = ` - + - - + + - docker - docker - icon - icon - + docker + docker + icon + icon + `