Merge pull request #825 from eseidelGoogle/locale_test
Add a test to stocks for changing the locale
This commit is contained in:
@@ -4,3 +4,6 @@ dependencies:
|
||||
path: ../../packages/flutter
|
||||
|
||||
intl: '>=0.12.4+2 <0.13.0'
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
path: ../../packages/flutter_test
|
||||
|
||||
23
examples/stocks/tests/locale_test.dart
Normal file
23
examples/stocks/tests/locale_test.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stocks/main.dart' as stocks;
|
||||
import 'package:stocks/stock_data.dart' as stock_data;
|
||||
|
||||
void main() {
|
||||
stock_data.StockDataFetcher.actuallyFetchData = false;
|
||||
|
||||
test("Test changing locale", () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
stocks.main();
|
||||
tester.pump(const Duration(seconds: 1)); // Unclear why duration is required.
|
||||
|
||||
Element<Text> tab = tester.findText('MARKET');
|
||||
expect(tab, isNotNull);
|
||||
tester.setLocale("es", "US");
|
||||
tester.pump();
|
||||
expect(tab.widget.data, equals("MERCADO"));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user