Skip to content

Commit

Permalink
Merge pull request #266 from institutoazmina/improvement/quiz/update-…
Browse files Browse the repository at this point in the history
…name

Renomeia referencias de "new_quiz" para "quiz"
  • Loading branch information
shonorio authored Nov 10, 2024
2 parents 38beb91 + 6d487eb commit c0072fa
Show file tree
Hide file tree
Showing 34 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import 'quiz_controller.dart';

const fabScrollOffset = 48.0;

class NewQuizPage extends StatelessWidget {
const NewQuizPage({Key? key}) : super(key: key);
class QuizPage extends StatelessWidget {
const QuizPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -274,7 +274,7 @@ extension _QuizContentStateHelpers on QuizContentState {
/// the FAB only when has no pending messages
void _scrollListener() {
if (_hasPendingMessages) return;
WidgetsBinding.instance?.addPostFrameCallback((_) => _maybeShowFab());
WidgetsBinding.instance.addPostFrameCallback((_) => _maybeShowFab());
}

/// Dispatch the message updates to the list
Expand Down
6 changes: 3 additions & 3 deletions lib/app/features/quiz/quiz_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import 'domain/quiz_remote_config.dart';
import 'domain/repositories/i_quiz_repository.dart';
import 'domain/send_answer.dart';
import 'domain/start_quiz.dart';
import 'presentation/new_quiz/quiz_controller.dart';
import 'presentation/new_quiz/quiz_page.dart';
import 'presentation/quiz/quiz_controller.dart';
import 'presentation/quiz/quiz_page.dart';
import 'presentation/quiz_start/quiz_start_controller.dart';
import 'presentation/quiz_start/quiz_start_page.dart';
import 'presentation/tutorial/stealth_mode_tutorial_page.dart';
Expand Down Expand Up @@ -85,7 +85,7 @@ class QuizModule extends Module {
List<ModularRoute> get routes => [
ChildRoute(
Modular.initialRoute,
child: (_, __) => const NewQuizPage(),
child: (_, __) => const QuizPage(),
),
ChildRoute(
'/start',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:penhas/app/features/quiz/domain/entities/answer.dart';
import 'package:penhas/app/features/quiz/domain/entities/quiz.dart';
import 'package:penhas/app/features/quiz/domain/entities/quiz_message.dart';
import 'package:penhas/app/features/quiz/domain/send_answer.dart';
import 'package:penhas/app/features/quiz/presentation/new_quiz/quiz_page.dart';
import 'package:penhas/app/features/quiz/presentation/quiz/quiz_page.dart';
import 'package:penhas/app/features/quiz/quiz_module.dart';
import 'package:penhas/app/shared/navigation/app_navigator.dart';
import 'package:penhas/app/shared/navigation/app_route.dart';
Expand All @@ -22,7 +22,7 @@ import '../../../../../utils/widget_tester_ext.dart';
import '../quiz_test_helper.dart';

void main() {
group(NewQuizPage, () {
group(QuizPage, () {
late AppNavigator mockAppNavigator;
late SendAnswerUseCase mockSendAnswer;
late IRemoteConfigService mockRemoteConfig;
Expand Down Expand Up @@ -68,7 +68,7 @@ void main() {
setUp: () {
mockQuizArgs();
},
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
);

screenshotTest(
Expand All @@ -77,7 +77,7 @@ void main() {
setUp: () {
mockQuizArgs([QuizOkButton()]);
},
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
pumpBeforeTest: (tester) async {
when(
() => mockSendAnswer(any(), any()),
Expand All @@ -94,7 +94,7 @@ void main() {
setUp: () {
mockQuizArgs([QuizOkButton()]);
},
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
pumpBeforeTest: (tester) async {
when(
() => mockSendAnswer(any(), any()),
Expand Down Expand Up @@ -130,7 +130,7 @@ void main() {
),
).thenAnswer((_) => Future.value());

await tester.pumpWidget(buildTestableWidget(NewQuizPage()));
await tester.pumpWidget(buildTestableWidget(QuizPage()));

// act
await tester.tapAll(find.text('OK'));
Expand Down Expand Up @@ -226,7 +226,7 @@ void main() {
'should navigate to /quiz/tutorial/help-center when Show Tutorial button is pressed',
(tester) async {
// arrange
await tester.pumpWidget(buildTestableWidget(NewQuizPage()));
await tester.pumpWidget(buildTestableWidget(QuizPage()));

// act
await tester.tap(find.text('SHOW TUTORIAL'));
Expand Down Expand Up @@ -273,7 +273,7 @@ void main() {
'should navigate to /quiz/tutorial/stealth when Show Tutorial button is pressed',
(tester) async {
// arrange
await tester.pumpWidget(buildTestableWidget(NewQuizPage()));
await tester.pumpWidget(buildTestableWidget(QuizPage()));

// act
await tester.tap(find.text('SHOW TUTORIAL'));
Expand Down Expand Up @@ -409,7 +409,7 @@ void main() {
),
);
},
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
pumpBeforeTest: (tester) async {
await tester.tapAll(find.text('OK'));
await tester.pumpAndSettle();
Expand All @@ -432,7 +432,7 @@ void main() {
),
);
},
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
pumpBeforeTest: (tester) async {
await tester.tapAll(find.text('OK'));
await tester.pumpAndSettle();
Expand Down
6 changes: 3 additions & 3 deletions test/app/features/quiz/presentation/quiz_test_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:meta/meta.dart';
import 'package:mocktail/mocktail.dart';
import 'package:penhas/app/features/appstate/domain/entities/app_state_entity.dart';
import 'package:penhas/app/features/quiz/domain/entities/quiz_message.dart';
import 'package:penhas/app/features/quiz/presentation/new_quiz/quiz_page.dart';
import 'package:penhas/app/features/quiz/presentation/quiz/quiz_page.dart';

import '../../../../utils/golden_tests.dart';

Expand Down Expand Up @@ -46,7 +46,7 @@ class QuizMessageTestScope {
screenshotTest(
description,
fileName: 'quiz_${message.type.name}_received',
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
skip: skip,
);
}
Expand All @@ -60,7 +60,7 @@ class QuizMessageTestScope {
screenshotTest(
description,
fileName: 'quiz_${message.type.name}_replyed',
pageBuilder: () => NewQuizPage(),
pageBuilder: () => QuizPage(),
pumpBeforeTest: action,
skip: skip,
);
Expand Down
6 changes: 3 additions & 3 deletions test/app/features/quiz/quiz_module_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:penhas/app/core/remoteconfig/i_remote_config.dart';
import 'package:penhas/app/features/appstate/domain/entities/app_state_entity.dart';
import 'package:penhas/app/features/appstate/domain/usecases/app_state_usecase.dart';
import 'package:penhas/app/features/help_center/presentation/pages/tutorial/guardian/guardian_tutorial_page.dart';
import 'package:penhas/app/features/quiz/presentation/new_quiz/quiz_page.dart';
import 'package:penhas/app/features/quiz/presentation/quiz/quiz_page.dart';
import 'package:penhas/app/features/quiz/presentation/quiz_start/quiz_start_page.dart';
import 'package:penhas/app/features/quiz/presentation/tutorial/stealth_mode_tutorial_page.dart';
import 'package:penhas/app/features/quiz/quiz_module.dart';
Expand Down Expand Up @@ -163,8 +163,8 @@ void main() {
await tester.pump();

// assert
// will be replaced by the NewQuizPage widget soon
expect(find.byType(NewQuizPage), findsOneWidget);
// will be replaced by the QuizPage widget soon
expect(find.byType(QuizPage), findsOneWidget);
},
);
});
Expand Down

0 comments on commit c0072fa

Please sign in to comment.