Remove Cupertino chat workspace branches
Keep the app's Material-only chat workspace path while retaining public cupertino parameters for callers. Narrow the affected widget tests to the supported Material host.
This commit is contained in:
@@ -192,6 +192,13 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
expect(find.byType(ChatCenterStageStrip), findsNWidgets(2));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(ChatCenterStageStrip).first,
|
||||
matching: find.byType(InkWell),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('draft'), findsOneWidget);
|
||||
|
||||
stage.value = false;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_mobile_panes.dart';
|
||||
@@ -36,54 +35,48 @@ class _ThreadState extends State<_Thread> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
for (final height in [32.0, 48.0]) {
|
||||
testWidgets(
|
||||
'peek title and switch fit $height height at 2x ($cupertino)',
|
||||
(tester) async {
|
||||
var activated = 0;
|
||||
Size? bodySize;
|
||||
final viewport = MediaQuery(
|
||||
data: const MediaQueryData(textScaler: TextScaler.linear(2)),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: 320,
|
||||
height: height,
|
||||
child: ChatMobilePaneViewport(
|
||||
peek: true,
|
||||
active: false,
|
||||
barReveal: const AlwaysStoppedAnimation(0),
|
||||
onActivate: () => activated++,
|
||||
label: 'A long working project name',
|
||||
paneId: 'first',
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
bodySize = constraints.biggest;
|
||||
return const SizedBox.expand();
|
||||
},
|
||||
),
|
||||
),
|
||||
for (final height in [32.0, 48.0]) {
|
||||
testWidgets('peek title and switch fit $height height at 2x', (
|
||||
tester,
|
||||
) async {
|
||||
var activated = 0;
|
||||
Size? bodySize;
|
||||
final viewport = MediaQuery(
|
||||
data: const MediaQueryData(textScaler: TextScaler.linear(2)),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: 320,
|
||||
height: height,
|
||||
child: ChatMobilePaneViewport(
|
||||
peek: true,
|
||||
active: false,
|
||||
barReveal: const AlwaysStoppedAnimation(0),
|
||||
onActivate: () => activated++,
|
||||
label: 'A long working project name',
|
||||
paneId: 'first',
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
bodySize = constraints.biggest;
|
||||
return const SizedBox.expand();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: CupertinoPageScaffold(child: viewport))
|
||||
: MaterialApp(home: Scaffold(body: viewport)),
|
||||
);
|
||||
expect(find.text('A long working project name'), findsOneWidget);
|
||||
expect(find.text('Switch'), findsOneWidget);
|
||||
final headerSize = tester.getSize(find.byType(ChatPeekHeader));
|
||||
expect(headerSize.height, lessThanOrEqualTo(height));
|
||||
expect(bodySize!.height, closeTo(height - headerSize.height, .01));
|
||||
await tester.tap(find.text('Switch'));
|
||||
await tester.pump();
|
||||
expect(activated, 1);
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
await tester.pumpWidget(MaterialApp(home: Scaffold(body: viewport)));
|
||||
expect(find.text('A long working project name'), findsOneWidget);
|
||||
expect(find.text('Switch'), findsOneWidget);
|
||||
expect(find.byType(TextButton), findsOneWidget);
|
||||
final headerSize = tester.getSize(find.byType(ChatPeekHeader));
|
||||
expect(headerSize.height, lessThanOrEqualTo(height));
|
||||
expect(bodySize!.height, closeTo(height - headerSize.height, .01));
|
||||
await tester.tap(find.text('Switch'));
|
||||
await tester.pump();
|
||||
expect(activated, 1);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
testWidgets('peek header reserves real body space and keeps reading state', (
|
||||
tester,
|
||||
|
||||
@@ -3,56 +3,47 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace_entrance.dart';
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('retained entrance moves the same child ($cupertino)', (
|
||||
tester,
|
||||
) async {
|
||||
tester.platformDispatcher.accessibilityFeaturesTestValue =
|
||||
const FakeAccessibilityFeatures(disableAnimations: false);
|
||||
addTearDown(
|
||||
tester.platformDispatcher.clearAccessibilityFeaturesTestValue,
|
||||
);
|
||||
final childKey = GlobalKey();
|
||||
final child = TextField(key: childKey);
|
||||
Widget host(bool visible, {bool reduced = false}) => MaterialApp(
|
||||
home: MediaQuery(
|
||||
data: MediaQueryData(disableAnimations: reduced),
|
||||
child: SizedBox.expand(
|
||||
child: ChatWorkspaceEntrance(
|
||||
visible: visible,
|
||||
cupertino: cupertino,
|
||||
child: Material(child: child),
|
||||
),
|
||||
testWidgets('retained entrance moves the same child', (tester) async {
|
||||
tester.platformDispatcher.accessibilityFeaturesTestValue =
|
||||
const FakeAccessibilityFeatures(disableAnimations: false);
|
||||
addTearDown(tester.platformDispatcher.clearAccessibilityFeaturesTestValue);
|
||||
final childKey = GlobalKey();
|
||||
final child = TextField(key: childKey);
|
||||
Widget host(bool visible, {bool reduced = false}) => MaterialApp(
|
||||
home: MediaQuery(
|
||||
data: MediaQueryData(disableAnimations: reduced),
|
||||
child: SizedBox.expand(
|
||||
child: ChatWorkspaceEntrance(
|
||||
visible: visible,
|
||||
cupertino: false,
|
||||
child: Material(child: child),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(host(false));
|
||||
final element = childKey.currentContext;
|
||||
final state = childKey.currentState;
|
||||
expect(find.byKey(childKey), findsNothing);
|
||||
await tester.pumpWidget(host(true));
|
||||
final start = tester.getTopLeft(find.byKey(childKey));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 80));
|
||||
final middle = tester.getTopLeft(find.byKey(childKey));
|
||||
await tester.pumpAndSettle();
|
||||
final end = tester.getTopLeft(find.byKey(childKey));
|
||||
expect(cupertino ? middle.dx : middle.dy, greaterThan(0));
|
||||
expect(
|
||||
cupertino ? middle.dx : middle.dy,
|
||||
lessThan(cupertino ? start.dx : start.dy),
|
||||
);
|
||||
expect(end, Offset.zero);
|
||||
expect(childKey.currentContext, same(element));
|
||||
expect(childKey.currentState, same(state));
|
||||
await tester.enterText(find.byType(TextField), 'Retained draft');
|
||||
await tester.pumpWidget(host(false));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pumpWidget(host(true, reduced: true));
|
||||
expect(tester.getTopLeft(find.byKey(childKey)), Offset.zero);
|
||||
expect(find.text('Retained draft'), findsOneWidget);
|
||||
expect(childKey.currentState, same(state));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(host(false));
|
||||
final element = childKey.currentContext;
|
||||
final state = childKey.currentState;
|
||||
expect(find.byKey(childKey), findsNothing);
|
||||
await tester.pumpWidget(host(true));
|
||||
final start = tester.getTopLeft(find.byKey(childKey));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 80));
|
||||
final middle = tester.getTopLeft(find.byKey(childKey));
|
||||
await tester.pumpAndSettle();
|
||||
final end = tester.getTopLeft(find.byKey(childKey));
|
||||
expect(middle.dy, greaterThan(0));
|
||||
expect(middle.dy, lessThan(start.dy));
|
||||
expect(end, Offset.zero);
|
||||
expect(childKey.currentContext, same(element));
|
||||
expect(childKey.currentState, same(state));
|
||||
await tester.enterText(find.byType(TextField), 'Retained draft');
|
||||
await tester.pumpWidget(host(false));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pumpWidget(host(true, reduced: true));
|
||||
expect(tester.getTopLeft(find.byKey(childKey)), Offset.zero);
|
||||
expect(find.text('Retained draft'), findsOneWidget);
|
||||
expect(childKey.currentState, same(state));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user