Skip to content

Commit 8ce79e6

Browse files
committed
chore: some improvements on the storybook side
1 parent 214f5b3 commit 8ce79e6

22 files changed

+166
-101
lines changed

storybook/pages/AccountSelectorPage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import shared.controls
1010
import shared.stores
1111

1212
import AppLayouts.Wallet.stores
13+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
1314
import AppLayouts.Wallet.adaptors
1415

1516
import utils
@@ -25,7 +26,7 @@ SplitView {
2526
readonly property var flatNetworks: NetworksModel.flatNetworks
2627
readonly property var assetsStore: WalletAssetsStore {
2728
id: thisWalletAssetStore
28-
walletTokensStore: TokensStore {
29+
walletTokensStore: WalletStoreMocks.TokensStore {
2930
tokenGroupsModel: TokenGroupsModel {}
3031
}
3132
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}

storybook/pages/AssetsDetailViewPage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import QtQuick.Layouts
33

44
import AppLayouts.Wallet.views
55
import AppLayouts.Wallet.stores as WalletStores
6+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
67

78
import shared.stores as SharedStores
89

@@ -17,7 +18,7 @@ Item {
1718
AssetsDetailView {
1819
anchors.fill: parent
1920

20-
tokensStore: WalletStores.TokensStore {}
21+
tokensStore: WalletStoreMocks.TokensStore {}
2122
currencyStore: SharedStores.CurrenciesStore {}
2223
networkConnectionStore: SharedStores.NetworkConnectionStore {}
2324

storybook/pages/BuyCryptoModalPage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import StatusQ.Core.Backpressure
1010

1111
import AppLayouts.Wallet.popups.buy
1212
import AppLayouts.Wallet.stores
13+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
1314
import AppLayouts.Wallet.adaptors
1415

1516
import shared.stores
@@ -53,7 +54,7 @@ SplitView {
5354
readonly property var currencyStore: CurrenciesStore {}
5455
readonly property var assetsStore: WalletAssetsStore {
5556
id: thisWalletAssetStore
56-
walletTokensStore: TokensStore {
57+
walletTokensStore: WalletStoreMocks.TokensStore {
5758
tokenGroupsModel: TokenGroupsModel {}
5859
}
5960
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}

storybook/pages/SendModalPage.qml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,31 @@ SplitView {
9696
function resetData() {}
9797

9898
walletAssetStore: root.walletAssetStore
99-
tokensStore.showCommunityAssetsInSend: showCommunityAssetsCheckBox.checked
100-
tokensStore.displayAssetsBelowBalance: balanceThresholdCheckbox.checked
101-
tokensStore.getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => Number(balanceThresholdValue.text)
99+
Component.onCompleted: {
100+
if (tokensStore) {
101+
tokensStore.showCommunityAssetsInSend = showCommunityAssetsCheckBox.checked
102+
tokensStore.displayAssetsBelowBalance = balanceThresholdCheckbox.checked
103+
tokensStore._displayAssetsBelowBalanceThresholdDisplayAmountFunc = () => Number(balanceThresholdValue.text)
104+
}
105+
}
106+
}
107+
108+
Connections {
109+
target: showCommunityAssetsCheckBox
110+
function onCheckedChanged() {
111+
if (txStore.tokensStore) {
112+
txStore.tokensStore.showCommunityAssetsInSend = showCommunityAssetsCheckBox.checked
113+
}
114+
}
115+
}
116+
117+
Connections {
118+
target: balanceThresholdCheckbox
119+
function onCheckedChanged() {
120+
if (txStore.tokensStore) {
121+
txStore.tokensStore.displayAssetsBelowBalance = balanceThresholdCheckbox.checked
122+
}
123+
}
102124
}
103125

104126
NetworksStore {

storybook/pages/SimpleSendModalPage.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Storybook
1616

1717
import AppLayouts.Wallet.popups.simpleSend
1818
import AppLayouts.Wallet.stores
19+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
1920
import AppLayouts.Wallet.adaptors
2021

2122
import utils
@@ -34,9 +35,9 @@ SplitView {
3435
}
3536

3637
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
37-
walletTokensStore: TokensStore {
38+
walletTokensStore: WalletStoreMocks.TokensStore {
3839
tokenGroupsModel: TokenGroupsModel{}
39-
getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => 0
40+
_displayAssetsBelowBalanceThresholdDisplayAmountFunc: () => 0
4041
}
4142
}
4243

storybook/pages/SwapInputPanelPage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import shared.stores
1111
import shared.stores.send
1212

1313
import AppLayouts.Wallet.stores
14+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
1415
import AppLayouts.Wallet.panels
1516
import AppLayouts.Wallet.controls
1617

@@ -75,7 +76,7 @@ SplitView {
7576
}
7677
walletAssetsStore: WalletAssetsStore {
7778
id: thisWalletAssetStore
78-
walletTokensStore: TokensStore {
79+
walletTokensStore: WalletStoreMocks.TokensStore {
7980
tokenGroupsModel: TokenGroupsModel {}
8081
}
8182
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}

storybook/pages/SwapModalPage.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Models
1717
import mainui
1818
import AppLayouts.Wallet.popups.swap
1919
import AppLayouts.Wallet.stores
20+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
2021
import AppLayouts.stores as AppLayoutStores
2122
import shared.stores as SharedStores
2223

@@ -115,10 +116,10 @@ SplitView {
115116
signalName: "authenticateAndTransferSignal"
116117
}
117118

118-
TokensStore {
119+
WalletStoreMocks.TokensStore {
119120
id: tokensStore
120121
tokenGroupsModel: TokenGroupsModel {}
121-
getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => 0
122+
_displayAssetsBelowBalanceThresholdDisplayAmountFunc: () => 0
122123
}
123124

124125
SwapModalAdaptor {

storybook/pages/WalletAccountsSelectorAdaptorPage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import QtQuick.Layouts
44
import SortFilterProxyModel
55

66
import AppLayouts.Wallet.stores
7+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
78
import AppLayouts.Wallet.adaptors
89

910
import Storybook
@@ -100,7 +101,7 @@ Item {
100101

101102
readonly property var assetsStore: WalletAssetsStore {
102103
id: thisWalletAssetStore
103-
walletTokensStore: TokensStore {
104+
walletTokensStore: WalletStoreMocks.TokensStore {
104105
tokenGroupsModel: TokenGroupsModel {}
105106
}
106107
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}

storybook/qmlTests/tests/tst_BuyCryptoModal.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import utils
1414

1515
import AppLayouts.Wallet.popups.buy
1616
import AppLayouts.Wallet.stores
17+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
1718

1819
import shared.stores
1920

@@ -92,7 +93,7 @@ Item {
9293
}
9394
readonly property var assetsStore: WalletAssetsStore {
9495
id: thisWalletAssetStore
95-
walletTokensStore: TokensStore {
96+
walletTokensStore: WalletStoreMocks.TokensStore {
9697
tokenGroupsModel: TokenGroupsModel {}
9798
}
9899
}

storybook/qmlTests/tests/tst_DAppsWorkflow.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import AppLayouts.Wallet.services.dapps.types
1616
import AppLayouts.Profile.stores
1717
import AppLayouts.Wallet.panels
1818
import AppLayouts.Wallet.stores as WalletStore
19+
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
1920
import AppLayouts.Wallet.popups.dapps
2021

2122
import shared.stores
@@ -313,7 +314,7 @@ Item {
313314

314315
WalletStore.WalletAssetsStore {
315316
id: assetsStoreMock
316-
walletTokensStore: WalletStore.TokensStore {
317+
walletTokensStore: WalletStoreMocks.TokensStore {
317318
tokenGroupsModel: TokenGroupsModel {}
318319
}
319320
}
@@ -581,7 +582,7 @@ Item {
581582
session.params.request.expiryTimestamp = (Date.now() - 10000) / 1000
582583

583584
verify(session.params.request.expiryTimestamp < Date.now() / 1000, "expected expiryTimestamp to be in the past")
584-
585+
585586
mockActiveSession(handler.accountsModel, handler.networksModel, sdk, topic)
586587
sdk.sessionRequestEvent(session)
587588

0 commit comments

Comments
 (0)