From 74cc75a928bd2333f1fe7bae72354588b527e78f Mon Sep 17 00:00:00 2001 From: Sarthak Pranesh <41206172+sarthakpranesh@users.noreply.github.com> Date: Wed, 4 Mar 2020 19:27:07 +0530 Subject: [PATCH] [TESTS] Markdown added to Storybook (#1812) Co-authored-by: Diego Mello --- .../__snapshots__/Storyshots.test.js.snap | 3629 +++++++++++++++++ storybook/stories/Markdown.js | 279 ++ storybook/stories/index.js | 3 + 3 files changed, 3911 insertions(+) create mode 100644 storybook/stories/Markdown.js diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index e4dc638bc..f50118a00 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -1,5 +1,3634 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Storyshots Markdown list Markdown 1`] = ` + + + + Short Text + + + + + This is Rocket.Chat + + + + + Long Text + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + Line Break Text + + + + + a + + + + + + + b + + + + + + + c + + + + + + + + + + + d + + + + + + + + + + + + + + + e + + + + + Edited + + + + + This is edited + + + ( + edited + ) + + + + + Preview + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + a b c d e + + + @rocket.cat @name1 @all @here @unknown #general #unknown + + + Testing: 😃 👍 :marioparty: + + + + Mentions + + + + + rocket.cat + + + + + + name1 + + + + + + all + + + + + + here + + + + + + @unknown + + + + + Mentions with Real Name + + + + + Rocket Cat + + + + + + Name + + + + + + all + + + + + + here + + + + + + @unknown + + + + + Hashtag + + + + + test-channel + + + + + + #unknown + + + + + Emoji + + + + + Unicode: 😃😇👍 + + + + + Shortnames: + + + 😂 + + + 👍 + + + + + Custom emojis: + + + + + + + + + + + + + + + + + + + + 😃 + + + 👍 + + + + + + + + + + + Block Quote + + + + + + + + This is block quote + + + + + + + this is a normal line + + + + + Links + + + + + + Markdown link + + + + : + + + [description](url) + + + + + + Formatted Link + + + + : + + + <url|description> + + + + + Image + + + + + + + + Headers + + + + + Header 1 + + + + + Header 2 + + + + + Header 3 + + + + + Header 4 + + + + + Header 5 + + + + + Header 6 + + + + + Inline Code + + + + + This is + + + inline code + + + + + Code Block + + + + + Inline + + + code + + + has + + + back-ticks around + + + it. + + + + Code block + + + + + Lists + + + + + + • + + + + + + Open Source + + + + + + + + • + + + + + + Rocket.Chat + + + + + + ◦ + + + + + + nodejs + + + + + + + + ◦ + + + + + + ReactNative + + + + + + + + + Numbered Lists + + + + + + 1. + + + + + + Open Source + + + + + + + + 2. + + + + + + Rocket.Chat + + + + + + + Emphasis + + + + + Strong emphasis, aka bold, with + + + asterisks + + + or + + + underscores + + + + + Table + + + + + + + + + + + First Header + + + + + + + Second Header + + + + + + + + + Content from cell 1 + + + + + + + Content from cell 2 + + + + + + + + + Content in the first column + + + + + + + Content in the second column + + + + + + + + + Click to see full table + + + + + +`; + exports[`Storyshots Message list message 1`] = ` { + const customEmoji = { + marioparty: { name: content, extension: 'gif' }, + react_rocket: { name: content, extension: 'png' }, + nyan_rocket: { name: content, extension: 'png' } + }[content]; + return customEmoji; +}; + +// eslint-disable-next-line arrow-body-style +export default ({ theme }) => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is block quote +this is a normal line`} + theme={theme} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; diff --git a/storybook/stories/index.js b/storybook/stories/index.js index 4e8f82618..6e3a8114b 100644 --- a/storybook/stories/index.js +++ b/storybook/stories/index.js @@ -8,6 +8,7 @@ import RoomItem from './RoomItem'; import Message from './Message'; import UiKitMessage from './UiKitMessage'; import UiKitModal from './UiKitModal'; +import Markdown from './Markdown'; // import RoomViewHeader from './RoomViewHeader'; // Change here to see themed storybook @@ -35,6 +36,8 @@ storiesOf('UiKitMessage', module) .add('list uikitmessage', () => ); storiesOf('UiKitModal', module) .add('list UiKitModal', () => ); +storiesOf('Markdown', module) + .add('list Markdown', () => ); // FIXME: I couldn't make these pass on jest :( // storiesOf('RoomViewHeader', module)