-
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.
likhith/create floating-rate ad (#4964)
* Floating-rate Ui created * Added validations to floating-rate component * Implemented Floating rate component * Added default values for floating rates based on ad type * fixed lint issues * Minor bug fixes * Added store subscriptions * Enhanced InputField component and added floating rate store * Resolved lint errors * Added changes for My Ad screen * Added floate-rate * Added exisiting user update * Added reaction to my-ad store * Edit form * Added edit ad section * Added switch rate modal * Added switch ad dialog * Added banner condition * Added banner condition * Empty commit * Minor bug fixes * Minor bug fixes * removed console logs * Incorporated API changes * Incorporated review comments * Removed duplication * Integrated API with create floting rate ad * Incorporated review comments * Added floating rate error messages * Resolved lint error * Added styling as per UX * Minor bug fix in create ad form * Changes CSS as per BEM * Resolved lint error * Added current_focus to input field * Minor bug fixes for Create ad * Incorporated review comments * Minor bug fix * Removed empty structure * Removed additional switch state * Fixed issue with date banner * Added test cases for Floating rate component * Removed the empty element and replaced with null * Incorporated the changes * fixed incorrect file name * Trigger Build * Added as per naming * Removed localize of 1 * Added review comments * Incorporated changes * Replaced string with constant * Incorporated review comments * Removed un-necessary div * Removed css * Renamed function * Minor bug fixes and incorporated comments * Added fallback * alphabetize observables * Replaced CSS for Ad status * Resoled CSS and functionality bugs * Fixed lint errors * Resolved lint erros * Incorporated review comments * Reduced spacing between the banner * Formatted user input * Fixed failing test case * Added comments to explain functionality * Fetching date and time from server * Renamed function * Refactored code * Added review comments * Resolved decimal round off issue * Fixed Rounding off of decimal digits * Regex change in psoitive integer check * Resolved issue with round off to decimal point * Re-arranged imports * Fixed the testcase * Fixed floating_rate input check * Removed Math.sign * Reverted decimal change * Implemented round of logic for decimal places * refactor: Renamed variables * fix: Round off issue in Create Ad summary * fix: resolved decimal point to 2 digits * Resolved lint errors * fix: Renamed the function * chore: Ad display table rate will be calculated from * fix: test color in dark theme * fix: label changes b/w fixed and floating * fix: invoking api call to fetch the changes * fix: rate synced b/w myads and buy/sell * fix: range offset validation * fix: modified rate property in edit ads * fix: Float rate input suffix * fix: code formatted * fix: setting floating rate to 2 decimals on blur * fix: spacing issue with floating rate input * Trigger build * Trigger build * fix: removed unwanted padding * fix: added ellipse to fix over lapping * fix: removed disabling of floating rate field buttons * fix: resolved issue with error message * fix: Overlapping CSS issues in Mobile * fix: added missing background color for dark theme * fix: removed button highlight in mobile * fix: button higlight issue * fix: display of cursor pointer on scroll * fix: resolved issue with message * fix: Ad change warning message * fix: color for dark mode Co-authored-by: Likhith Kolayari <likhith@deriv.com>
- Loading branch information
1 parent
7d50914
commit 7ba6af0
Showing
25 changed files
with
818 additions
and
400 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
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
packages/p2p/src/components/floating-rate/__test__/floating-rate.spec.js
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 React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import FloatingRate from '../floating-rate.jsx'; | ||
|
||
jest.mock('Stores', () => ({ | ||
...jest.requireActual('Stores'), | ||
useStores: jest.fn().mockReturnValue({ | ||
general_store: { | ||
current_focus: '', | ||
client: { local_currency_config: { decimal_places: 2 } }, | ||
setCurrentFocus: jest.fn(), | ||
}, | ||
}), | ||
})); | ||
|
||
describe('<FloatingRate/>', () => { | ||
it('should render default state of the component with hint message and increment, decrement buttons', () => { | ||
render(<FloatingRate />); | ||
|
||
expect(screen.getByText('of the market rate')).toBeInTheDocument(); | ||
expect(screen.getAllByRole('button').length).toBe(2); | ||
}); | ||
|
||
it('should display error messages when error is passed as props', () => { | ||
render(<FloatingRate error_messages='Floating rate error' />); | ||
|
||
expect(screen.getByText('Floating rate error')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render market rate feed based on the floating rate value passed', () => { | ||
render(<FloatingRate value='+2' exchange_rate='100' />); | ||
|
||
expect(screen.getByText('Your rate is = 102.00')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the exchange rate in hint', () => { | ||
render(<FloatingRate exchange_rate='20' fiat_currency='AED' local_currency='INR' />); | ||
|
||
expect(screen.getByText('1 AED = 20.00 INR')).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.