Remove Cupertino settings branches
Keep the Material settings implementation while preserving public Cupertino parameters for later cleanup. Narrow settings tests to the Material-only behavior.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/servers/server_scope.dart';
|
||||
@@ -11,11 +10,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'settings_topic_test_helper.dart';
|
||||
|
||||
Widget host({
|
||||
bool cupertino = false,
|
||||
String? scope,
|
||||
SettingsTopicStore? store,
|
||||
}) {
|
||||
Widget host({String? scope, SettingsTopicStore? store}) {
|
||||
final tabs = SettingsTopicTabs(
|
||||
navigationScope: scope,
|
||||
selectionStore: store,
|
||||
@@ -24,9 +19,7 @@ Widget host({
|
||||
topic: (_) => Text('${topic.name} page'),
|
||||
},
|
||||
);
|
||||
return cupertino
|
||||
? CupertinoApp(home: CupertinoPageScaffold(child: tabs))
|
||||
: MaterialApp(home: Scaffold(body: tabs));
|
||||
return MaterialApp(home: Scaffold(body: tabs));
|
||||
}
|
||||
|
||||
class DelayedStore implements SettingsTopicStore {
|
||||
@@ -67,26 +60,22 @@ class SharedQueuedTopicStore implements SettingsTopicStore {
|
||||
}
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('restores selected category after recreation ($cupertino)', (
|
||||
tester,
|
||||
) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
await tester.pumpWidget(host(cupertino: cupertino, scope: 'server-a'));
|
||||
await tester.pumpAndSettle();
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
expect(find.text('connection page'), findsOneWidget);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pumpWidget(host(cupertino: cupertino, scope: 'server-a'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('connection page'), findsOneWidget);
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
expect(
|
||||
preferences.getString(scopedServerKey(settingsTopicKey, 'server-a')),
|
||||
'connection',
|
||||
);
|
||||
});
|
||||
}
|
||||
testWidgets('restores selected category after recreation', (tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
await tester.pumpWidget(host(scope: 'server-a'));
|
||||
await tester.pumpAndSettle();
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
expect(find.text('connection page'), findsOneWidget);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pumpWidget(host(scope: 'server-a'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('connection page'), findsOneWidget);
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
expect(
|
||||
preferences.getString(scopedServerKey(settingsTopicKey, 'server-a')),
|
||||
'connection',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('server scopes and malformed selections are independent', (
|
||||
tester,
|
||||
|
||||
Reference in New Issue
Block a user