This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Jia/update-block-wrapper
- Loading branch information
Showing
20 changed files
with
377 additions
and
285 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
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
41 changes: 41 additions & 0 deletions
41
libs/blocks/src/lib/social-proof/horizontal/horizontal.spec.tsx
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,41 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import SocialProofHorizontal from '.'; | ||
import { OptimizedImage } from '@deriv-com/components'; | ||
|
||
describe('SocialProofHorizontal', () => { | ||
it('render social proof horizontal block correctly', () => { | ||
render( | ||
<SocialProofHorizontal | ||
content={({ numberOfReviews, trustScore }) => [ | ||
'Our customers say', | ||
'Excellent', | ||
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`, | ||
]} | ||
data={{ | ||
trustScore: 4.5, | ||
numberOfReviews: '45454', | ||
stars: 4.4, | ||
}} | ||
theme={{ | ||
color: '!text-[#ffffff]', | ||
background: 'bg-solid-slate-700', | ||
}} | ||
logo={ | ||
<OptimizedImage | ||
imageName="home/trustpilot/trustpilot-logo.png" | ||
alt="trustpilot" | ||
width={97} | ||
height={24} | ||
/> | ||
} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText('Our customers say')).toBeInTheDocument(); | ||
|
||
expect(document.querySelector('.bg-solid-slate-700')).toBeInTheDocument(); | ||
|
||
expect(screen.getByAltText('trustpilot')).toBeInTheDocument(); | ||
}); | ||
}); |
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
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,29 @@ | ||
import { TPilotDataProps } from '@deriv-com/components'; | ||
|
||
export const data: Record<string, TPilotDataProps | null> = { | ||
BadScore: { | ||
trustScore: 0.6, | ||
numberOfReviews: '45454', | ||
stars: 0.6, | ||
}, | ||
PoorScore: { | ||
trustScore: 1.6, | ||
numberOfReviews: '45454', | ||
stars: 1.6, | ||
}, | ||
AverageScore: { | ||
trustScore: 2.5, | ||
numberOfReviews: '45454', | ||
stars: 2.5, | ||
}, | ||
GreatScore: { | ||
trustScore: 3.8, | ||
numberOfReviews: '99990', | ||
stars: 3.8, | ||
}, | ||
ExcellentScore: { | ||
trustScore: 4.8, | ||
numberOfReviews: '45454', | ||
stars: 4.8, | ||
}, | ||
}; |
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
40 changes: 40 additions & 0 deletions
40
libs/blocks/src/lib/social-proof/vertical/vertical.spec.tsx
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,40 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { OptimizedImage } from '@deriv-com/components'; | ||
import SocialProofVertical from '.'; | ||
|
||
describe('SocialProofHorizontal', () => { | ||
it('render social proof vertical block correctly', () => { | ||
render( | ||
<SocialProofVertical | ||
title="Title goes here" | ||
content={({ numberOfReviews, trustScore }) => [ | ||
'Our customers say', | ||
'Excellent', | ||
`TrustScore ${trustScore} out of 5 based on ${numberOfReviews} reviews`, | ||
]} | ||
data={{ | ||
trustScore: 4.5, | ||
numberOfReviews: '45454', | ||
stars: 4.4, | ||
}} | ||
theme={{ | ||
color: '!text-[#ffffff]', | ||
background: 'bg-solid-slate-700', | ||
}} | ||
logo={ | ||
<OptimizedImage | ||
imageName="home/trustpilot/trustpilot-logo.png" | ||
alt="trustpilot" | ||
width={97} | ||
height={24} | ||
/> | ||
} | ||
/>, | ||
); | ||
|
||
expect(document.querySelector('.bg-solid-slate-700')).toBeInTheDocument(); | ||
expect(screen.getByText('Our customers say')).toBeInTheDocument(); | ||
expect(screen.getByAltText('trustpilot')).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.