forked from eatvio/eatvio_app
feat(video_calls, welcome_screen): ios mic fix, welcome scrin layoute fix
This commit is contained in:
@@ -3,8 +3,9 @@ import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/create_plan/presentation/cubit/create_plan_cubit.dart';
|
||||
import 'package:eatvio_app/features/create_plan/presentation/cubit/create_plan_state.dart';
|
||||
import 'package:eatvio_app/features/create_plan/presentation/widgets/option_widget.dart';
|
||||
import 'package:eatvio_app/features/create_plan/presentation/widgets/select_exact_option_widget.dart';
|
||||
import 'package:eatvio_app/features/create_plan/repositories/create_plan_repository.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -12,12 +13,7 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_portal/flutter_portal.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'option_widget_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<CreatePlanCubit>()])
|
||||
void main() {
|
||||
group('OptionWidget smoke', () {
|
||||
setUpAll(() async {
|
||||
@@ -47,18 +43,8 @@ void main() {
|
||||
tester.view.physicalSize = const Size(800, 1200);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
|
||||
final cubit = MockCreatePlanCubit();
|
||||
final state = CreatePlanState.initial();
|
||||
|
||||
when(cubit.state).thenReturn(state);
|
||||
when(cubit.stream).thenAnswer((_) => Stream.value(state));
|
||||
when(cubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(cubit.setOptionTitle(any)).thenReturn(null);
|
||||
when(cubit.setOptionDescription(any)).thenReturn(null);
|
||||
when(cubit.setPrice(any)).thenReturn(null);
|
||||
when(cubit.setOptionContent(any, any)).thenReturn(null);
|
||||
when(cubit.removeOptionContentItem(any)).thenReturn(null);
|
||||
when(cubit.togglePersonalizedDietOptionState()).thenReturn(null);
|
||||
final cubit = CreatePlanCubit(createPlanRepository: _FakeCreatePlanRepository());
|
||||
addTearDown(cubit.close);
|
||||
|
||||
await tester.pumpWidget(BlocProvider<CreatePlanCubit>.value(value: cubit, child: wrap(const OptionWidget())));
|
||||
await tester.pump();
|
||||
@@ -66,5 +52,61 @@ void main() {
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('keeps title and price independent when switching options', (tester) async {
|
||||
tester.view.physicalSize = const Size(800, 1600);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
|
||||
final cubit = CreatePlanCubit(createPlanRepository: _FakeCreatePlanRepository());
|
||||
cubit.setSelectedOptionIndex(0);
|
||||
addTearDown(cubit.close);
|
||||
|
||||
await tester.pumpWidget(
|
||||
BlocProvider<CreatePlanCubit>.value(
|
||||
value: cubit,
|
||||
child: wrap(
|
||||
const Column(
|
||||
children: [
|
||||
SelectExactOptionWidget(),
|
||||
Expanded(child: SingleChildScrollView(child: OptionWidget())),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 50));
|
||||
|
||||
final firstFields = find.byType(TextFormField);
|
||||
await tester.enterText(firstFields.at(0), 'Economy title');
|
||||
await tester.enterText(firstFields.at(3), '1500');
|
||||
await tester.pump();
|
||||
|
||||
await tester.tap(find.text('2'));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
expect(cubit.state.selectedOptionIndex, 1);
|
||||
|
||||
final secondFields = find.byType(TextFormField);
|
||||
await tester.enterText(secondFields.at(0), 'Standard title');
|
||||
await tester.enterText(secondFields.at(3), '2500');
|
||||
await tester.pump();
|
||||
|
||||
expect(cubit.state.planData.options[0].short, 'Economy title');
|
||||
expect(cubit.state.planData.options[1].short, 'Standard title');
|
||||
expect(cubit.state.planData.options[0].price, 1500.0);
|
||||
expect(cubit.state.planData.options[1].price, 2500.0);
|
||||
|
||||
await tester.tap(find.text('1'));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Economy title'), findsOneWidget);
|
||||
expect(cubit.state.planData.options[1].short, 'Standard title');
|
||||
expect(cubit.state.planData.options[1].price, 2500.0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class _FakeCreatePlanRepository extends Fake implements CreatePlanRepository {}
|
||||
|
||||
Reference in New Issue
Block a user