Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected]: Add new prop f-restaurant card for review threshold #2511

Merged
merged 9 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/components/molecules/f-restaurant-card/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

v1.6.1
## v1.6.2

_April 10, 2024_

### Changed
- Create prop for max rating value
jamieomaguire marked this conversation as resolved.
Show resolved Hide resolved

## v1.6.1

_March 25, 2024_

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@justeat/f-restaurant-card",
"description": "Fozzie Restaurant Card - Responsible for displaying restaurant data and linking to a restaurant",
"version": "1.6.1",
"version": "1.6.2",
"main": "dist/f-restaurant-card.umd.min.js",
"files": [
"dist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ export default {
type: Number,
default: 0
},
/**
* Max amount of ratings to be shown
*/
countThreshold: {
jamieomaguire marked this conversation as resolved.
Show resolved Hide resolved
type: Number,
default: 200
},
/**
* The max value of the rating
*/
Expand Down Expand Up @@ -161,7 +168,7 @@ export default {
return Number.parseFloat(this.mean).toFixed(1);
},
formattedCount () {
return this.count > 200 ? '200+' : this.count;
return this.count > this.countThreshold ? `${this.countThreshold}+` : this.count;
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('RestaurantRating component', () => {
// arrange
const propsData = {
mean: 5,
count: 250,
count: 200,
isOwnRating
};

Expand All @@ -189,7 +189,7 @@ describe('RestaurantRating component', () => {
expect(countMessage.exists()).toBe(true);

expect(ratingsMeanElement.text()).toStrictEqual('5.0');
expect(countMessage.text()).toStrictEqual('200+');
expect(countMessage.text()).toStrictEqual('200');
jamieomaguire marked this conversation as resolved.
Show resolved Hide resolved
});

it('shows an empty star and a no ratings message if `mean` is missing', () => {
Expand Down
Loading