-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Rating, InfoRating): new components (#1196)
Issue: [Link](https://jira.tid.es/browse/WEB-1981) ## 📄 Note Haptic feedback requires implementing it in radio button component and coordinating with native teams (it may require changes in the bridge). I consider this as a different task (implementing haptic feedback for all the controls), and it can be iterated in a different PR. ##⚠️ Warning This PR requires a major release in Mistica. There are no breaking changes caused by the components themselves, but because we need new icons from mistica-design repo, and design team has introduced some breaking changes in their latest release. We can't merge this PR until this one gets merged: #1197
- Loading branch information
1 parent
d663c73
commit 02c91f6
Showing
49 changed files
with
1,197 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.67 KB
...mage_snapshots__/rating-screenshot-test-tsx-info-rating-custom-icons-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.34 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.09 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-size-16-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.73 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-size-24-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.96 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-size-48-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.09 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-0-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.36 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-1-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.37 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-2-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.39 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-3-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.38 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-4-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.38 KB
...__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-4-5-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+867 Bytes
..._image_snapshots__/rating-screenshot-test-tsx-info-rating-value-4-51-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+867 Bytes
..._/__image_snapshots__/rating-screenshot-test-tsx-info-rating-value-5-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.37 KB
...ating-screenshot-test-tsx-info-rating-with-half-value-and-value-0-74-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.36 KB
...ating-screenshot-test-tsx-info-rating-with-half-value-and-value-0-75-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.36 KB
...ating-screenshot-test-tsx-info-rating-with-half-value-and-value-1-24-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.37 KB
...ating-screenshot-test-tsx-info-rating-with-half-value-and-value-4-25-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.37 KB
...rating-screenshot-test-tsx-info-rating-with-half-value-and-value-4-5-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.06 KB
...ests__/__image_snapshots__/rating-screenshot-test-tsx-rating-inverse-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.75 KB
...__/__image_snapshots__/rating-screenshot-test-tsx-rating-qualitative-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.79 KB
...__/__image_snapshots__/rating-screenshot-test-tsx-rating-qualitative-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.85 KB
...__/__image_snapshots__/rating-screenshot-test-tsx-rating-qualitative-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.65 KB
...__/__image_snapshots__/rating-screenshot-test-tsx-rating-qualitative-4-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.83 KB
...__/__image_snapshots__/rating-screenshot-test-tsx-rating-qualitative-5-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.69 KB
...__/__image_snapshots__/rating-screenshot-test-tsx-rating-qualitative-6-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.37 KB
...ge_snapshots__/rating-screenshot-test-tsx-rating-qualitative-inverse-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+5.45 KB
...ge_snapshots__/rating-screenshot-test-tsx-rating-qualitative-inverse-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.11 KB
...ts__/rating-screenshot-test-tsx-rating-qualitative-with-custom-icons-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.56 KB
...ts__/rating-screenshot-test-tsx-rating-qualitative-with-custom-icons-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.69 KB
...ts__/rating-screenshot-test-tsx-rating-qualitative-with-custom-icons-3-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.69 KB
...ts__/rating-screenshot-test-tsx-rating-qualitative-with-custom-icons-4-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.67 KB
...ts__/rating-screenshot-test-tsx-rating-qualitative-with-custom-icons-5-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.41 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-rating-quantitative-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+3.25 KB
..._/__image_snapshots__/rating-screenshot-test-tsx-rating-quantitative-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+2.73 KB
...s__/rating-screenshot-test-tsx-rating-quantitative-with-custom-icons-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+3.88 KB
...s__/rating-screenshot-test-tsx-rating-quantitative-with-custom-icons-2-snap.png
Oops, something went wrong.
Binary file added
BIN
+1.9 KB
...ests__/__image_snapshots__/rating-screenshot-test-tsx-rating-size-24-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+3.51 KB
...ests__/__image_snapshots__/rating-screenshot-test-tsx-rating-size-48-1-snap.png
Oops, something went wrong.
Binary file added
BIN
+819 Bytes
...tests__/__image_snapshots__/rating-screenshot-test-tsx-rating-size-8-1-snap.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
import {openStoryPage, screen} from '../test-utils'; | ||
|
||
test.each([0, 1, 2, 3, 4, 5, 4.5, 4.51])('InfoRating - value = %s', async (value) => { | ||
await openStoryPage({ | ||
id: 'components-rating--info-rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {value}, | ||
}); | ||
|
||
const rating = await screen.findByTestId('info-rating'); | ||
|
||
expect(await rating.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test.each([4.5, 0.74, 0.75, 1.24, 4.25])('InfoRating - with half value and value = %s', async (value) => { | ||
await openStoryPage({ | ||
id: 'components-rating--info-rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {value, withHalfValue: true}, | ||
}); | ||
|
||
const rating = await screen.findByTestId('info-rating'); | ||
|
||
expect(await rating.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test.each([16, 24, 48])('InfoRating - size = %s', async (size) => { | ||
await openStoryPage({ | ||
id: 'components-rating--info-rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {size}, | ||
}); | ||
|
||
const rating = await screen.findByTestId('info-rating'); | ||
|
||
expect(await rating.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test('InfoRating - inverse', async () => { | ||
await openStoryPage({ | ||
id: 'components-rating--info-rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {inverse: true, value: 3}, | ||
}); | ||
|
||
const rating = await screen.findByTestId('info-rating'); | ||
|
||
expect(await rating.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test('InfoRating - custom icons', async () => { | ||
await openStoryPage({ | ||
id: 'components-rating--info-rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {value: 3.5, customIcons: true, withHalfValue: true}, | ||
}); | ||
|
||
const rating = await screen.findByTestId('info-rating'); | ||
|
||
expect(await rating.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test('Rating - quantitative', async () => { | ||
const page = await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {type: 'quantitative'}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
|
||
const thirdIcon = await screen.findByRole('radio', {name: '3 de 5'}); | ||
await page.click(thirdIcon); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test('Rating - quantitative with custom icons', async () => { | ||
const page = await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {type: 'quantitative', customIcons: true}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
|
||
const thirdIcon = await screen.findByRole('radio', {name: '3 de 5'}); | ||
await page.click(thirdIcon); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test('Rating - qualitative', async () => { | ||
const page = await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {type: 'qualitative'}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
|
||
const labels = ['muy malo', 'malo', 'regular', 'bueno', 'muy bueno']; | ||
|
||
for (const label of labels) { | ||
const currentIcon = await screen.findByRole('radio', {name: label}); | ||
await page.click(currentIcon); | ||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
} | ||
}); | ||
|
||
test('Rating - qualitative with custom icons', async () => { | ||
const page = await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {type: 'qualitative', customIcons: true}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
|
||
const labels = ['no battery', 'low battery', 'mid battery', 'full battery']; | ||
|
||
for (const label of labels) { | ||
const currentIcon = await screen.findByRole('radio', {name: label}); | ||
await page.click(currentIcon); | ||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
} | ||
}); | ||
|
||
test('Rating - qualitative inverse', async () => { | ||
const page = await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {type: 'qualitative', inverse: true}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
|
||
const thirdIcon = await screen.findByRole('radio', {name: 'regular'}); | ||
await page.click(thirdIcon); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test.each([8, 24, 48])('Rating - size = %s', async (size) => { | ||
await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {size}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
}); | ||
|
||
test('Rating - inverse', async () => { | ||
const page = await openStoryPage({ | ||
id: 'components-rating--rating-story', | ||
device: 'MOBILE_IOS', | ||
args: {inverse: true}, | ||
}); | ||
|
||
const ratingWrapper = await screen.findByTestId('rating-wrapper'); | ||
|
||
const thirdIcon = await screen.findByRole('radio', {name: '3 de 5'}); | ||
await page.click(thirdIcon); | ||
|
||
expect(await ratingWrapper.screenshot()).toMatchImageSnapshot(); | ||
}); |
Oops, something went wrong.
02c91f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for mistica-web ready!
✅ Preview
https://mistica-qnngrjiz0-flows-projects-65bb050e.vercel.app
Built with commit 02c91f6.
This pull request is being automatically deployed with vercel-action