Skip to content

Replace ListTile with Chip in the material/debug_test.dart #102308

@TahaTesser

Description

@TahaTesser

#102310 is adding self-contained Material to list_tile.dart to fix multiple ListTile issues.
As a result, ListTile is no longer suitable for this test, as this test needs a widget that needs to be provided Material as one of the ancestors

testWidgets('debugCheckHasMaterial control test', (WidgetTester tester) async {
await tester.pumpWidget(const ListTile());
final dynamic exception = tester.takeException();
expect(exception, isFlutterError);
final FlutterError error = exception as FlutterError;
expect(error.diagnostics.length, 5);
expect(error.diagnostics[2].level, DiagnosticLevel.hint);
expect(
error.diagnostics[2].toStringDeep(),
equalsIgnoringHashCodes(
'To introduce a Material widget, you can either directly include\n'
'one, or use a widget that contains Material itself, such as a\n'
'Card, Dialog, Drawer, or Scaffold.\n',
),
);

Solution

Replace ListTile with Chip as it needs a Material ancestor.

assert(debugCheckHasMaterial(context));

Metadata

Metadata

Assignees

Labels

a: tests"flutter test", flutter_test, or one of our testsf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions