Skip to content

Commit 2e27503

Browse files
Add test for radio.toggleable.0.dart (flutter#149153)
Contributes to flutter#130459 It adds a test for - `examples/api/lib/material/radio/radio.toggleable.0.dart`
1 parent 557fca4 commit 2e27503

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

dev/bots/check_code_samples.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ final Set<String> _knownMissingTests = <String>{
339339
'examples/api/test/material/text_form_field/text_form_field.1_test.dart',
340340
'examples/api/test/material/scrollbar/scrollbar.1_test.dart',
341341
'examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart',
342-
'examples/api/test/material/radio/radio.toggleable.0_test.dart',
343342
'examples/api/test/material/search_anchor/search_anchor.0_test.dart',
344343
'examples/api/test/material/search_anchor/search_anchor.1_test.dart',
345344
'examples/api/test/material/search_anchor/search_anchor.2_test.dart',
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/material.dart';
6+
import 'package:flutter_api_samples/material/radio/radio.toggleable.0.dart'
7+
as example;
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
void main() {
11+
testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async {
12+
await tester.pumpWidget(
13+
const example.ToggleableExampleApp(),
14+
);
15+
16+
expect(find.byType(Radio<int>), findsExactly(5));
17+
expect(find.text('Hercules Mulligan'), findsOne);
18+
expect(find.text('Eliza Hamilton'), findsOne);
19+
expect(find.text('Philip Schuyler'), findsOne);
20+
expect(find.text('Maria Reynolds'), findsOne);
21+
expect(find.text('Samuel Seabury'), findsOne);
22+
23+
for (int i = 0; i < 5; i++) {
24+
await tester.tap(find.byType(Radio<int>).at(i));
25+
await tester.pump();
26+
expect(
27+
find.byWidgetPredicate((Widget widget) => widget is Radio<int> && widget.groupValue == i),
28+
findsExactly(5),
29+
);
30+
}
31+
});
32+
}

0 commit comments

Comments
 (0)