fix(wallet)_: Temporarily disable Max Amount button pending #15709

- This commit temporarily disables the MaxAmount button in the `SwapInputPanel` and `SendModal` components.
     - The MaxAmount button will be reintroduced with the correct behavior in issue #15709 for the 2.31 release.

closes: #15710
This commit is contained in:
belalshehab 2024-07-25 02:20:27 +03:00 committed by Belal Shehab
parent db77654274
commit 1aa2221834
4 changed files with 30 additions and 18 deletions

View File

@ -274,7 +274,9 @@ Item {
verify(!maxTagButton.text.endsWith("ETH")) verify(!maxTagButton.text.endsWith("ETH"))
} }
// FIXME: This should be enabled after #15709 is resolved
function test_clickingMaxButton() { function test_clickingMaxButton() {
skip("maxTabButton is diabled")
controlUnderTest = createTemporaryObject(componentUnderTest, root, {tokenKey: "ETH"}) controlUnderTest = createTemporaryObject(componentUnderTest, root, {tokenKey: "ETH"})
verify(!!controlUnderTest) verify(!!controlUnderTest)
waitForRendering(controlUnderTest) waitForRendering(controlUnderTest)
@ -355,10 +357,13 @@ Item {
waitForRendering(controlUnderTest) waitForRendering(controlUnderTest)
verify(maxTagButton.visible) verify(maxTagButton.visible)
// FIXME: maxTagButton should be enabled after #15709 is resolved
verify(!maxTagButton.enabled)
verify(!maxTagButton.text.endsWith(modelItemToTest.symbol)) verify(!maxTagButton.text.endsWith(modelItemToTest.symbol))
tryCompare(maxTagButton, "type", modelItemToTest.currentBalance === 0 ? StatusBaseButton.Type.Danger : StatusBaseButton.Type.Normal) tryCompare(maxTagButton, "type", modelItemToTest.currentBalance === 0 ? StatusBaseButton.Type.Danger : StatusBaseButton.Type.Normal)
// check input value and state // check input value and state
if (maxTagButton.enabled) {
mouseClick(maxTagButton) mouseClick(maxTagButton)
waitForRendering(amountToSendInput) waitForRendering(amountToSendInput)
@ -369,7 +374,7 @@ Item {
compare(bottomItemText.text, d.adaptor.formatCurrencyAmount( compare(bottomItemText.text, d.adaptor.formatCurrencyAmount(
maxTagButton.maxSafeValue * marketPrice, maxTagButton.maxSafeValue * marketPrice,
d.adaptor.currencyStore.currentCurrency)) d.adaptor.currencyStore.currentCurrency))
}
amountToSendInput.input.input.edit.clear() amountToSendInput.input.input.edit.clear()
} }
} }

View File

@ -1178,6 +1178,8 @@ Item {
// check states for the pay input selector // check states for the pay input selector
verify(maxTagButton.visible) verify(maxTagButton.visible)
// FIXME: maxTagButton should be enabled after #15709 is resolved
verify(!maxTagButton.enabled);
let maxPossibleValue = WalletUtils.calculateMaxSafeSendAmount(expectedToken.currentBalance, expectedToken.symbol) let maxPossibleValue = WalletUtils.calculateMaxSafeSendAmount(expectedToken.currentBalance, expectedToken.symbol)
let truncmaxPossibleValue = Math.trunc(maxPossibleValue*100)/100 let truncmaxPossibleValue = Math.trunc(maxPossibleValue*100)/100
compare(maxTagButton.text, qsTr("Max. %1").arg(truncmaxPossibleValue === 0 ? Qt.locale().zeroDigit compare(maxTagButton.text, qsTr("Max. %1").arg(truncmaxPossibleValue === 0 ? Qt.locale().zeroDigit
@ -1189,6 +1191,7 @@ Item {
compare(amountToSendInput.input.placeholderText, LocaleUtils.numberToLocaleString(0)) compare(amountToSendInput.input.placeholderText, LocaleUtils.numberToLocaleString(0))
tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(valueToExchange * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency)) tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(valueToExchange * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency))
if (maxTagButton.enabled) {
// click on max button // click on max button
mouseClick(maxTagButton) mouseClick(maxTagButton)
waitForItemPolished(payPanel) waitForItemPolished(payPanel)
@ -1197,7 +1200,7 @@ Item {
verify(amountToSendInput.input.input.edit.cursorVisible) verify(amountToSendInput.input.input.edit.cursorVisible)
tryCompare(amountToSendInput.input, "text", maxPossibleValue === 0 ? "" : maxPossibleValue.toLocaleString(Qt.locale(), 'f', -128)) tryCompare(amountToSendInput.input, "text", maxPossibleValue === 0 ? "" : maxPossibleValue.toLocaleString(Qt.locale(), 'f', -128))
tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(maxPossibleValue * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency)) tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(maxPossibleValue * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency))
}
closeAndVerfyModal() closeAndVerfyModal()
} }

View File

@ -276,6 +276,8 @@ Control {
{ noSymbol: !amountToSendInput.inputIsFiat }) { noSymbol: !amountToSendInput.inputIsFiat })
visible: d.isSelectedHoldingValidAsset && root.swapSide === SwapInputPanel.SwapSide.Pay visible: d.isSelectedHoldingValidAsset && root.swapSide === SwapInputPanel.SwapSide.Pay
// FIXME: This should be enabled after #15709 is resolved
enabled: false
onClicked: { onClicked: {
if (maxSafeValue) if (maxSafeValue)

View File

@ -427,6 +427,8 @@ StatusDialog {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
visible: d.isSelectedHoldingValidAsset && !d.isCollectiblesTransfer visible: d.isSelectedHoldingValidAsset && !d.isCollectiblesTransfer
// FIXME: This should be enabled after #15709 is resolved
enabled: false
onClicked: { onClicked: {
if (maxSafeValue > 0) { if (maxSafeValue > 0) {