From b8fd33a629f4560edaf5b183fcdfd314fc290aa3 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 28 Jun 2021 11:54:23 +0200 Subject: [PATCH 1/3] fix new lines in list --- packages/stream_chat_flutter/lib/src/message_text.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/message_text.dart b/packages/stream_chat_flutter/lib/src/message_text.dart index e5abede06..6d0060853 100644 --- a/packages/stream_chat_flutter/lib/src/message_text.dart +++ b/packages/stream_chat_flutter/lib/src/message_text.dart @@ -29,7 +29,7 @@ class MessageText extends StatelessWidget { @override Widget build(BuildContext context) { - final text = _replaceMentions(message.text ?? '').replaceAll('\n', '\\\n'); + final text = _replaceMentions(message.text ?? '').replaceAll('\n', '\n\n'); final themeData = Theme.of(context); return MarkdownBody( From 0e263ee26def9d75ab245406acf1f7d388887535 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 28 Jun 2021 12:31:43 +0200 Subject: [PATCH 2/3] update melos.yaml --- melos.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/melos.yaml b/melos.yaml index 1fb51c38d..6232c3fa7 100644 --- a/melos.yaml +++ b/melos.yaml @@ -56,7 +56,7 @@ scripts: dir-exists: test test:flutter: - run: melos exec -c 1 --fail-fast -- "flutter test --coverage" + run: melos exec -c 3 --fail-fast -- "flutter test --coverage" description: Run Flutter tests for a specific package in this project. select-package: flutter: true From 9641926f0700c24122f3518a4a2449e87b258987 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 28 Jun 2021 15:31:36 +0200 Subject: [PATCH 3/3] add golden test --- .../test/src/goldens/message_text.png | Bin 0 -> 10173 bytes .../test/src/message_text_test.dart | 55 ++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 packages/stream_chat_flutter/test/src/goldens/message_text.png diff --git a/packages/stream_chat_flutter/test/src/goldens/message_text.png b/packages/stream_chat_flutter/test/src/goldens/message_text.png new file mode 100644 index 0000000000000000000000000000000000000000..dda158b267997036a5c7573fc56fe52d0813412d GIT binary patch literal 10173 zcmeHNcT|(|n-ckbS^ckk|={bT=|oWt>8zI=JV_kEsUd$@l=N1b<*&?XGS zcnKP3^f8QU4*mSd1OHRg()|Gb;d0YgKZVh2ca6X=>)cKe41a`|&yQDs!?0g4!WlI~ z&&Y{R`-`EZa?Urt4{8q51j$d0dde0b5AI1&h_@VawANH)+)d`U*n8VdxIp$q?gAq* z;lmEcLp3`(@5ROshNy38#sz=m+9RBFtn=}+17{uw$9rO{s?$?#33uW>N849eiSH=O zYc1q@@6Lr{iyAQ%6?P_uz19tnz}@rr?;7>Ouv_*ak01ZiYKGs4VfD`Ic4HX#kBS(^ zQ^456i)&<%`b#?Vzih?kQih#$9e-qTc&#}qsF%GR!r1YT{CQd<CfBt;#WTrpJ_E-!DD9@x~Uaz-K4RWk=Z)cu#Aih|1E;?uV0^(wQJU( z85$ZUdd&{mPIZ+nv$CmK-jhY@gM)+Q-g^Q#LTG3xEU5AQBVkfEWx;lCxWTR|S)1GH zGKM*pD%REe`T5DZ^quh{lO<$jjo55oOyx$43vZd~B7*GQwy;_G>M z6qzxRk(q-vVfM2_pUJ~<0fv^AbacG4%(_@s%?D=1ldfvKM_Gs;8a#0g_7>RNt$ zLPEZEod}`vjo*ebQOi2_oW!q;=SoOP8E0FT4Gaz%P5BiU7B(+=sHxpf zbPF4uotX&<3p*enAb?-!aC7zW2nz}dDrYa-0zNGmu`{g$J165Zzo1~+yFdYZ=su_C@yFFOEDCRkc)5P#A5? z&)9kBVr-a|uZdIXH-Ag&8c91^*@R|jZl3w@;TD4aSW8xDL_|h>{N7HtIy`M)^}N+` zh2)loh6cN@IfLune!zO%iDQD~FewWhA%mFR(voE+OBywF=qfcyN=o7td12d>EF^0e z(%0WF>oI9QI51$-l4&wCJ8N+5S`xG;3%b_6A^t41f5H4@rz8Q|UY|tDw;A=X%{Zs5+tG~DM%1q04vm8#I{DzxiQ(5_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HSNCYq8;o$*s^#Cmj1VI)AzEIi>^0Z_YhdBYJpZ@DIxVlyI)iSA#8#j`uFF$#K zZp?6t3Ro@EgbDlxGxWCr0ae#d`y{bAr7(dnboXIN{?}3a|DsR-Rqg)EdBR^80uKH6 zs&k1y! client.state).thenReturn(clientState); + when(() => clientState.user).thenReturn(OwnUser(id: 'user-id')); + when(() => channel.lastMessageAt).thenReturn(lastMessageAt); + when(() => channel.state).thenReturn(channelState); + when(() => channel.client).thenReturn(client); + when(() => channel.isMuted).thenReturn(false); + when(() => channel.isMutedStream).thenAnswer((i) => Stream.value(false)); + when(() => channel.extraDataStream).thenAnswer((i) => Stream.value({ + 'name': 'test', + })); + when(() => channel.extraData).thenReturn({ + 'name': 'test', + }); + + final messageText = '''a message. +with multiple lines +and a list: +- a. okasd +- b lllll + +cool.'''; + + await tester.pumpWidgetBuilder( + materialAppWrapper()(SimpleFrame( + child: StreamChannel( + channel: channel, + child: Scaffold( + body: MessageText( + message: Message( + text: messageText, + ), + messageTheme: streamTheme.otherMessageTheme, + ), + ), + ), + )), + surfaceSize: const Size(500, 500), + ); + await screenMatchesGolden(tester, 'message_text'); + }, + ); }