@@ -57,7 +57,7 @@ extension MyWidgetWithMixinStateChecks on Subject<MyWidgetWithMixinState> {
5757void main () {
5858 TestZulipBinding .ensureInitialized ();
5959
60- testWidgets ('GlobalStoreWidget' , (tester) async {
60+ testWidgets ('GlobalStoreWidget loads data while showing placeholder ' , (tester) async {
6161 addTearDown (testBinding.reset);
6262
6363 GlobalStore ? globalStore;
@@ -83,6 +83,25 @@ void main() {
8383 .equals ((accountId: eg.selfAccount.id, account: eg.selfAccount));
8484 });
8585
86+ testWidgets ('GlobalStoreWidget.of updates dependents' , (tester) async {
87+ addTearDown (testBinding.reset);
88+
89+ List <int >? accountIds;
90+ await tester.pumpWidget (
91+ Directionality (textDirection: TextDirection .ltr,
92+ child: GlobalStoreWidget (
93+ child: Builder (builder: (context) {
94+ accountIds = GlobalStoreWidget .of (context).accountIds.toList ();
95+ return SizedBox .shrink ();
96+ }))));
97+ await tester.pump ();
98+ check (accountIds).isNotNull ().isEmpty ();
99+
100+ await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
101+ await tester.pump ();
102+ check (accountIds).isNotNull ().deepEquals ([eg.selfAccount.id]);
103+ });
104+
86105 testWidgets ('PerAccountStoreWidget basic' , (tester) async {
87106 await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
88107 addTearDown (testBinding.reset);
0 commit comments