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:
@@ -40,6 +40,13 @@ export default class VisualStudioMarketplaceRating extends VisualStudioMarketpla
|
|||||||
}
|
}
|
||||||
|
|
||||||
static render({ format, averageRating, ratingCount }) {
|
static render({ format, averageRating, ratingCount }) {
|
||||||
|
if (ratingCount < 1) {
|
||||||
|
return {
|
||||||
|
message: 'no ratings',
|
||||||
|
color: 'inactive',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const message =
|
const message =
|
||||||
format === 'r'
|
format === 'r'
|
||||||
? `${averageRating.toFixed(1)}/5 (${ratingCount})`
|
? `${averageRating.toFixed(1)}/5 (${ratingCount})`
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ t.create('zero rating')
|
|||||||
)
|
)
|
||||||
.expectBadge({
|
.expectBadge({
|
||||||
label: 'rating',
|
label: 'rating',
|
||||||
message: '0.0/5 (0)',
|
message: 'no ratings',
|
||||||
color: 'red',
|
color: 'lightgrey',
|
||||||
})
|
})
|
||||||
|
|
||||||
t.create('stars')
|
t.create('stars')
|
||||||
|
|||||||
Reference in New Issue
Block a user