From df37668180f2e507996fa174d758dba53dc7e95e Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 27 Oct 2020 11:52:40 +0100 Subject: [PATCH] Merge pull request #3267 from overleaf/msm-react-chat-tests React chat tests GitOrigin-RevId: e3b4d5b7cb2657d9aad7e1006c18db4e6c0d8a3f --- .../js/features/chat/components/chat-pane.js | 2 +- .../chat/components/message-content.js | 4 +- .../features/chat/components/message-input.js | 2 +- services/web/package.json | 2 +- services/web/test/frontend/bootstrap.js | 12 ++ .../chat/components/chat-pane.test.js | 123 ++++++++++++++++++ .../chat/components/message-input.test.js | 56 ++++++++ .../chat/components/message-list.test.js | 110 ++++++++++++++++ .../features/chat/components/message.test.js | 116 +++++++++++++++++ .../features/chat/components/stubs.js | 35 +++++ 10 files changed, 457 insertions(+), 5 deletions(-) create mode 100644 services/web/test/frontend/features/chat/components/chat-pane.test.js create mode 100644 services/web/test/frontend/features/chat/components/message-input.test.js create mode 100644 services/web/test/frontend/features/chat/components/message-list.test.js create mode 100644 services/web/test/frontend/features/chat/components/message.test.js create mode 100644 services/web/test/frontend/features/chat/components/stubs.js diff --git a/services/web/frontend/js/features/chat/components/chat-pane.js b/services/web/frontend/js/features/chat/components/chat-pane.js index ab8e21660f..98dfbdc495 100644 --- a/services/web/frontend/js/features/chat/components/chat-pane.js +++ b/services/web/frontend/js/features/chat/components/chat-pane.js @@ -58,7 +58,7 @@ function LoadingSpinner() { return (
- {` ${t('loading')}...`} + {` ${t('loading')}…`}
) } diff --git a/services/web/frontend/js/features/chat/components/message-content.js b/services/web/frontend/js/features/chat/components/message-content.js index 9829d91bbf..eaa06a17a9 100644 --- a/services/web/frontend/js/features/chat/components/message-content.js +++ b/services/web/frontend/js/features/chat/components/message-content.js @@ -23,10 +23,10 @@ function MessageContent({ content }) { useEffect( () => { // adds attributes to all the links generated by , required due to https://github.com/tasti/react-linkify/issues/99 - root.current.getElementsByTagName('a').forEach(a => { + for (let a of root.current.getElementsByTagName('a')) { a.setAttribute('target', '_blank') a.setAttribute('rel', 'noreferrer noopener') - }) + } // MathJax typesetting const MJHub = window.MathJax.Hub diff --git a/services/web/frontend/js/features/chat/components/message-input.js b/services/web/frontend/js/features/chat/components/message-input.js index 56ff069674..ae3f2553b1 100644 --- a/services/web/frontend/js/features/chat/components/message-input.js +++ b/services/web/frontend/js/features/chat/components/message-input.js @@ -16,7 +16,7 @@ function MessageInput({ resetUnreadMessages, sendMessage }) { return (