Skip to content

Commit

Permalink
Merge pull request #5329 from LiskHQ/5326-request-link-with-0-amount
Browse files Browse the repository at this point in the history
Fixed request 0 amount
  • Loading branch information
ikem-legend committed Sep 22, 2023
2 parents 70bbfff + ddb808e commit 061952c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions e2e/features/requestToken/RequestToken.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Feature: Request Token
And button with text 'Copy link' should be disabled
And Element 'qrContainer' should contain class 'disabled'

Scenario: Request token should not generate a copy link if amount is 0
Scenario: Request token should generate a copy link if amount is 0
Given I type "0" in "amount"
Then button with text 'Copy link' should be disabled
And Element 'qrContainer' should contain class 'disabled'
Then button with text 'Copy link' should be enabled
And Element 'qrContainer' should not contain class 'disabled'

Scenario: Request token should generate a copy link
Given I type "10" in "amount"
Expand Down
5 changes: 3 additions & 2 deletions src/modules/wallet/components/request/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const Request = () => {
const applicationExploreAndMetaData = useApplicationExploreAndMetaData();
const networkSupportedTokens = useNetworkSupportedTokens(state.recipientChain.value);
const { recipientChain, token, amount, reference } = state;
const selectedToken = networkSupportedTokens.data?.find(({ tokenID }) => tokenID === token.value);

const shareLink = useMemo(
() =>
Expand Down Expand Up @@ -123,7 +124,8 @@ const Request = () => {
? validateAmount({
amount: target.value,
locale: i18n.language,
token: state.token.value,
token: selectedToken,
checklist: ['MAX_ACCURACY', 'FORMAT'],
}).message
: byteCount > maxMessageLength;
let feedback = '';
Expand Down Expand Up @@ -171,7 +173,6 @@ const Request = () => {
});
};

const selectedToken = networkSupportedTokens.data?.find(({ tokenID }) => tokenID === token.value);
const isFormInvalid = Object.values(state).some(
({ error, value, optional }) => !!error || (!value && !optional)
);
Expand Down

0 comments on commit 061952c

Please sign in to comment.