@@ -392,16 +392,11 @@ void main() {
392
392
});
393
393
394
394
group ('TopicAutocomplete' , () {
395
- void checkTopicShown (String topic, PerAccountStore store, {required bool expected}) {
396
- check (find.text (topic).evaluate ().length).equals (expected ? 1 : 0 );
397
- }
398
-
399
395
testWidgets ('options appear, disappear, and change correctly' , (WidgetTester tester) async {
400
396
final topic1 = eg.getStreamTopicsEntry (maxId: 1 , name: 'Topic one' );
401
397
final topic2 = eg.getStreamTopicsEntry (maxId: 2 , name: 'Topic two' );
402
398
final topic3 = eg.getStreamTopicsEntry (maxId: 3 , name: 'Topic three' );
403
399
final topicInputFinder = await setupToTopicInput (tester, topics: [topic1, topic2, topic3]);
404
- final store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
405
400
406
401
// Options are filtered correctly for query
407
402
// TODO(#226): Remove this extra edit when this bug is fixed.
@@ -410,24 +405,24 @@ void main() {
410
405
await tester.pumpAndSettle ();
411
406
412
407
// "topic three" and "topic two" appear, but not "topic one"
413
- checkTopicShown ( 'Topic one' , store, expected : false );
414
- checkTopicShown ( 'Topic two' , store, expected : true );
415
- checkTopicShown ( 'Topic three' , store, expected : true );
408
+ check (find. text ( 'Topic one' )). findsNothing ( );
409
+ check (find. text ( 'Topic two' )). findsOne ( );
410
+ check (find. text ( 'Topic three' )). findsOne ( );
416
411
417
412
// Finishing autocomplete updates topic box; causes options to disappear
418
413
await tester.tap (find.text ('Topic three' ));
419
414
await tester.pumpAndSettle ();
420
415
check (tester.widget <TextField >(topicInputFinder).controller! .text)
421
416
.equals (topic3.name.displayName);
422
- checkTopicShown ( 'Topic one' , store, expected : false );
423
- checkTopicShown ( 'Topic two' , store, expected : false );
424
- checkTopicShown ( 'Topic three' , store, expected : true ); // shown in `_TopicInput` once
417
+ check (find. text ( 'Topic one' )). findsNothing ( );
418
+ check (find. text ( 'Topic two' )). findsNothing ( );
419
+ check (find. text ( 'Topic three' )). findsOne ( ); // shown in `_TopicInput` once
425
420
426
421
// Then a new autocomplete intent brings up options again
427
422
await tester.enterText (topicInputFinder, 'Topic' );
428
423
await tester.enterText (topicInputFinder, 'Topic T' );
429
424
await tester.pumpAndSettle ();
430
- checkTopicShown ( 'Topic two' , store, expected : true );
425
+ check (find. text ( 'Topic two' )). findsOne ( );
431
426
});
432
427
433
428
testWidgets ('text selection is reset on choosing an option' , (tester) async {
0 commit comments