TermRemoteCtl/apps/mobile_app/test/features/terminal/terminal_controller_test.dart

27 lines
882 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:term_remote_ctl/features/terminal/terminal_controller.dart';
import 'package:term_remote_ctl/features/terminal/history_window.dart';
void main() {
test('entering scrollback keeps live follow disabled after new output', () {
final controller = TerminalController();
controller.enterScrollback();
controller.applyFrame('new output');
expect(controller.isFollowingLiveOutput, isFalse);
});
test('loading history seeds the scrollback window and visible lines', () {
final controller = TerminalController();
controller.loadHistory(
const HistoryWindow(lines: ['one', 'two'], hasMoreAbove: true),
);
expect(controller.historyWindow.lines, ['one', 'two']);
expect(controller.historyWindow.hasMoreAbove, isTrue);
expect(controller.liveLines, ['one', 'two']);
});
}