diff --git a/lib/src/components/avatars/avatar.dart b/lib/src/components/avatars/avatar.dart index 94fb3249..b72e1988 100644 --- a/lib/src/components/avatars/avatar.dart +++ b/lib/src/components/avatars/avatar.dart @@ -188,7 +188,7 @@ class ZetaAvatar extends ZetaStatelessWidget { (initials != null ? Center( child: Text( - size == ZetaAvatarSize.xs ? initials!.substring(0, 1) : initials!, + initials!, style: initialTextStyle ?? TextStyle( fontSize: size.fontSize(context), @@ -288,11 +288,10 @@ class ZetaAvatar extends ZetaStatelessWidget { ..add(StringProperty('semanticLowerBadgeValue', semanticLowerBadgeLabel)) ..add(DiagnosticsProperty('initialTextStyle', initialTextStyle)); } -} -extension on ZetaAvatarSize { - double pixelSize(BuildContext context) { - switch (this) { + /// Returns pixel size for [ZetaAvatarSize] + static double pixelSize(BuildContext context, ZetaAvatarSize size) { + switch (size) { case ZetaAvatarSize.xxxl: return Zeta.of(context).spacing.minimum * 50; // TODO(UX-1202): ZetaSpacingBase // return ZetaSpacingBase.x50; @@ -316,6 +315,17 @@ extension on ZetaAvatarSize { } } + /// Font size for initials + static double fontSize(BuildContext context, ZetaAvatarSize size) { + return pixelSize(context, size) * 4 / 9; + } +} + +extension on ZetaAvatarSize { + double pixelSize(BuildContext context) { + return ZetaAvatar.pixelSize(context, this); + } + double borderSize(BuildContext context) { switch (this) { case ZetaAvatarSize.xxxl: @@ -335,7 +345,7 @@ extension on ZetaAvatarSize { } double fontSize(BuildContext context) { - return pixelSize(context) * 4 / 9; + return ZetaAvatar.fontSize(context, this); } } diff --git a/lib/src/utils/extensions.dart b/lib/src/utils/extensions.dart index 014819ec..942adbda 100644 --- a/lib/src/utils/extensions.dart +++ b/lib/src/utils/extensions.dart @@ -97,7 +97,7 @@ extension StringExtensions on String? { final List nameParts = this!.split(RegExp(r'\W+'))..removeWhere((item) => item.isEmpty); if (nameParts.isEmpty) return ''; return (nameParts.length > 1 - ? nameParts[0].substring(0, 1) + nameParts[1].substring(0, 1) + ? nameParts[0].substring(0, 1) + nameParts[nameParts.length - 1].substring(0, 1) : nameParts[0].length > 1 ? nameParts[0].substring(0, 2) : nameParts[0]) diff --git a/test/src/components/avatar/assets/maxresdefault.jpg b/test/src/components/avatar/assets/maxresdefault.jpg new file mode 100644 index 00000000..be07c7f1 Binary files /dev/null and b/test/src/components/avatar/assets/maxresdefault.jpg differ diff --git a/test/src/components/avatar/avatar_test.dart b/test/src/components/avatar/avatar_test.dart new file mode 100644 index 00000000..9376f890 --- /dev/null +++ b/test/src/components/avatar/avatar_test.dart @@ -0,0 +1,400 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:zeta_flutter/zeta_flutter.dart'; + +import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; +import '../../../test_utils/utils.dart'; + +void main() { + const goldenFile = GoldenFiles(component: 'avatar'); + + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('ZetaAvatar Accessibility Tests', () { + testWidgets('ZetaAvatar meets accessibility requirements', (WidgetTester tester) async { + final SemanticsHandle handle = tester.ensureSemantics(); + await tester.pumpWidget( + const TestApp( + home: ZetaAvatar.initials( + initials: 'AB', + backgroundColor: Colors.black, + borderColor: Colors.white, + lowerBadge: ZetaAvatarBadge( + icon: Icons.abc, + ), + upperBadge: ZetaAvatarBadge( + icon: Icons.abc, + ), + size: ZetaAvatarSize.l, + ), + ), + ); + await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); + await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); + await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); + await expectLater(tester, meetsGuideline(textContrastGuideline)); + + handle.dispose(); + }); + }); + + group('ZetaAvatar Content Tests', () { + const names = [ + 'John Doe', + 'Jane Doe', + 'John Jim Smith', + 'Jane Lane Smith', + 'Emily Bukowsik Johnson', + 'Michael John Brad Brown', + 'Emma Amy Davis', + 'William Charlie Wilson', + 'Olivia Johnston', + 'James Oliver', + 'Isabella Smith', + ]; + + // TODODE: We need options for which initials should be displayed. Could use a bitmask? + for (final name in names) { + testWidgets( + 'ZetaAvatar intiatls show the first letter of the first name and the last name $name', + (WidgetTester tester) async { + final nameParts = name.split(' '); + final initials = nameParts[0][0].toUpperCase() + nameParts[nameParts.length - 1][0].toUpperCase(); + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.fromName( + name: name, + ), + ), + ); + + expect(find.text(initials), findsOneWidget); + }, + skip: true, + ); + } + + for (final size in ZetaAvatarSize.values) { + testWidgets('ZetaAvatar with initials $size text is correct', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.initials( + size: size, + initials: 'AB', + ), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect(find.text('AB'), findsOneWidget); + }); + } + }); + + group('ZetaAvatar Dimensions Tests', () { + for (final size in ZetaAvatarSize.values) { + testWidgets( + 'ZetaAvatar size $size with upper badge', + (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + size: size, + upperBadge: const ZetaAvatarBadge.notification(value: 3), + ), + ), + ); + + expect(find.byType(ZetaAvatarBadge), findsOneWidget); + + final badgePosition = tester.getRect(find.byType(ZetaAvatarBadge)); + final pixelSize = ZetaAvatar.pixelSize(tester.element(find.byType(ZetaAvatar)), size); + + expect(badgePosition.top, equals(0.0)); + expect(badgePosition.right, equals(pixelSize)); + }, + ); + + testWidgets('ZetaAvatar size $size with lower badge', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + size: size, + lowerBadge: const ZetaAvatarBadge.icon(icon: Icons.star), + ), + ), + ); + + expect(find.byType(ZetaAvatarBadge), findsOneWidget); + + final badgePosition = tester.getRect(find.byType(ZetaAvatarBadge)); + final pixelSize = ZetaAvatar.pixelSize(tester.element(find.byType(ZetaAvatar)), size); + + expect(badgePosition.bottom, equals(pixelSize)); + expect(badgePosition.right, equals(pixelSize)); + }); + + testWidgets('ZetaAvatar size $size', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + size: size, + ), + ), + ); + + final avatarSize = tester.getSize(find.byType(ZetaAvatar)); + final typeSize = ZetaAvatar.pixelSize( + tester.element(find.byType(ZetaAvatar)), + size, + ); + + expect(avatarSize.width, equals(typeSize)); + expect(avatarSize.height, equals(typeSize)); + }); + + testWidgets('ZetaAvatar size $size with image', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.image( + size: size, + image: Image.file(File('/assets/maxresdefault.jpg')), + ), + ), + ); + + final avatarSize = tester.getSize(find.byType(ZetaAvatar)); + final typeSize = ZetaAvatar.pixelSize(tester.element(find.byType(ZetaAvatar)), size); + + expect(avatarSize.width, equals(typeSize)); + expect(avatarSize.height, equals(typeSize)); + }); + + testWidgets('ZetaAvatar size $size with initials', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.initials( + size: size, + initials: 'AB', + ), + ), + ); + + final avatarSize = tester.getSize(find.byType(ZetaAvatar)); + final typeSize = ZetaAvatar.pixelSize(tester.element(find.byType(ZetaAvatar)), size); + + expect(avatarSize.width, equals(typeSize)); + expect(avatarSize.height, equals(typeSize)); + }); + + testWidgets('ZetaAvatar size $size with fromName', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.fromName( + size: size, + name: 'John Doe', + ), + ), + ); + + final avatarSize = tester.getSize(find.byType(ZetaAvatar)); + final typeSize = ZetaAvatar.pixelSize(tester.element(find.byType(ZetaAvatar)), size); + + expect(avatarSize.width, equals(typeSize)); + expect(avatarSize.height, equals(typeSize)); + }); + } + }); + + group('ZetaAvatar Styling Tests', () { + for (final size in ZetaAvatarSize.values) { + testWidgets('ZetaAvatar with initials $size text size is correct', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.initials( + size: size, + initials: 'AB', + ), + ), + ); + + final text = tester.firstWidget(find.byType(Text)) as Text; + expect( + text.style?.fontSize, + equals( + ZetaAvatar.fontSize(tester.element(find.byType(ZetaAvatar)), size), + ), + ); + }); + } + + testWidgets('ZetaAvatar with initials text color is correct', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaAvatar.initials( + initials: 'AB', + initialTextStyle: TextStyle(color: Colors.red), + ), + ), + ); + + final text = tester.firstWidget(find.byType(Text)) as Text; + expect(text.style!.color, equals(Colors.red)); + }); + testWidgets('ZetaAvatar default background colour', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaAvatar(), + ), + ); + + final avatarBackgroundColor = + ((tester.firstWidget(find.byType(Container)) as Container).decoration! as BoxDecoration).color; + + final context = tester.element(find.byType(ZetaAvatar)); + expect(avatarBackgroundColor, equals(Zeta.of(context).colors.surfacePrimary)); + }); + + testWidgets('ZetaAvatar with background colour', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaAvatar( + backgroundColor: Colors.red, + ), + ), + ); + + final avatarBackgroundColor = + ((tester.firstWidget(find.byType(Container)) as Container).decoration! as BoxDecoration).color; + + expect(avatarBackgroundColor, equals(Colors.red)); + }); + + for (final size in ZetaAvatarSize.values) { + testWidgets('ZetaAvatar with border colour for $size', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + borderColor: Colors.red, + size: size, + ), + ), + ); + + final avatarBorderColor = + (((tester.firstWidget(find.byType(Container)) as Container).decoration! as BoxDecoration).border! as Border) + .top + .color; + expect(avatarBorderColor, equals(Colors.red)); + }); + } + }); + + group('ZetaAvatar Interaction Tests', () {}); + + group('ZetaAvatar Golden Tests', () { + for (final size in ZetaAvatarSize.values) { + testWidgets('ZetaAvatar default ${size.toString().split('.').last}', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + size: size, + ), + ), + ); + + await expectLater( + find.byType(ZetaAvatar), + matchesGoldenFile(goldenFile.getFileUri('avatar_default_${size.toString().split('.').last}')), + ); + }); + + testWidgets('ZetaAvatar with initials', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.initials( + initials: 'AB', + size: size, + ), + ), + ); + + await expectLater( + find.byType(ZetaAvatar), + matchesGoldenFile(goldenFile.getFileUri('avatar_initials_${size.toString().split('.').last}')), + ); + }); + + testWidgets('ZetaAvatar with image', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.image( + image: Image.file(File('/assets/maxresdefault.jpg')), + size: size, + ), + ), + ); + + await expectLater( + find.byType(ZetaAvatar), + matchesGoldenFile(goldenFile.getFileUri('avatar_image_${size.toString().split('.').last}')), + ); + }); + + testWidgets('ZetaAvatar with fromName', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar.fromName( + name: 'John Doe', + size: size, + ), + ), + ); + + await expectLater( + find.byType(ZetaAvatar), + matchesGoldenFile(goldenFile.getFileUri('avatar_from_name_${size.toString().split('.').last}')), + ); + }); + + testWidgets('ZetaAvatar with upper badge', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + upperBadge: const ZetaAvatarBadge.notification(value: 3), + size: size, + ), + ), + ); + + await expectLater( + find.byType(ZetaAvatar), + matchesGoldenFile(goldenFile.getFileUri('avatar_upper_badge_${size.toString().split('.').last}')), + ); + }); + + testWidgets('ZetaAvatar with lower badge', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaAvatar( + lowerBadge: const ZetaAvatarBadge.icon(icon: Icons.star), + size: size, + ), + ), + ); + + await expectLater( + find.byType(ZetaAvatar), + matchesGoldenFile(goldenFile.getFileUri('avatar_lower_badge_${size.toString().split('.').last}')), + ); + }); + } + }); + + group('ZetaAvatar Performance Tests', () {}); +} diff --git a/test/src/components/avatar/golden/avatar_default_l.png b/test/src/components/avatar/golden/avatar_default_l.png new file mode 100644 index 00000000..f1b7e806 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_l.png differ diff --git a/test/src/components/avatar/golden/avatar_default_m.png b/test/src/components/avatar/golden/avatar_default_m.png new file mode 100644 index 00000000..1cdbb01c Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_m.png differ diff --git a/test/src/components/avatar/golden/avatar_default_s.png b/test/src/components/avatar/golden/avatar_default_s.png new file mode 100644 index 00000000..6968568a Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_s.png differ diff --git a/test/src/components/avatar/golden/avatar_default_xl.png b/test/src/components/avatar/golden/avatar_default_xl.png new file mode 100644 index 00000000..93ff79dd Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_xl.png differ diff --git a/test/src/components/avatar/golden/avatar_default_xs.png b/test/src/components/avatar/golden/avatar_default_xs.png new file mode 100644 index 00000000..56dcc7dc Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_xs.png differ diff --git a/test/src/components/avatar/golden/avatar_default_xxl.png b/test/src/components/avatar/golden/avatar_default_xxl.png new file mode 100644 index 00000000..81462459 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_xxl.png differ diff --git a/test/src/components/avatar/golden/avatar_default_xxs.png b/test/src/components/avatar/golden/avatar_default_xxs.png new file mode 100644 index 00000000..0ddee64c Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_xxs.png differ diff --git a/test/src/components/avatar/golden/avatar_default_xxxl.png b/test/src/components/avatar/golden/avatar_default_xxxl.png new file mode 100644 index 00000000..35dded72 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_xxxl.png differ diff --git a/test/src/components/avatar/golden/avatar_default_xxxs.png b/test/src/components/avatar/golden/avatar_default_xxxs.png new file mode 100644 index 00000000..590958fc Binary files /dev/null and b/test/src/components/avatar/golden/avatar_default_xxxs.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_l.png b/test/src/components/avatar/golden/avatar_from_name_l.png new file mode 100644 index 00000000..54a7498a Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_l.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_m.png b/test/src/components/avatar/golden/avatar_from_name_m.png new file mode 100644 index 00000000..00d0cc42 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_m.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_s.png b/test/src/components/avatar/golden/avatar_from_name_s.png new file mode 100644 index 00000000..29d4d0b5 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_s.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_xl.png b/test/src/components/avatar/golden/avatar_from_name_xl.png new file mode 100644 index 00000000..c9288ff3 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_xl.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_xs.png b/test/src/components/avatar/golden/avatar_from_name_xs.png new file mode 100644 index 00000000..ec8f22c7 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_xs.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_xxl.png b/test/src/components/avatar/golden/avatar_from_name_xxl.png new file mode 100644 index 00000000..27293658 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_xxl.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_xxs.png b/test/src/components/avatar/golden/avatar_from_name_xxs.png new file mode 100644 index 00000000..d43b1625 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_xxs.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_xxxl.png b/test/src/components/avatar/golden/avatar_from_name_xxxl.png new file mode 100644 index 00000000..b16b99d7 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_xxxl.png differ diff --git a/test/src/components/avatar/golden/avatar_from_name_xxxs.png b/test/src/components/avatar/golden/avatar_from_name_xxxs.png new file mode 100644 index 00000000..e03fc338 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_from_name_xxxs.png differ diff --git a/test/src/components/avatar/golden/avatar_image_l.png b/test/src/components/avatar/golden/avatar_image_l.png new file mode 100644 index 00000000..43bda33c Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_l.png differ diff --git a/test/src/components/avatar/golden/avatar_image_m.png b/test/src/components/avatar/golden/avatar_image_m.png new file mode 100644 index 00000000..0373e854 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_m.png differ diff --git a/test/src/components/avatar/golden/avatar_image_s.png b/test/src/components/avatar/golden/avatar_image_s.png new file mode 100644 index 00000000..f1f5d2be Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_s.png differ diff --git a/test/src/components/avatar/golden/avatar_image_xl.png b/test/src/components/avatar/golden/avatar_image_xl.png new file mode 100644 index 00000000..40e80684 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_xl.png differ diff --git a/test/src/components/avatar/golden/avatar_image_xs.png b/test/src/components/avatar/golden/avatar_image_xs.png new file mode 100644 index 00000000..b7b83468 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_xs.png differ diff --git a/test/src/components/avatar/golden/avatar_image_xxl.png b/test/src/components/avatar/golden/avatar_image_xxl.png new file mode 100644 index 00000000..3fd71247 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_xxl.png differ diff --git a/test/src/components/avatar/golden/avatar_image_xxs.png b/test/src/components/avatar/golden/avatar_image_xxs.png new file mode 100644 index 00000000..db0eafb7 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_xxs.png differ diff --git a/test/src/components/avatar/golden/avatar_image_xxxl.png b/test/src/components/avatar/golden/avatar_image_xxxl.png new file mode 100644 index 00000000..a677b2cb Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_xxxl.png differ diff --git a/test/src/components/avatar/golden/avatar_image_xxxs.png b/test/src/components/avatar/golden/avatar_image_xxxs.png new file mode 100644 index 00000000..162703a4 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_image_xxxs.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_l.png b/test/src/components/avatar/golden/avatar_initials_l.png new file mode 100644 index 00000000..54a7498a Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_l.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_m.png b/test/src/components/avatar/golden/avatar_initials_m.png new file mode 100644 index 00000000..00d0cc42 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_m.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_s.png b/test/src/components/avatar/golden/avatar_initials_s.png new file mode 100644 index 00000000..29d4d0b5 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_s.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_xl.png b/test/src/components/avatar/golden/avatar_initials_xl.png new file mode 100644 index 00000000..c9288ff3 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_xl.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_xs.png b/test/src/components/avatar/golden/avatar_initials_xs.png new file mode 100644 index 00000000..ec8f22c7 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_xs.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_xxl.png b/test/src/components/avatar/golden/avatar_initials_xxl.png new file mode 100644 index 00000000..27293658 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_xxl.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_xxs.png b/test/src/components/avatar/golden/avatar_initials_xxs.png new file mode 100644 index 00000000..d43b1625 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_xxs.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_xxxl.png b/test/src/components/avatar/golden/avatar_initials_xxxl.png new file mode 100644 index 00000000..b16b99d7 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_xxxl.png differ diff --git a/test/src/components/avatar/golden/avatar_initials_xxxs.png b/test/src/components/avatar/golden/avatar_initials_xxxs.png new file mode 100644 index 00000000..e03fc338 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_initials_xxxs.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_l.png b/test/src/components/avatar/golden/avatar_lower_badge_l.png new file mode 100644 index 00000000..e463ddce Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_l.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_m.png b/test/src/components/avatar/golden/avatar_lower_badge_m.png new file mode 100644 index 00000000..13700bb6 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_m.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_s.png b/test/src/components/avatar/golden/avatar_lower_badge_s.png new file mode 100644 index 00000000..c38225f4 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_s.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_xl.png b/test/src/components/avatar/golden/avatar_lower_badge_xl.png new file mode 100644 index 00000000..dea92ef7 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_xl.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_xs.png b/test/src/components/avatar/golden/avatar_lower_badge_xs.png new file mode 100644 index 00000000..f25da5df Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_xs.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_xxl.png b/test/src/components/avatar/golden/avatar_lower_badge_xxl.png new file mode 100644 index 00000000..7faec2b4 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_xxl.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_xxs.png b/test/src/components/avatar/golden/avatar_lower_badge_xxs.png new file mode 100644 index 00000000..dcba2c3e Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_xxs.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_xxxl.png b/test/src/components/avatar/golden/avatar_lower_badge_xxxl.png new file mode 100644 index 00000000..bb9be878 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_xxxl.png differ diff --git a/test/src/components/avatar/golden/avatar_lower_badge_xxxs.png b/test/src/components/avatar/golden/avatar_lower_badge_xxxs.png new file mode 100644 index 00000000..dfb93618 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_lower_badge_xxxs.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_l.png b/test/src/components/avatar/golden/avatar_upper_badge_l.png new file mode 100644 index 00000000..7e42a459 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_l.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_m.png b/test/src/components/avatar/golden/avatar_upper_badge_m.png new file mode 100644 index 00000000..7b9bf5ab Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_m.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_s.png b/test/src/components/avatar/golden/avatar_upper_badge_s.png new file mode 100644 index 00000000..1e6b9e3f Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_s.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_xl.png b/test/src/components/avatar/golden/avatar_upper_badge_xl.png new file mode 100644 index 00000000..b02b399f Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_xl.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_xs.png b/test/src/components/avatar/golden/avatar_upper_badge_xs.png new file mode 100644 index 00000000..faf37477 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_xs.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_xxl.png b/test/src/components/avatar/golden/avatar_upper_badge_xxl.png new file mode 100644 index 00000000..5e3eb610 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_xxl.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_xxs.png b/test/src/components/avatar/golden/avatar_upper_badge_xxs.png new file mode 100644 index 00000000..8808ac8c Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_xxs.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_xxxl.png b/test/src/components/avatar/golden/avatar_upper_badge_xxxl.png new file mode 100644 index 00000000..8abced31 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_xxxl.png differ diff --git a/test/src/components/avatar/golden/avatar_upper_badge_xxxs.png b/test/src/components/avatar/golden/avatar_upper_badge_xxxs.png new file mode 100644 index 00000000..ea50d404 Binary files /dev/null and b/test/src/components/avatar/golden/avatar_upper_badge_xxxs.png differ diff --git a/test/src/utils/extensions_test.dart b/test/src/utils/extensions_test.dart index 5d1e8b4d..2200f757 100644 --- a/test/src/utils/extensions_test.dart +++ b/test/src/utils/extensions_test.dart @@ -225,7 +225,7 @@ void main() { group('StringExtensions extension', () { test('initials returns correct initials', () { expect('John Doe'.initials, 'JD'); - expect('A B C'.initials, 'AB'); + expect('A B C'.initials, 'AC'); expect('Single'.initials, 'SI'); expect('A'.initials, 'A'); expect('a'.initials, 'A');