Skip to content

Commit

Permalink
content test: Support localizable UI text in smoke tests
Browse files Browse the repository at this point in the history
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 (zulip#488)
- that the content is rendered in a per-account context (zulip#488)

But we'll think more about that later, when we start using
testContentSmoke in more places.
  • Loading branch information
chrisbobbe authored and gnprice committed Feb 26, 2024
1 parent cb11c59 commit 4663118
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/widgets/content_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ void main() {
TestZulipBinding.ensureInitialized();

Future<void> prepareContentBare(WidgetTester tester, String html) async {
await tester.pumpWidget(MaterialApp(home: BlockContentList(nodes: parseContent(html).nodes)));
await tester.pumpWidget(MaterialApp(
localizationsDelegates: ZulipLocalizations.localizationsDelegates,
supportedLocales: ZulipLocalizations.supportedLocales,
home: BlockContentList(nodes: parseContent(html).nodes),
));
}

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

0 comments on commit 4663118

Please sign in to comment.