feat: align shared app foundations
This commit is contained in:
1 parent
bd6bb0ffce
commit
c5653a3699
21 files changed
+894
-66
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jinzhi_flutter_app/common/lifecycle/refresh_coordinator.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('refreshes active registrations when returning to foreground', (
|
||||
tester,
|
||||
) async {
|
||||
final coordinator = RefreshCoordinator();
|
||||
addTearDown(coordinator.dispose);
|
||||
var activeCalls = 0;
|
||||
var inactiveCalls = 0;
|
||||
coordinator.register(onRefresh: () => activeCalls++);
|
||||
coordinator.register(onRefresh: () => inactiveCalls++, active: false);
|
||||
|
||||
coordinator.didChangeAppLifecycleState(AppLifecycleState.resumed);
|
||||
await tester.pump();
|
||||
|
||||
expect(activeCalls, 1);
|
||||
expect(inactiveCalls, 0);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user