fix(@desktop/wallet): fix for Swap Input parameters reset when balances are reloaded
fixes #15785
This commit is contained in:
parent
b67ea6643a
commit
27aaa97ebd
|
@ -479,5 +479,40 @@ Item {
|
||||||
compare(controlUnderTest.selectedHoldingId, tokenKeyToTest)
|
compare(controlUnderTest.selectedHoldingId, tokenKeyToTest)
|
||||||
compare(controlUnderTest.amountEnteredGreaterThanBalance, false)
|
compare(controlUnderTest.amountEnteredGreaterThanBalance, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_if_values_not_reset_on_modelReset() {
|
||||||
|
const tokenKeyToTest = "ETH"
|
||||||
|
let numberTestedString = "1.0001"
|
||||||
|
let modelItemToTest = ModelUtils.getByKey(d.tokenSelectorAdaptor.outputAssetsModel, "tokensKey", tokenKeyToTest)
|
||||||
|
controlUnderTest = createTemporaryObject(componentUnderTest, root, {
|
||||||
|
swapSide: SwapInputPanel.SwapSide.Pay,
|
||||||
|
tokenKey: tokenKeyToTest,
|
||||||
|
tokenAmount: numberTestedString
|
||||||
|
})
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
waitForRendering(controlUnderTest)
|
||||||
|
|
||||||
|
|
||||||
|
const amountToSendInput = findChild(controlUnderTest, "amountToSendInput")
|
||||||
|
verify(!!amountToSendInput)
|
||||||
|
|
||||||
|
let numberTested = LocaleUtils.numberFromLocaleString(numberTestedString, amountToSendInput.input.locale)
|
||||||
|
|
||||||
|
compare(amountToSendInput.input.text, numberTestedString)
|
||||||
|
compare(controlUnderTest.value, numberTested)
|
||||||
|
compare(controlUnderTest.rawValue, AmountsArithmetic.fromNumber(amountToSendInput.input.text, modelItemToTest.decimals).toString())
|
||||||
|
compare(controlUnderTest.valueValid, true)
|
||||||
|
compare(controlUnderTest.selectedHoldingId, tokenKeyToTest)
|
||||||
|
compare(controlUnderTest.amountEnteredGreaterThanBalance, false)
|
||||||
|
|
||||||
|
d.tokenSelectorAdaptor.assetsModel.modelReset()
|
||||||
|
|
||||||
|
compare(amountToSendInput.input.text, numberTestedString)
|
||||||
|
compare(controlUnderTest.value, numberTested)
|
||||||
|
compare(controlUnderTest.rawValue, AmountsArithmetic.fromNumber(amountToSendInput.input.text, modelItemToTest.decimals).toString())
|
||||||
|
compare(controlUnderTest.valueValid, true)
|
||||||
|
compare(controlUnderTest.selectedHoldingId, tokenKeyToTest)
|
||||||
|
compare(controlUnderTest.amountEnteredGreaterThanBalance, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1064,6 +1064,7 @@ Item {
|
||||||
|
|
||||||
const receivePanel = findChild(controlUnderTest, "receivePanel")
|
const receivePanel = findChild(controlUnderTest, "receivePanel")
|
||||||
verify(!!receivePanel)
|
verify(!!receivePanel)
|
||||||
|
waitForRendering(receivePanel)
|
||||||
const amountToSendInput = findChild(receivePanel, "amountToSendInput")
|
const amountToSendInput = findChild(receivePanel, "amountToSendInput")
|
||||||
verify(!!amountToSendInput)
|
verify(!!amountToSendInput)
|
||||||
const bottomItemText = findChild(receivePanel, "bottomItemText")
|
const bottomItemText = findChild(receivePanel, "bottomItemText")
|
||||||
|
|
|
@ -188,6 +188,7 @@ QObject {
|
||||||
|
|
||||||
ConcatModel {
|
ConcatModel {
|
||||||
id: concatModel
|
id: concatModel
|
||||||
|
propagateResets: true
|
||||||
sources: [
|
sources: [
|
||||||
SourceModel {
|
SourceModel {
|
||||||
model: renamedTokensBySymbolModel
|
model: renamedTokensBySymbolModel
|
||||||
|
|
|
@ -122,17 +122,6 @@ Control {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: remove after https://github.com/status-im/status-desktop/issues/15604 is
|
|
||||||
implemented as this is hack to set token values correctly when model is reset */
|
|
||||||
Connections {
|
|
||||||
target: holdingSelector.model
|
|
||||||
function onRowsInserted() {
|
|
||||||
if(!!tokenKey) {
|
|
||||||
root.reevaluateSelectedId()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Shape {
|
background: Shape {
|
||||||
id: shape
|
id: shape
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue