Verify sidebar focus modes retain chat panes and drafts
This commit is contained in:
@@ -79,6 +79,40 @@ Future<void> _split(WidgetTester tester, String id, String action) async {
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('compact and hidden sidebar preserve panes and drafts', (
|
||||
tester,
|
||||
) async {
|
||||
await _setup(tester);
|
||||
await _split(tester, 'b', 'Open to the right');
|
||||
final stateA = tester.state(_thread('a'));
|
||||
final stateB = tester.state(_thread('b'));
|
||||
await tester.enterText(_input('a'), 'Keep this draft');
|
||||
final originalWidth = tester.getSize(_thread('a')).width;
|
||||
Future<void> choose(String label) async {
|
||||
await tester.tap(find.byTooltip('Chat list layout').first);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text(label));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
await choose('Compact chat list');
|
||||
expect(find.byTooltip('Expand chat list'), findsOneWidget);
|
||||
expect(tester.getSize(_thread('a')).width, greaterThan(originalWidth));
|
||||
expect(tester.state(_thread('a')), same(stateA));
|
||||
expect(tester.state(_thread('b')), same(stateB));
|
||||
await choose('Hide chat list');
|
||||
expect(find.byTooltip('Expand chat list'), findsNothing);
|
||||
expect(tester.getRect(_thread('a')).left, 0);
|
||||
expect(tester.state(_thread('a')), same(stateA));
|
||||
expect(
|
||||
tester.widget<EditableText>(_input('a')).controller.text,
|
||||
'Keep this draft',
|
||||
);
|
||||
await choose('Expanded chat list');
|
||||
expect(tester.getSize(_thread('a')).width, closeTo(originalWidth, 1));
|
||||
expect(tester.state(_thread('b')), same(stateB));
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'nested splits preserve drafts, resize, collapse and narrow restore',
|
||||
(tester) async {
|
||||
@@ -131,12 +165,21 @@ void main() {
|
||||
tester.widget<EditableText>(_input('b')).controller.text,
|
||||
'Draft B',
|
||||
);
|
||||
await tester.tap(
|
||||
find.descendant(
|
||||
of: _thread('c'),
|
||||
matching: find.byTooltip('Close pane'),
|
||||
),
|
||||
);
|
||||
final closePane = find
|
||||
.descendant(of: _thread('c'), matching: find.byTooltip('Close pane'))
|
||||
.hitTestable();
|
||||
if (closePane.evaluate().isEmpty) {
|
||||
await tester.tap(
|
||||
find.descendant(
|
||||
of: _thread('c'),
|
||||
matching: find.byTooltip('More actions'),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Close pane'));
|
||||
} else {
|
||||
await tester.tap(closePane);
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
expect(workspace.controller.paneCount, 2);
|
||||
expect(_thread('c'), findsNothing);
|
||||
|
||||
Reference in New Issue
Block a user