d1b05217c9
Keep the pipeline feature on its existing Material path because the app runs under MaterialApp and never selects Cupertino hosts. Preserve public cupertino parameters and required Cupertino icon values for later cleanup and shared controls.
59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/pipelines/widgets/pipeline_scope_control.dart';
|
|
|
|
void main() {
|
|
for (final width in [120.0, 500.0]) {
|
|
testWidgets('native scope remains usable at $width', (tester) async {
|
|
var scope = PipelineScope.all;
|
|
final control = StatefulBuilder(
|
|
builder: (context, setState) => Center(
|
|
child: SizedBox(
|
|
width: width,
|
|
child: PipelineScopeControl(
|
|
scope: scope,
|
|
onSelected: (value) => setState(() => scope = value),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: control)));
|
|
await tester.pumpAndSettle();
|
|
if (width == 120) {
|
|
await tester.tap(find.byKey(const Key('pipeline-scope')));
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.text('Scheduled').last);
|
|
} else {
|
|
await tester.tap(find.text('Scheduled'));
|
|
}
|
|
await tester.pumpAndSettle();
|
|
expect(scope, PipelineScope.scheduled);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|
|
|
|
testWidgets('wide scope control hugs its labels', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: SizedBox(
|
|
width: 500,
|
|
child: Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: PipelineScopeControl(
|
|
scope: PipelineScope.all,
|
|
onSelected: (_) {},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(
|
|
tester.getSize(find.byKey(const Key('pipeline-scope'))).width,
|
|
lessThan(500),
|
|
);
|
|
});
|
|
}
|