fix(!desktop/wallet): Swap Modal doesn't have cursor visible when launched

fixes #15417
This commit is contained in:
Khushboo Mehta 2024-07-15 19:09:21 +02:00 committed by Khushboo-dev-cpp
parent 34730eb9ff
commit 1d7ab859be
3 changed files with 33 additions and 8 deletions

View File

@ -326,8 +326,14 @@ Item {
// Launch popup // Launch popup
launchAndVerfyModal() launchAndVerfyModal()
for(let i =0; i< swapAdaptor.nonWatchAccounts.count; i++) { const payPanel = findChild(controlUnderTest, "payPanel")
verify(!!payPanel)
const amountToSendInput = findChild(payPanel, "amountToSendInput")
verify(!!amountToSendInput)
verify(amountToSendInput.input.input.edit.activeFocus)
verify(amountToSendInput.input.input.edit.cursorVisible)
for(let i =0; i< swapAdaptor.nonWatchAccounts.count; i++) {
// launch account selection dropdown // launch account selection dropdown
const accountsModalHeader = getAndVerifyAccountsModalHeader() const accountsModalHeader = getAndVerifyAccountsModalHeader()
launchAccountSelectionPopup(accountsModalHeader) launchAccountSelectionPopup(accountsModalHeader)
@ -356,6 +362,9 @@ Item {
const headerContentItemEmoji = findChild(accountsModalHeader, "assetContent") const headerContentItemEmoji = findChild(accountsModalHeader, "assetContent")
verify(!!headerContentItemEmoji) verify(!!headerContentItemEmoji)
compare(headerContentItemEmoji.asset.emoji, swapAdaptor.nonWatchAccounts.get(i).emoji) compare(headerContentItemEmoji.asset.emoji, swapAdaptor.nonWatchAccounts.get(i).emoji)
verify(amountToSendInput.input.input.edit.activeFocus)
verify(amountToSendInput.input.input.edit.cursorVisible)
} }
closeAndVerfyModal() closeAndVerfyModal()
} }
@ -364,6 +373,13 @@ Item {
// Launch popup // Launch popup
launchAndVerfyModal() launchAndVerfyModal()
const payPanel = findChild(controlUnderTest, "payPanel")
verify(!!payPanel)
const amountToSendInput = findChild(payPanel, "amountToSendInput")
verify(!!amountToSendInput)
verify(amountToSendInput.input.input.edit.activeFocus)
verify(amountToSendInput.input.input.edit.cursorVisible)
// get network comboBox // get network comboBox
const networkComboBox = findChild(controlUnderTest, "networkFilter") const networkComboBox = findChild(controlUnderTest, "networkFilter")
verify(!!networkComboBox) verify(!!networkComboBox)
@ -396,6 +412,9 @@ Item {
const networkComboIcon = findChild(networkComboBox.control.contentItem, "contentItemIcon") const networkComboIcon = findChild(networkComboBox.control.contentItem, "contentItemIcon")
verify(!!networkComboIcon) verify(!!networkComboIcon)
verify(networkComboIcon.asset.name.includes(root.swapAdaptor.filteredFlatNetworksModel.get(i).iconUrl)) verify(networkComboIcon.asset.name.includes(root.swapAdaptor.filteredFlatNetworksModel.get(i).iconUrl))
verify(amountToSendInput.input.input.edit.activeFocus)
verify(amountToSendInput.input.input.edit.cursorVisible)
} }
} }
networkComboBox.control.popup.close() networkComboBox.control.popup.close()

View File

@ -79,11 +79,6 @@ Control {
implicitWidth: 492 implicitWidth: 492
implicitHeight: 131 implicitHeight: 131
Component.onCompleted: {
if (root.swapSide === SwapInputPanel.SwapSide.Pay)
amountToSendInput.input.forceActiveFocus()
}
QtObject { QtObject {
id: d id: d

View File

@ -90,6 +90,7 @@ StatusDialog {
NumberAnimation { duration: 1000; easing.type: Easing.OutExpo; alwaysRunToEnd: true} NumberAnimation { duration: 1000; easing.type: Easing.OutExpo; alwaysRunToEnd: true}
} }
onOpened: payPanel.forceActiveFocus()
onClosed: root.swapAdaptor.reset() onClosed: root.swapAdaptor.reset()
header: Item { header: Item {
@ -107,6 +108,7 @@ StatusDialog {
root.swapInputParamsForm.selectedAccountAddress = currentAccountAddress root.swapInputParamsForm.selectedAccountAddress = currentAccountAddress
} }
} }
control.popup.onClosed: payPanel.forceActiveFocus()
} }
} }
@ -176,6 +178,7 @@ StatusDialog {
} }
} }
} }
payPanel.forceActiveFocus()
} }
} }
} }
@ -211,7 +214,11 @@ StatusDialog {
swapSide: SwapInputPanel.SwapSide.Pay swapSide: SwapInputPanel.SwapSide.Pay
swapExchangeButtonWidth: swapExchangeButton.width swapExchangeButtonWidth: swapExchangeButton.width
onSelectedHoldingIdChanged: root.swapInputParamsForm.fromTokensKey = selectedHoldingId onSelectedHoldingIdChanged: {
if(!!selectedHoldingId) {
root.swapInputParamsForm.fromTokensKey = selectedHoldingId
}
}
onRawValueChanged: { onRawValueChanged: {
if(root.swapInputParamsForm.fromTokensKey === selectedHoldingId) { if(root.swapInputParamsForm.fromTokensKey === selectedHoldingId) {
const amount = !tokenAmount && value === 0 ? "" : const amount = !tokenAmount && value === 0 ? "" :
@ -250,7 +257,11 @@ StatusDialog {
mainInputLoading: root.swapAdaptor.swapProposalLoading mainInputLoading: root.swapAdaptor.swapProposalLoading
bottomTextLoading: root.swapAdaptor.swapProposalLoading bottomTextLoading: root.swapAdaptor.swapProposalLoading
onSelectedHoldingIdChanged: root.swapInputParamsForm.toTokenKey = selectedHoldingId onSelectedHoldingIdChanged: {
if(!!selectedHoldingId) {
root.swapInputParamsForm.toTokenKey = selectedHoldingId
}
}
/* TODO: keep this input as disabled until the work for adding a param to handle to /* TODO: keep this input as disabled until the work for adding a param to handle to
and from tokens inputed is supported by backend under and from tokens inputed is supported by backend under