Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jneschisi committed Jul 26, 2024
1 parent ee8332b commit 3074081
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions packages/aes_ui/test/src/widgets/aes_layout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,41 @@ void main() {
);
});

group('is medium', () {
testWidgets(
'when the width is smaller than the desktop breakpoint',
(tester) async {
late final BuildContext buildContext;
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(
size: Size(AesLayout.desktopBreakpoint - 1, 200),
),
child: AesLayout(
child: Builder(
builder: (context) {
buildContext = context;
return const SizedBox();
},
),
),
),
);

expect(AesLayout.of(buildContext), equals(AesLayoutData.medium));
},
);
});

group('is large', () {
testWidgets(
'when the width is at the mobile breakpoint',
'when the width is at the desktop breakpoint',
(tester) async {
late final BuildContext buildContext;
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(
size: Size(AesLayout.mobileBreakpoint, 200),
size: Size(AesLayout.desktopBreakpoint, 200),
),
child: AesLayout(
child: Builder(
Expand All @@ -109,13 +135,13 @@ void main() {
);

testWidgets(
'when the width is greater than the mobile breakpoint',
'when the width is greater than the desktop breakpoint',
(tester) async {
late final BuildContext buildContext;
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(
size: Size(AesLayout.mobileBreakpoint + 1, 200),
size: Size(AesLayout.desktopBreakpoint + 1, 200),
),
child: AesLayout(
child: Builder(
Expand Down Expand Up @@ -169,7 +195,7 @@ void main() {
});
await tester.pumpAndSettle();

expect(AesLayout.of(buildContext!), equals(AesLayoutData.large));
expect(AesLayout.of(buildContext!), equals(AesLayoutData.medium));
},
);
});
Expand Down

0 comments on commit 3074081

Please sign in to comment.