c264f865ff
A saved server still named by the app ('My server', 'This server',
'Original legacy server' or its address host/IP) takes the hostname the
machine reports in get_status the first time the app connects; typed
names are kept. New servers (legacy migration, Settings with a blank
name, onboarding) start with the address host. A browser on its page
origin with no saved profile shows the reported hostname too. No server
change: get_status already reports the hostname.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
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);
|
|
});
|
|
}
|