mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 10:17:47 +08:00
tabs => tab_label
This commit is contained in:
43
test/widgets/tab_label_test.dart
Normal file
43
test/widgets/tab_label_test.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:apidash/widgets/tab_label.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('TabLabel shows indicator when showIndicator is true',
|
||||
(tester) async {
|
||||
const String labelText = 'URL Params';
|
||||
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: TabLabel(
|
||||
text: labelText,
|
||||
showIndicator: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text(labelText), findsOneWidget);
|
||||
expect(find.byIcon(Icons.circle), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('TabLabel does not show indicator when showIndicator is false',
|
||||
(tester) async {
|
||||
const String labelText = 'Request';
|
||||
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: TabLabel(
|
||||
text: labelText,
|
||||
showIndicator: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text(labelText), findsOneWidget);
|
||||
expect(find.byIcon(Icons.circle), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user