Match chat terminal buttons to responsive UI
Remove the duplicate terminal action from narrow shell bars and expose the terminal in open chat bars only where appropriate. Use the shared plain bar-button styling and add focused light/dark responsive widget coverage.
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/app_terminals.dart';
|
||||
import 'package:pipelines_app/features/terminal/terminal_layout.dart';
|
||||
import 'package:pipelines_app/features/terminal/terminal_toggle_button.dart';
|
||||
|
||||
import '../features/terminal/terminal_fixtures.dart';
|
||||
|
||||
void main() {
|
||||
late TerminalGateway gateway;
|
||||
late AppTerminals terminals;
|
||||
|
||||
setUp(() {
|
||||
gateway = TerminalGateway();
|
||||
terminals = AppTerminals(
|
||||
pool: null,
|
||||
connection: ValueNotifier<int>(0),
|
||||
connected: () => true,
|
||||
gateway: gateway,
|
||||
machineId: 'mac',
|
||||
machineName: 'Mac',
|
||||
layout: TerminalLayout(store: MemoryLayoutStore()),
|
||||
);
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
terminals.dispose();
|
||||
gateway.close();
|
||||
});
|
||||
|
||||
/// Pumps [AppTerminals.barToggle] at [width] and returns what it built.
|
||||
Future<Widget?> barToggleAt(WidgetTester tester, double width) async {
|
||||
Widget? built;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: MediaQuery(
|
||||
data: MediaQueryData(size: Size(width, 800)),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
built = terminals.barToggle(context);
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return built;
|
||||
}
|
||||
|
||||
testWidgets('the Chat shell bar offers the terminal toggle on a wide layout', (
|
||||
tester,
|
||||
) async {
|
||||
final built = await barToggleAt(tester, 1000);
|
||||
expect(built, isA<TerminalToggleButton>());
|
||||
});
|
||||
|
||||
testWidgets('a narrow layout has no terminal toggle in the shell bar', (
|
||||
tester,
|
||||
) async {
|
||||
// Covers both a narrow chat list and an open narrow chat: the open chat's
|
||||
// own bar carries the terminal (terminal_chat_bar_action_test.dart).
|
||||
final built = await barToggleAt(tester, 390);
|
||||
expect(built, isNull);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user