Repository: flutter/flutter
File: packages/flutter/test/material/expansion_tile_test.dart (Dart)

Code before:
          ),
        );
        expect(liveRegionSemantics.label, localizations.expandedHint);

        handle.dispose();
      },
      variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.android}),
    );
  });

  testWidgets('ExpansionTile forwards statesController to ListTile', (tester) async {
    final controller = WidgetStatesController();

    await tester.pumpWidget(
      MaterialApp(
        home: Material(
          child: ExpansionTile(title: const Text('Tile'), statesController: controller),
        ),
      ),
    );

    final ListTile listTile = tester.widget<ListTile>(find.byType(ListTile));
    expect(listTile.statesController, controller);
  });

  testWidgets('ExpansionTile forwards statesController to ListTile', (tester) async {
    final controller = WidgetStatesController();
    addTearDown(() async {
      controller.dispose();
      await tester.pumpWidget(const SizedBox.shrink());
    });

    await tester.pumpWidget(
      MaterialApp(
        home: Material(
          child: ExpansionTile(title: const Text('Tile'), statesController: controller),
        ),
      ),
    );

    final ListTile listTile = tester.widget<ListTile>(find.byType(ListTile));
    expect(listTile.statesController, controller);
  });
}


Review comment (suggestion):
We have 2 identical "ExpansionTile forwards statesController to ListTile" tests now. I think originally this is "ExpansionTile forwards null statesController to ListTile".

Code after:
        );
        expect(semantics.hint, localizations.expandedHint);

        // Tap to expand.
        await tester.tap(find.text('Test Tile'));
        await tester.pumpAndSettle();

        // Now expanded - should show "Expanded".
        semantics = tester.getSemantics(
          find.ancestor(of: find.byType(ListTile), matching: find.byType(Semantics)).first,
        );
        expect(semantics.hint, localizations.collapsedHint);

        // Tap to collapse.
        await tester.tap(find.text('Test Tile'));
        await tester.pumpAndSettle();

        // Back to collapsed - should show "Collapsed" again.
        semantics = tester.getSemantics(
          find.ancestor(of: find.byType(ListTile), matching: find.byType(Semantics)).first,
        );
        expect(semantics.hint, localizations.expandedHint);

        handle.dispose();
      },
      variant: const TargetPlatformVariant(<TargetPlatform>{
        TargetPlatform.android,
        TargetPlatform.fuchsia,
        TargetPlatform.linux,
        TargetPlatform.windows,
      }),
    );
  });
  group('Semantics tests for android platform', () {
    testWidgets(
      'Semantics liveregion updates when expansion state changes',
      (WidgetTester tester) async {
        final SemanticsHandle handle = tester.ensureSemantics();
        const localizations = DefaultMaterialLocalizations();
        await tester.pumpWidget(
          const MaterialApp(
            home: Material(
              child: ExpansionTile(title: Text('Test Tile'), children: <Widget>[Text('Child')]),
            ),
          ),
        );

        // Initially collapsed - live region label is "Collapsed".

        SemanticsNode liveRegionSemantics = tester.getSemantics(
          find.ancestor(