feat(app): left/right arrows step through artifacts and changed files
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/changes/domain/change_kind.dart';
|
||||
import 'package:pipelines_app/features/changes/domain/file_change.dart';
|
||||
import 'package:pipelines_app/features/changes/widgets/file_diff_viewer.dart';
|
||||
|
||||
FileChange _file(String path) => FileChange(
|
||||
path: path,
|
||||
kind: ChangeKind.modified,
|
||||
patch: '--- a/$path\n+++ b/$path\n@@ -1 +1 @@\n-a\n+b\n',
|
||||
);
|
||||
|
||||
void main() {
|
||||
testWidgets('left and right arrows step between changed files', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: FileDiffPage(
|
||||
files: [_file('lib/one.dart'), _file('lib/two.dart')],
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('one.dart'), findsWidgets);
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('two.dart'), findsWidgets);
|
||||
|
||||
// The last file stays put; left goes back.
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('two.dart'), findsWidgets);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('one.dart'), findsWidgets);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user