diff --git a/dev/bots/check_code_samples.dart b/dev/bots/check_code_samples.dart index afe26431fdfc..8681d7842201 100644 --- a/dev/bots/check_code_samples.dart +++ b/dev/bots/check_code_samples.dart @@ -339,7 +339,6 @@ final Set _knownMissingTests = { 'examples/api/test/material/text_form_field/text_form_field.1_test.dart', 'examples/api/test/material/scrollbar/scrollbar.1_test.dart', 'examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart', - 'examples/api/test/material/radio/radio.toggleable.0_test.dart', 'examples/api/test/material/search_anchor/search_anchor.0_test.dart', 'examples/api/test/material/search_anchor/search_anchor.1_test.dart', 'examples/api/test/material/search_anchor/search_anchor.2_test.dart', diff --git a/examples/api/test/material/radio/radio.toggleable.0_test.dart b/examples/api/test/material/radio/radio.toggleable.0_test.dart new file mode 100644 index 000000000000..9b071ad9b16b --- /dev/null +++ b/examples/api/test/material/radio/radio.toggleable.0_test.dart @@ -0,0 +1,32 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/material.dart'; +import 'package:flutter_api_samples/material/radio/radio.toggleable.0.dart' + as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { + await tester.pumpWidget( + const example.ToggleableExampleApp(), + ); + + expect(find.byType(Radio), findsExactly(5)); + expect(find.text('Hercules Mulligan'), findsOne); + expect(find.text('Eliza Hamilton'), findsOne); + expect(find.text('Philip Schuyler'), findsOne); + expect(find.text('Maria Reynolds'), findsOne); + expect(find.text('Samuel Seabury'), findsOne); + + for (int i = 0; i < 5; i++) { + await tester.tap(find.byType(Radio).at(i)); + await tester.pump(); + expect( + find.byWidgetPredicate((Widget widget) => widget is Radio && widget.groupValue == i), + findsExactly(5), + ); + } + }); +}