This repository was archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
feat: added resrictions #203
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
86f1ac5
feat: added resrictions
sanjam-deriv 736a7cf
fix: merge branch 'master' into restrictions
sanjam-deriv 88afda9
chore: added tests and states
sanjam-deriv de8fdfd
Merge branch 'master' into restrictions
sanjam-deriv 04a6422
chore: hide token
sanjam-deriv 3c56d41
chore: hide token
sanjam-deriv 803574a
fix: test case
sanjam-deriv 087c1ce
fix: test case
sanjam-deriv 254cf6b
fix: test case
sanjam-deriv e614d3f
Merge branch 'master' into restrictions
hubert-deriv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
10 changes: 10 additions & 0 deletions
10
src/features/dashboard/components/TokenNameRestrictions/TokenNameRestrictions.module.scss
This file contains hidden or 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,10 @@ | ||
| @use 'src/styles/utility' as *; | ||
|
|
||
| .tokenrestrictions { | ||
| font-size: rem(1.4); | ||
| font-weight: 400; | ||
| line-height: 18px; | ||
| padding-left: rem(2.8); | ||
| margin-top: rem(1); | ||
| color: var(--colors-greyLight600); | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
src/features/dashboard/components/TokenNameRestrictions/TokenNameRestrictions.tsx
This file contains hidden or 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,19 @@ | ||
| import React from 'react'; | ||
| import styles from './TokenNameRestrictions.module.scss'; | ||
|
|
||
| const TokenNameRestrictions = () => { | ||
| return ( | ||
| <ol className={styles.tokenrestrictions}> | ||
| <li>Only alphanumeric characters with spaces and underscores are allowed.</li> | ||
| <li>Only 2-32 characters are allowed</li> | ||
| <li>No duplicate token names are allowed for the same account.</li> | ||
| <li> | ||
| { | ||
| 'No keywords "deriv" or "binary" or words that look similar, e.g. "_binary_" or "d3eriv" are allowed.' | ||
| } | ||
| </li> | ||
| </ol> | ||
| ); | ||
| }; | ||
|
|
||
| export default TokenNameRestrictions; |
31 changes: 31 additions & 0 deletions
31
...tures/dashboard/components/TokenNameRestrictions/__tests__/TokenNameRestrictions.test.tsx
This file contains hidden or 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,31 @@ | ||
| import React from 'react'; | ||
| import { render, screen } from '@site/src/test-utils'; | ||
| import TokenNameRestrictions from '../TokenNameRestrictions'; | ||
|
|
||
| describe('Restrictions for App name', () => { | ||
| beforeEach(() => { | ||
| render(<TokenNameRestrictions />); | ||
| }); | ||
| it('Should render the list', () => { | ||
| const RestrictonList = screen.getByRole('list'); | ||
| expect(RestrictonList).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('Should display correct content inside list items', () => { | ||
| const listItem1 = screen.getByText( | ||
| 'Only alphanumeric characters with spaces and underscores are allowed.', | ||
| ); | ||
| const listItem2 = screen.getByText('Only 2-32 characters are allowed'); | ||
| const listItem3 = screen.getByText( | ||
| 'No duplicate token names are allowed for the same account.', | ||
| ); | ||
| const listItem4 = screen.getByText( | ||
| 'No keywords "deriv" or "binary" or words that look similar, e.g. "_binary_" or "d3eriv" are allowed.', | ||
| ); | ||
|
|
||
| expect(listItem1).toBeInTheDocument(); | ||
| expect(listItem2).toBeInTheDocument(); | ||
| expect(listItem3).toBeInTheDocument(); | ||
| expect(listItem4).toBeInTheDocument(); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.