mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-09 20:29:57 +00:00
Complete table view widgets
This commit is contained in:
parent
ec927b6b8f
commit
a8e145ea15
2 changed files with 1842 additions and 35 deletions
|
@ -1,8 +1,16 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/coin_wallets_table.dart';
|
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/coin_wallets_table.dart';
|
||||||
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
|
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||||
|
import 'package:stackwallet/services/coins/manager.dart';
|
||||||
import 'package:stackwallet/services/wallets.dart';
|
import 'package:stackwallet/services/wallets.dart';
|
||||||
|
import 'package:stackwallet/services/wallets_service.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/table_view/table_view_cell.dart';
|
import 'package:stackwallet/widgets/table_view/table_view_cell.dart';
|
||||||
|
@ -10,30 +18,78 @@ import 'package:stackwallet/widgets/table_view/table_view_row.dart';
|
||||||
|
|
||||||
import 'table_view_row_test.mocks.dart';
|
import 'table_view_row_test.mocks.dart';
|
||||||
|
|
||||||
@GenerateMocks([Wallets])
|
@GenerateMocks([
|
||||||
|
Wallets,
|
||||||
|
WalletsService,
|
||||||
|
BitcoinWallet
|
||||||
|
], customMocks: [
|
||||||
|
MockSpec<Manager>(returnNullOnMissingStub: true),
|
||||||
|
MockSpec<CoinServiceAPI>(returnNullOnMissingStub: true)
|
||||||
|
])
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Blah blah', (widgetTester) async {
|
testWidgets('Blah blah', (widgetTester) async {
|
||||||
final mockWallets = MockWallets();
|
final mockWallet = MockWallets();
|
||||||
|
final CoinServiceAPI wallet = MockBitcoinWallet();
|
||||||
|
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||||
|
|
||||||
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
|
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
|
||||||
|
|
||||||
|
final manager = Manager(wallet);
|
||||||
|
|
||||||
|
when(mockWallet.getWalletIdsFor(coin: Coin.bitcoin))
|
||||||
|
.thenAnswer((realInvocation) => ["Wallet id 1", "wallet id 2"]);
|
||||||
|
|
||||||
|
when(mockWallet.getManagerProvider("Wallet id 1")).thenAnswer(
|
||||||
|
(realInvocation) => ChangeNotifierProvider((ref) => manager));
|
||||||
|
|
||||||
|
when(mockWallet.getManagerProvider("wallet id 2")).thenAnswer(
|
||||||
|
(realInvocation) => ChangeNotifierProvider((ref) => manager));
|
||||||
|
|
||||||
|
final walletIds = mockWallet.getWalletIdsFor(coin: Coin.bitcoin);
|
||||||
|
|
||||||
// final walletIds = mock
|
|
||||||
await widgetTester.pumpWidget(
|
await widgetTester.pumpWidget(
|
||||||
MaterialApp(
|
ProviderScope(
|
||||||
theme: ThemeData(
|
overrides: [
|
||||||
extensions: [
|
walletsChangeNotifierProvider.overrideWithValue(mockWallet),
|
||||||
StackColors.fromStackColorTheme(LightColors()),
|
],
|
||||||
],
|
child: MaterialApp(
|
||||||
),
|
theme: ThemeData(
|
||||||
home: Material(
|
extensions: [
|
||||||
child: TableViewRow(cells: [
|
StackColors.fromStackColorTheme(
|
||||||
for (int j = 1; j <= 5; j++)
|
LightColors(),
|
||||||
TableViewCell(flex: 16, child: Text("Some Text ${j}"))
|
),
|
||||||
], expandingChild: CoinWalletsTable(walletIds: nu)),
|
],
|
||||||
|
),
|
||||||
|
home: Material(
|
||||||
|
child: TableViewRow(cells: [
|
||||||
|
for (int j = 1; j <= 5; j++)
|
||||||
|
TableViewCell(flex: 16, child: Text("Some Text ${j}"))
|
||||||
|
], expandingChild: CoinWalletsTable(walletIds: walletIds)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// await widgetTester.pumpWidget(
|
||||||
|
// MaterialApp(
|
||||||
|
// theme: ThemeData(
|
||||||
|
// extensions: [
|
||||||
|
// StackColors.fromStackColorTheme(LightColors()),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// home: Material(
|
||||||
|
// child: TableViewRow(cells: [
|
||||||
|
// for (int j = 1; j <= 5; j++)
|
||||||
|
// TableViewCell(flex: 16, child: Text("Some Text ${j}"))
|
||||||
|
// ], expandingChild: CoinWalletsTable(walletIds: walletIds)),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
expect(find.text("Some Text 1"), findsOneWidget);
|
expect(find.text("Some Text 1"), findsOneWidget);
|
||||||
expect(find.byType(TableViewRow), findsWidgets);
|
expect(find.byType(TableViewRow), findsWidgets);
|
||||||
expect(find.byType(TableViewCell), findsWidgets);
|
expect(find.byType(TableViewCell), findsWidgets);
|
||||||
|
expect(find.byType(CoinWalletsTable), findsWidgets);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue