App: open a chat, the terminal or a diff in a new window
"Open in new window" sits beside Float: the chat pane and chat list row menus, a floating chat window's title bar, the terminal options menu and the diff bar, plus Alt+Shift+Y for the chat with the keyboard (listed in the shortcut help). Once the window opens the item leaves the main window as Float takes a pane out of the tiling. The window is its own app instance at /window/chat/<id>, /window/terminal?tab=<key> or /window/diff/<token>: only that item, named after it, with "Bring back to main window". It has its own connection and writes no shared layout (no open-chat workspace, window store or terminal layout) and posts no notifications, so they stay the main window's. Web opens a popup window (a blocked popup offers a tab); Linux and macOS start a second process with --detached (Flutter's multi-window API is still experimental); Android and iOS hide the action. The capture kit gains a follow step for windows a page opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_app.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_route.dart';
|
||||
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
||||
import 'package:pipelines_app/features/terminal/terminal_layout.dart';
|
||||
import 'package:pipelines_app/shell/detached/detached_window_scope.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
import '../chat_registration_test.dart' show webServer;
|
||||
import 'detached_fixtures.dart';
|
||||
|
||||
Future<void> _run(WidgetTester tester, ChatServer server, Duration d) async {
|
||||
for (var t = 0; t < d.inMilliseconds; t += 16) {
|
||||
server.answer();
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
}
|
||||
server.answer();
|
||||
}
|
||||
|
||||
void main() {
|
||||
late FakeDetachedPlatform platform;
|
||||
late ChatServer server;
|
||||
|
||||
Future<void> pumpChat(WidgetTester tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = const Size(720, 860);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
addTearDown(() => TerminalLayout.instance.persist = true);
|
||||
platform = FakeDetachedPlatform();
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
server = ChatServer(channel);
|
||||
await tester.pumpWidget(
|
||||
DetachedWindowApp(
|
||||
route: DetachedRoute.chat('a')!,
|
||||
server: webServer(),
|
||||
client: PipelinesClient(channelFactory: (_) => channel),
|
||||
platform: platform,
|
||||
),
|
||||
);
|
||||
await _run(tester, server, const Duration(milliseconds: 900));
|
||||
}
|
||||
|
||||
testWidgets('a detached chat is the chat pane alone, named after it', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpChat(tester);
|
||||
expect(find.byType(ChatThreadView), findsOneWidget);
|
||||
expect(find.text('Hello from chat'), findsOneWidget);
|
||||
// No shell: no navigation, no chat list, no other chat.
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
expect(find.text('Chat b'), findsNothing);
|
||||
final app = tester.widget<MaterialApp>(find.byType(MaterialApp));
|
||||
expect(app.title, 'Chat a · Pipelines');
|
||||
// Inside a detached window there is nothing to send to another one.
|
||||
final context = tester.element(find.byType(ChatThreadView));
|
||||
expect(DetachedWindowScope.maybeOf(context), isNull);
|
||||
});
|
||||
|
||||
testWidgets('a detached window writes no shared layout', (tester) async {
|
||||
await pumpChat(tester);
|
||||
expect(server.workspaceWrites, isEmpty);
|
||||
expect(
|
||||
server.requests.where((r) => r['type'] == 'chat_open_workspace'),
|
||||
isEmpty,
|
||||
reason: 'the open-chat workspace is the main window\'s',
|
||||
);
|
||||
expect(TerminalLayout.instance.persist, isFalse);
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
expect(prefs.getKeys().where((k) => k.contains('window')), isEmpty);
|
||||
expect(prefs.getString(terminalLayoutKey), isNull);
|
||||
});
|
||||
|
||||
testWidgets('Bring back hands the chat to the main window and closes', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpChat(tester);
|
||||
await tester.tap(find.byTooltip('More actions').hitTestable().first);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Bring back to main window'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(platform.sent.single, {
|
||||
'type': 'bring-back',
|
||||
'kind': 'chat',
|
||||
'id': 'a',
|
||||
});
|
||||
expect(platform.closed, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('with no main window, Bring back opens the full app here', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpChat(tester);
|
||||
platform.mainOpen = false;
|
||||
await tester.tap(find.byTooltip('More actions').hitTestable().first);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Bring back to main window'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(platform.sent, isEmpty);
|
||||
expect(platform.becameMain, '/chat/a');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:pipelines_app/application/detached/detached_platform.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_route.dart';
|
||||
import 'package:pipelines_app/shell/detached/detached_window_scope.dart';
|
||||
|
||||
import '../../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
|
||||
/// A platform that records what it was asked to open and send.
|
||||
class FakeDetachedPlatform extends DetachedPlatform {
|
||||
DetachedLaunch result = DetachedLaunch.opened;
|
||||
final launches = <({DetachedRoute route, String title, bool tab})>[];
|
||||
final stored = <String, String>{};
|
||||
final sent = <DetachedMessage>[];
|
||||
bool mainOpen = true;
|
||||
bool closed = false;
|
||||
String? becameMain;
|
||||
final incoming = StreamController<DetachedMessage>.broadcast();
|
||||
|
||||
@override
|
||||
bool get supported => true;
|
||||
|
||||
@override
|
||||
Future<DetachedLaunch> launch(
|
||||
DetachedRoute route, {
|
||||
required String title,
|
||||
required Size size,
|
||||
bool tab = false,
|
||||
}) async {
|
||||
launches.add((route: route, title: title, tab: tab));
|
||||
return tab ? DetachedLaunch.opened : result;
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<DetachedMessage> get messages => incoming.stream;
|
||||
|
||||
@override
|
||||
Future<void> put(String token, String json) async => stored[token] = json;
|
||||
|
||||
@override
|
||||
Future<String?> take(String token) async => stored[token];
|
||||
|
||||
@override
|
||||
Future<bool> sendToMain(DetachedMessage message) async {
|
||||
if (!mainOpen) return false;
|
||||
sent.add(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> closeSelf() async => closed = true;
|
||||
|
||||
@override
|
||||
Future<bool> becomeMain(String appPath) async {
|
||||
becameMain = appPath;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// An opener that records the items and opens them at once.
|
||||
class FakeOpener implements DetachedWindowOpener {
|
||||
final chats = <String>[];
|
||||
final terminals = <String>[];
|
||||
final diffs = <List<Map<String, Object?>>>[];
|
||||
bool opens = true;
|
||||
|
||||
@override
|
||||
void openChat(
|
||||
String sessionId, {
|
||||
required String title,
|
||||
void Function()? onOpened,
|
||||
}) {
|
||||
chats.add(sessionId);
|
||||
if (opens) onOpened?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void openTerminal({
|
||||
String tabKey = '',
|
||||
required String title,
|
||||
void Function()? onOpened,
|
||||
}) {
|
||||
terminals.add(tabKey);
|
||||
if (opens) onOpened?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void openDiff(
|
||||
List<Map<String, Object?>> files, {
|
||||
int initialIndex = 0,
|
||||
required String title,
|
||||
void Function()? onOpened,
|
||||
}) {
|
||||
diffs.add(files);
|
||||
if (opens) onOpened?.call();
|
||||
}
|
||||
}
|
||||
|
||||
/// Answers a chat app's requests over [channel] like a server with chats
|
||||
/// a, b and c, recording each request (type and body).
|
||||
class ChatServer {
|
||||
ChatServer(this.channel, {List<Object?> openChats = const []})
|
||||
: _entries = openChats;
|
||||
|
||||
final FakeChannel channel;
|
||||
final _answered = <Object?>{};
|
||||
final requests = <Map<String, dynamic>>[];
|
||||
List<Object?> _entries;
|
||||
int _revision = 1;
|
||||
|
||||
/// The open-chat writes the app sent (`chat_open_workspace_request`).
|
||||
List<Map<String, dynamic>> get workspaceWrites => [
|
||||
for (final request in requests)
|
||||
if (request['type'] == 'chat_open_workspace' &&
|
||||
request['chat_open_workspace_request'] != null)
|
||||
request,
|
||||
];
|
||||
|
||||
void answer() {
|
||||
for (final raw in channel.outgoing.toList()) {
|
||||
final m = jsonDecode(raw as String) as Map<String, dynamic>;
|
||||
final id = m['id'];
|
||||
if (id == null || !_answered.add(id)) continue;
|
||||
requests.add(m);
|
||||
channel.incoming.add(jsonEncode(_reply('${m['type']}', id, m)));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object?> _reply(String type, Object? id, Map<String, dynamic> m) {
|
||||
switch (type) {
|
||||
case 'chat_sessions':
|
||||
return {
|
||||
'id': id,
|
||||
'type': type,
|
||||
'chat_sessions': [
|
||||
for (final s in const ['a', 'b', 'c'])
|
||||
{
|
||||
'id': s,
|
||||
'title': 'Chat $s',
|
||||
'directory': '/workspace/demo',
|
||||
'updated_at': '2026-11-12T10:00:00Z',
|
||||
},
|
||||
],
|
||||
};
|
||||
case 'chat_messages':
|
||||
return {
|
||||
'id': id,
|
||||
'type': 'chat_history',
|
||||
'chat_history': {
|
||||
'messages': [
|
||||
{
|
||||
'id': 'm0',
|
||||
'role': 'user',
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'Hello from chat'},
|
||||
],
|
||||
},
|
||||
],
|
||||
'next_cursor': '',
|
||||
'has_more': false,
|
||||
},
|
||||
};
|
||||
case 'chat_open_workspace':
|
||||
final write = m['chat_open_workspace_request'] as Map?;
|
||||
if (write != null) {
|
||||
_revision++;
|
||||
_entries = write['entries'] as List<Object?>;
|
||||
}
|
||||
return {
|
||||
'id': id,
|
||||
'type': type,
|
||||
'chat_open_workspace': {'revision': _revision, 'entries': _entries},
|
||||
};
|
||||
default:
|
||||
return {'id': id, 'type': type};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_route.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_windows.dart';
|
||||
import 'package:pipelines_app/application/pipelines_app.dart';
|
||||
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
||||
import 'package:pipelines_app/shell/detached/detached_window_scope.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
import '../chat_registration_test.dart' show webServer;
|
||||
import 'detached_fixtures.dart';
|
||||
|
||||
Future<void> _run(WidgetTester tester, ChatServer server, Duration d) async {
|
||||
for (var t = 0; t < d.inMilliseconds; t += 16) {
|
||||
server.answer();
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
}
|
||||
server.answer();
|
||||
}
|
||||
|
||||
void main() {
|
||||
Future<(ChatServer, FakeDetachedPlatform)> pump(
|
||||
WidgetTester tester, {
|
||||
String route = '/chat/a',
|
||||
}) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = const Size(1600, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final platform = FakeDetachedPlatform();
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final server = ChatServer(
|
||||
channel,
|
||||
openChats: [
|
||||
{'session_id': 'a'},
|
||||
],
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse(route)),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
androidSupported: false,
|
||||
server: webServer(),
|
||||
client: PipelinesClient(channelFactory: (_) => channel),
|
||||
routeInformationProvider: provider,
|
||||
detachedPlatform: platform,
|
||||
),
|
||||
);
|
||||
await _run(tester, server, const Duration(milliseconds: 1200));
|
||||
return (server, platform);
|
||||
}
|
||||
|
||||
testWidgets('the main window offers new windows and sends the chat out of '
|
||||
'its workspace', (tester) async {
|
||||
final (server, platform) = await pump(tester);
|
||||
final thread = find.byType(ChatThreadView);
|
||||
expect(thread, findsOneWidget);
|
||||
expect(DetachedWindowScope.maybeOf(tester.element(thread)), isNotNull);
|
||||
await tester.tap(
|
||||
find
|
||||
.descendant(of: thread, matching: find.byTooltip('More actions'))
|
||||
.hitTestable(),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Open in new window (Alt+Shift+Y)'));
|
||||
await _run(tester, server, const Duration(milliseconds: 600));
|
||||
expect(platform.launches.single.route, DetachedRoute.chat('a'));
|
||||
expect(platform.launches.single.title, 'Chat a');
|
||||
expect(find.byType(ChatThreadView), findsNothing);
|
||||
// The main window's own workspace is written without the chat.
|
||||
final write = server.workspaceWrites.last['chat_open_workspace_request'];
|
||||
expect((write as Map)['entries'], isEmpty);
|
||||
});
|
||||
|
||||
testWidgets('a chat brought back opens in the main window', (tester) async {
|
||||
final (server, platform) = await pump(tester, route: '/runs');
|
||||
expect(find.byType(ChatThreadView), findsNothing);
|
||||
platform.incoming.add(
|
||||
const DetachedReturn(DetachedKind.chat, 'b').toMessage(),
|
||||
);
|
||||
await _run(tester, server, const Duration(milliseconds: 900));
|
||||
final thread = tester.widget<ChatThreadView>(find.byType(ChatThreadView));
|
||||
expect(thread.sessionId, 'b');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_platform.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_route.dart';
|
||||
|
||||
void main() {
|
||||
test('each kind round-trips through its path', () {
|
||||
final routes = [
|
||||
DetachedRoute.chat('sess_01-A')!,
|
||||
DetachedRoute.terminal(),
|
||||
DetachedRoute.terminal('mac/term 1'),
|
||||
DetachedRoute.diff('Tok_en-9')!,
|
||||
];
|
||||
for (final route in routes) {
|
||||
expect(DetachedRoute.parse(route.path), route, reason: route.path);
|
||||
}
|
||||
expect(DetachedRoute.chat('a')!.path, '/window/chat/a');
|
||||
expect(DetachedRoute.terminal().path, '/window/terminal');
|
||||
expect(
|
||||
DetachedRoute.terminal('server/t1').path,
|
||||
'/window/terminal?tab=server%2Ft1',
|
||||
);
|
||||
expect(DetachedRoute.diff('abc')!.path, '/window/diff/abc');
|
||||
});
|
||||
|
||||
test('a full URL with an origin and fixture parameters parses', () {
|
||||
final route = DetachedRoute.parse(
|
||||
'https://tank.example.ts.net/window/chat/perf-chat-0?chats=2&theme=dark',
|
||||
);
|
||||
expect(route, DetachedRoute.chat('perf-chat-0'));
|
||||
expect(
|
||||
DetachedRoute.parse('http://x/window/terminal?tab=s%2F7&theme=dark'),
|
||||
DetachedRoute.terminal('s/7'),
|
||||
);
|
||||
});
|
||||
|
||||
test('ordinary app locations and malformed windows are not detached', () {
|
||||
for (final location in [
|
||||
'/',
|
||||
'/chat/a',
|
||||
'/runs/7',
|
||||
'/window',
|
||||
'/window/chat',
|
||||
'/window/chat/a/b',
|
||||
'/window/chat/not%20valid',
|
||||
'/window/diff/has.dot',
|
||||
'/window/diff/${'x' * 65}',
|
||||
'/window/pipelines/3',
|
||||
'/windows/chat/a',
|
||||
'',
|
||||
]) {
|
||||
expect(DetachedRoute.parse(location), isNull, reason: location);
|
||||
}
|
||||
expect(DetachedRoute.chat('no spaces'), isNull);
|
||||
expect(DetachedRoute.diff(''), isNull);
|
||||
expect(DetachedRoute.terminal('k' * 600).id, isEmpty);
|
||||
});
|
||||
|
||||
test('a native launch names its window by argument or environment', () {
|
||||
final chat = DetachedRoute.chat('a');
|
||||
expect(DetachedRoute.fromLaunch(['--detached', '/window/chat/a']), chat);
|
||||
expect(DetachedRoute.fromLaunch(['--detached=/window/chat/a']), chat);
|
||||
expect(
|
||||
DetachedRoute.fromLaunch(const [], {
|
||||
'PIPELINES_DETACHED': '/window/terminal',
|
||||
}),
|
||||
DetachedRoute.terminal(),
|
||||
);
|
||||
expect(DetachedRoute.fromLaunch(const []), isNull);
|
||||
expect(
|
||||
DetachedRoute.fromLaunch(const [], {'PIPELINES_DETACHED': ''}),
|
||||
isNull,
|
||||
);
|
||||
expect(DetachedRoute.fromLaunch(['--detached']), isNull);
|
||||
});
|
||||
|
||||
test('messages carry a marker; anything else is ignored', () {
|
||||
final text = encodeDetachedMessage({'type': 'bring-back', 'id': 'a'});
|
||||
expect(decodeDetachedMessage(text), {'type': 'bring-back', 'id': 'a'});
|
||||
expect(decodeDetachedMessage('{"type":"bring-back"}'), isNull);
|
||||
expect(decodeDetachedMessage('not json'), isNull);
|
||||
expect(decodeDetachedMessage('[1]'), isNull);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_platform.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_route.dart';
|
||||
import 'package:pipelines_app/application/detached/detached_windows.dart';
|
||||
|
||||
import 'detached_fixtures.dart';
|
||||
|
||||
void main() {
|
||||
late FakeDetachedPlatform platform;
|
||||
late List<DetachedReturn> returned;
|
||||
late GlobalKey<ScaffoldMessengerState> messenger;
|
||||
late DetachedWindows windows;
|
||||
|
||||
setUp(() {
|
||||
platform = FakeDetachedPlatform();
|
||||
returned = [];
|
||||
messenger = GlobalKey<ScaffoldMessengerState>();
|
||||
windows = DetachedWindows(
|
||||
platform: platform,
|
||||
onReturn: returned.add,
|
||||
messenger: messenger,
|
||||
)..start();
|
||||
});
|
||||
tearDown(() => windows.dispose());
|
||||
|
||||
Future<void> host(WidgetTester tester) => tester.pumpWidget(
|
||||
MaterialApp(
|
||||
scaffoldMessengerKey: messenger,
|
||||
home: const Scaffold(body: SizedBox()),
|
||||
),
|
||||
);
|
||||
|
||||
testWidgets('an opened window runs onOpened; the item leaves after', (
|
||||
tester,
|
||||
) async {
|
||||
await host(tester);
|
||||
var opened = 0;
|
||||
windows.openChat('a', title: 'Chat a', onOpened: () => opened++);
|
||||
await tester.pump();
|
||||
expect(platform.launches.single.route, DetachedRoute.chat('a'));
|
||||
expect(platform.launches.single.title, 'Chat a');
|
||||
expect(opened, 1);
|
||||
|
||||
windows.openTerminal(tabKey: 's/1', title: 'Terminal: zsh');
|
||||
await tester.pump();
|
||||
expect(platform.launches.last.route, DetachedRoute.terminal('s/1'));
|
||||
});
|
||||
|
||||
testWidgets('a blocked popup says so and offers a tab, which opens it', (
|
||||
tester,
|
||||
) async {
|
||||
await host(tester);
|
||||
platform.result = DetachedLaunch.blocked;
|
||||
var opened = 0;
|
||||
windows.openChat('a', title: 'Chat a', onOpened: () => opened++);
|
||||
await tester.pumpAndSettle();
|
||||
expect(opened, 0, reason: 'nothing leaves the main window yet');
|
||||
expect(find.textContaining('blocked the new window'), findsOneWidget);
|
||||
await tester.tap(find.text('Open in tab'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(platform.launches.last.tab, isTrue);
|
||||
expect(opened, 1);
|
||||
});
|
||||
|
||||
testWidgets('a failure is reported and the item stays', (tester) async {
|
||||
await host(tester);
|
||||
platform.result = DetachedLaunch.failed;
|
||||
var opened = 0;
|
||||
windows.openChat('a', title: 'Chat a', onOpened: () => opened++);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Could not open a new window.'), findsOneWidget);
|
||||
expect(opened, 0);
|
||||
});
|
||||
|
||||
testWidgets('a diff is handed over under its token before it opens', (
|
||||
tester,
|
||||
) async {
|
||||
await host(tester);
|
||||
windows.openDiff(
|
||||
[
|
||||
{'path': 'lib/a.dart', 'kind': 'modified'},
|
||||
],
|
||||
initialIndex: 0,
|
||||
title: 'a.dart',
|
||||
);
|
||||
await tester.pump();
|
||||
final route = platform.launches.single.route;
|
||||
expect(route.kind, DetachedKind.diff);
|
||||
final stored = jsonDecode(platform.stored[route.id]!) as Map;
|
||||
expect((stored['files'] as List).single['path'], 'lib/a.dart');
|
||||
});
|
||||
|
||||
testWidgets('items a detached window gives back reach the main window', (
|
||||
tester,
|
||||
) async {
|
||||
await host(tester);
|
||||
const diff = DetachedReturn(
|
||||
DetachedKind.diff,
|
||||
'tok',
|
||||
files: [
|
||||
{'path': 'a', 'kind': 'added'},
|
||||
],
|
||||
initialIndex: 0,
|
||||
);
|
||||
platform.incoming
|
||||
..add(const DetachedReturn(DetachedKind.chat, 'a').toMessage())
|
||||
..add(diff.toMessage())
|
||||
..add({'type': 'something else'});
|
||||
await tester.pump();
|
||||
expect(returned.map((r) => (r.kind, r.id)), [
|
||||
(DetachedKind.chat, 'a'),
|
||||
(DetachedKind.diff, 'tok'),
|
||||
]);
|
||||
expect(returned.last.files.single['path'], 'a');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user