forked from eatvio/eatvio_app
fix: issue-942, issue-967, fixed images positioning for blog posts
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||
import 'package:eatvio_app/features/glossary/presentation/pages/glossary_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
@@ -46,6 +47,7 @@ void main() {
|
||||
expect(find.byType(GlossaryScreen), findsOneWidget);
|
||||
expect(find.byType(Scaffold), findsOneWidget);
|
||||
expect(find.text('Глоссарий'), findsOneWidget);
|
||||
expect(find.byType(Loader), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('GlossaryScreen создается с правильным passKey', (WidgetTester tester) async {
|
||||
@@ -71,6 +73,66 @@ void main() {
|
||||
|
||||
expect(find.byType(GlossaryScreen), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('показывает стандартный лоадер при загрузке WebView', (WidgetTester tester) async {
|
||||
const passKey = 'test-pass-key';
|
||||
|
||||
final router = GoRouter(
|
||||
initialLocation: '/',
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => const GlossaryScreen(passKey: passKey),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp.router(
|
||||
routerConfig: router,
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(Loader), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('shouldHideGlossaryLoader', () {
|
||||
test('не скрывает лоадер на странице login_with_pass_key', () {
|
||||
expect(
|
||||
shouldHideGlossaryLoader(
|
||||
url: 'https://eatvio.ru/login_with_pass_key?id=1',
|
||||
progress: 100,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('не скрывает лоадер пока URL ещё не известен', () {
|
||||
expect(shouldHideGlossaryLoader(url: '', progress: 80), isFalse);
|
||||
});
|
||||
|
||||
test('не скрывает лоадер пока прогресс глоссария ниже порога', () {
|
||||
expect(
|
||||
shouldHideGlossaryLoader(
|
||||
url: 'https://eatvio.ru/product_nutritional_value',
|
||||
progress: 39,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('скрывает лоадер когда страница глоссария уже начала отрисовываться', () {
|
||||
expect(
|
||||
shouldHideGlossaryLoader(
|
||||
url: 'https://eatvio.ru/product_nutritional_value',
|
||||
progress: 40,
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user