Skip to content

Commit 4663118

Browse files
chrisbobbegnprice
authored andcommitted
content test: Support localizable UI text in smoke tests
When we support spoilers, soon, we'll want to translate the default header text ("Spoiler") into the user's language. It seems safe to assume that Zulip content will always have `ZulipLocalizations.of` support wherever it appears in the widget tree. The language will be a client setting with a default value. There are certain other assumptions that `prepareContentBare` will probably want to avoid making, though, including: - that the content is rendered in a particular message - that the content is rendered in a message at all (#488) - that the content is rendered in a per-account context (#488) But we'll think more about that later, when we start using testContentSmoke in more places.
1 parent cb11c59 commit 4663118

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/widgets/content_test.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ void main() {
4040
TestZulipBinding.ensureInitialized();
4141

4242
Future<void> prepareContentBare(WidgetTester tester, String html) async {
43-
await tester.pumpWidget(MaterialApp(home: BlockContentList(nodes: parseContent(html).nodes)));
43+
await tester.pumpWidget(MaterialApp(
44+
localizationsDelegates: ZulipLocalizations.localizationsDelegates,
45+
supportedLocales: ZulipLocalizations.supportedLocales,
46+
home: BlockContentList(nodes: parseContent(html).nodes),
47+
));
4448
}
4549

4650
/// Test that the given content example renders without throwing an exception.

0 commit comments

Comments
 (0)