From 0053fadc16def5442e722b2adaa8538ec3c2aa1d Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Wed, 15 Jul 2026 15:16:10 -0500 Subject: [PATCH 1/2] [material_ui] Fix upstream localization test --- .../test/l10n/date_picker_test.dart | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/material_ui/test/l10n/date_picker_test.dart b/packages/material_ui/test/l10n/date_picker_test.dart index 87d3dcb5eaff..3cf9572798e0 100644 --- a/packages/material_ui/test/l10n/date_picker_test.dart +++ b/packages/material_ui/test/l10n/date_picker_test.dart @@ -25,27 +25,27 @@ void main() { 'textDirection': TextDirection.ltr, 'expectedDaysOfWeek': ['S', 'M', 'T', 'W', 'T', 'F', 'S'], 'expectedDaysOfMonth': List.generate(30, (int i) => '${i + 1}'), - 'expectedMonthYearHeader': 'September 2017', + 'expectedMonthYearHeader': ['September 2017'], }, // Tests a different first day of week. const Locale('ru', 'RU'): { 'textDirection': TextDirection.ltr, 'expectedDaysOfWeek': ['В', 'П', 'В', 'С', 'Ч', 'П', 'С'], 'expectedDaysOfMonth': List.generate(30, (int i) => '${i + 1}'), - 'expectedMonthYearHeader': 'сентябрь 2017\u202fг.', + 'expectedMonthYearHeader': ['сентябрь 2017\u202fг.'], }, const Locale('ro', 'RO'): { 'textDirection': TextDirection.ltr, 'expectedDaysOfWeek': ['D', 'L', 'M', 'M', 'J', 'V', 'S'], 'expectedDaysOfMonth': List.generate(30, (int i) => '${i + 1}'), - 'expectedMonthYearHeader': 'septembrie 2017', + 'expectedMonthYearHeader': ['septembrie 2017'], }, // Tests RTL. const Locale('ar', 'AR'): { 'textDirection': TextDirection.rtl, 'expectedDaysOfWeek': ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'expectedDaysOfMonth': List.generate(30, (int i) => arabicNumbers.format(i + 1)), - 'expectedMonthYearHeader': 'سبتمبر 2017', + 'expectedMonthYearHeader': ['سبتمبر ٢٠١٧', 'سبتمبر 2017'], }, }; @@ -53,7 +53,9 @@ void main() { testWidgets('shows dates for $locale', (WidgetTester tester) async { final expectedDaysOfWeek = testLocales[locale]!['expectedDaysOfWeek'] as List; final expectedDaysOfMonth = testLocales[locale]!['expectedDaysOfMonth'] as List; - final expectedMonthYearHeader = testLocales[locale]!['expectedMonthYearHeader'] as String; + // TODO(Piinks): Clean up this workaround after https://github.com/flutter/flutter/pull/188473 reaches stable + final expectedMonthYearHeaders = + testLocales[locale]!['expectedMonthYearHeader'] as List; final textDirection = testLocales[locale]!['textDirection'] as TextDirection; final baseDate = DateTime(2017, 9, 27); @@ -68,7 +70,14 @@ void main() { locale: locale, textDirection: textDirection, ); - expect(find.text(expectedMonthYearHeader), findsOneWidget); + + // TODO(Piinks): Clean up this workaround after https://github.com/flutter/flutter/pull/188473 reaches stable + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Text && expectedMonthYearHeaders.contains(widget.data), + ), + findsOneWidget, + ); for (final dayOfWeek in expectedDaysOfWeek) { expect(find.text(dayOfWeek), findsWidgets); From 100cf0843f4174d376f62fc1703bf2031b4d1f9a Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Wed, 15 Jul 2026 15:20:09 -0500 Subject: [PATCH 2/2] Apply suggestions from code review --- packages/material_ui/test/l10n/date_picker_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/material_ui/test/l10n/date_picker_test.dart b/packages/material_ui/test/l10n/date_picker_test.dart index 3cf9572798e0..2df11b546574 100644 --- a/packages/material_ui/test/l10n/date_picker_test.dart +++ b/packages/material_ui/test/l10n/date_picker_test.dart @@ -53,7 +53,7 @@ void main() { testWidgets('shows dates for $locale', (WidgetTester tester) async { final expectedDaysOfWeek = testLocales[locale]!['expectedDaysOfWeek'] as List; final expectedDaysOfMonth = testLocales[locale]!['expectedDaysOfMonth'] as List; - // TODO(Piinks): Clean up this workaround after https://github.com/flutter/flutter/pull/188473 reaches stable + // TODO(Piinks): Clean up this workaround after https://github.com/flutter/flutter/pull/188473 reaches stable, https://github.com/flutter/flutter/issues/189528 final expectedMonthYearHeaders = testLocales[locale]!['expectedMonthYearHeader'] as List; final textDirection = testLocales[locale]!['textDirection'] as TextDirection; @@ -71,7 +71,7 @@ void main() { textDirection: textDirection, ); - // TODO(Piinks): Clean up this workaround after https://github.com/flutter/flutter/pull/188473 reaches stable + // TODO(Piinks): Clean up this workaround after https://github.com/flutter/flutter/pull/188473 reaches stable, https://github.com/flutter/flutter/issues/189528 expect( find.byWidgetPredicate( (Widget widget) => widget is Text && expectedMonthYearHeaders.contains(widget.data),