-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kate / Add video for Vanillas description (#9622)
* feat: add video for vanilla * refactor: add tests and change file structure * refactor: video component and test * refactor: change folders name and add more videos * refactor: apply suggestions * chore: rename data test id * chore: correct spelling * chore: remove optional data test id * refactor: add backup * fix: tests
- Loading branch information
1 parent
f85083c
commit ea42eda
Showing
25 changed files
with
115 additions
and
51 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion
1
packages/trader/src/Assets/SvgComponents/trade_explanations/img-vanilla.svg
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
...s/trader/src/Assets/Trading/Categories/__tests__/contract-type-description-video.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,56 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { mockStore } from '@deriv/stores'; | ||
import TraderProviders from '../../../../trader-providers'; | ||
import ContractTypeDescriptionVideo from '../contract-type-description-video'; | ||
import { TCoreStores } from '@deriv/stores/types'; | ||
import { isMobile } from '@deriv/shared'; | ||
|
||
const default_mocked_props = { | ||
selected_contract_type: 'vanilla', | ||
data_testid: 'dt_description_video', | ||
}; | ||
|
||
jest.mock('@deriv/shared', () => ({ | ||
...jest.requireActual('@deriv/shared'), | ||
isMobile: jest.fn(), | ||
})); | ||
|
||
describe('<ContractTypeDescriptionVideo />', () => { | ||
const mockContractTypeDescriptionVideo = ( | ||
mocked_store: TCoreStores, | ||
mocked_props: React.ComponentProps<typeof ContractTypeDescriptionVideo> | ||
) => { | ||
return ( | ||
<TraderProviders store={mocked_store}> | ||
<ContractTypeDescriptionVideo {...mocked_props} /> | ||
</TraderProviders> | ||
); | ||
}; | ||
it('should render the component with video if selected_contract_type does support video', () => { | ||
(isMobile as jest.Mock).mockReturnValue(false); | ||
const mock_root_store = mockStore({}); | ||
render(mockContractTypeDescriptionVideo(mock_root_store, default_mocked_props)); | ||
const video = screen.getByTestId(/description_video/i); | ||
|
||
expect(video).toBeInTheDocument(); | ||
expect(video).toHaveAttribute('width', '480'); | ||
expect(video).toHaveAttribute('height', '270'); | ||
}); | ||
it('should be able to find a proper video and render the component if is_dark_mode_on is true', () => { | ||
const mock_root_store = mockStore({ ui: { is_dark_mode_on: true } }); | ||
render(mockContractTypeDescriptionVideo(mock_root_store, default_mocked_props)); | ||
|
||
expect(screen.getByTestId(/description_video/i)).toBeInTheDocument(); | ||
}); | ||
it('should render the component with video of proper width and height if it is mobile', () => { | ||
(isMobile as jest.Mock).mockReturnValue(true); | ||
const mock_root_store = mockStore({}); | ||
render(mockContractTypeDescriptionVideo(mock_root_store, default_mocked_props)); | ||
const video = screen.getByTestId(/description_video/i); | ||
|
||
expect(video).toBeInTheDocument(); | ||
expect(video).toHaveAttribute('width', '328'); | ||
expect(video).toHaveAttribute('height', '184.5'); | ||
}); | ||
}); |
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
Oops, something went wrong.
ea42eda
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.
Successfully deployed to the following URLs:
deriv-app – ./
deriv-app.vercel.app
binary.sx
deriv-app-git-master.binary.sx
deriv-app.binary.sx