refactor: update VS Marketplace Ratings badges for unrated extensions (#6986)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Caleb Cartwright
2021-09-04 12:33:01 -05:00
committed by GitHub
parent 0342a3d7c6
commit 1b871a97b4
2 changed files with 9 additions and 2 deletions

View File

@@ -40,6 +40,13 @@ export default class VisualStudioMarketplaceRating extends VisualStudioMarketpla
}
static render({ format, averageRating, ratingCount }) {
if (ratingCount < 1) {
return {
message: 'no ratings',
color: 'inactive',
}
}
const message =
format === 'r'
? `${averageRating.toFixed(1)}/5 (${ratingCount})`

View File

@@ -83,8 +83,8 @@ t.create('zero rating')
)
.expectBadge({
label: 'rating',
message: '0.0/5 (0)',
color: 'red',
message: 'no ratings',
color: 'lightgrey',
})
t.create('stars')