@@ -334,16 +334,11 @@ void main() {
334
334
});
335
335
336
336
group ('TopicAutocomplete' , () {
337
- void checkTopicShown (String topic, PerAccountStore store, {required bool expected}) {
338
- check (find.text (topic).evaluate ().length).equals (expected ? 1 : 0 );
339
- }
340
-
341
337
testWidgets ('options appear, disappear, and change correctly' , (WidgetTester tester) async {
342
338
final topic1 = eg.getStreamTopicsEntry (maxId: 1 , name: 'Topic one' );
343
339
final topic2 = eg.getStreamTopicsEntry (maxId: 2 , name: 'Topic two' );
344
340
final topic3 = eg.getStreamTopicsEntry (maxId: 3 , name: 'Topic three' );
345
341
final topicInputFinder = await setupToTopicInput (tester, topics: [topic1, topic2, topic3]);
346
- final store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
347
342
348
343
// Options are filtered correctly for query
349
344
// TODO(#226): Remove this extra edit when this bug is fixed.
@@ -352,24 +347,24 @@ void main() {
352
347
await tester.pumpAndSettle ();
353
348
354
349
// "topic three" and "topic two" appear, but not "topic one"
355
- checkTopicShown ( 'Topic one' , store, expected : false );
356
- checkTopicShown ( 'Topic two' , store, expected : true );
357
- checkTopicShown ( 'Topic three' , store, expected : true );
350
+ check (find. text ( 'Topic one' )). findsNothing ( );
351
+ check (find. text ( 'Topic two' )). findsOne ( );
352
+ check (find. text ( 'Topic three' )). findsOne ( );
358
353
359
354
// Finishing autocomplete updates topic box; causes options to disappear
360
355
await tester.tap (find.text ('Topic three' ));
361
356
await tester.pumpAndSettle ();
362
357
check (tester.widget <TextField >(topicInputFinder).controller! .text)
363
358
.equals (topic3.name.displayName);
364
- checkTopicShown ( 'Topic one' , store, expected : false );
365
- checkTopicShown ( 'Topic two' , store, expected : false );
366
- checkTopicShown ( 'Topic three' , store, expected : true ); // shown in `_TopicInput` once
359
+ check (find. text ( 'Topic one' )). findsNothing ( );
360
+ check (find. text ( 'Topic two' )). findsNothing ( );
361
+ check (find. text ( 'Topic three' )). findsOne ( ); // shown in `_TopicInput` once
367
362
368
363
// Then a new autocomplete intent brings up options again
369
364
await tester.enterText (topicInputFinder, 'Topic' );
370
365
await tester.enterText (topicInputFinder, 'Topic T' );
371
366
await tester.pumpAndSettle ();
372
- checkTopicShown ( 'Topic two' , store, expected : true );
367
+ check (find. text ( 'Topic two' )). findsOne ( );
373
368
});
374
369
375
370
testWidgets ('text selection is reset on choosing an option' , (tester) async {
0 commit comments