summaryrefslogtreecommitdiffstats
path: root/webapp/tests
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-09-06 23:04:13 -0700
committerChristopher Speller <crspeller@gmail.com>2017-09-06 23:11:58 -0700
commitd8bd57901e33a7057e26e782e295099ffcc0da89 (patch)
treee12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/tests
parent7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff)
downloadchat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz
chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2
chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip
Removing webapp
Diffstat (limited to 'webapp/tests')
-rw-r--r--webapp/tests/.eslintrc.json15
-rw-r--r--webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap370
-rw-r--r--webapp/tests/components/__snapshots__/new_channel_modal.test.jsx.snap751
-rw-r--r--webapp/tests/components/__snapshots__/reset_status_modal.test.jsx.snap54
-rw-r--r--webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap237
-rw-r--r--webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap27
-rw-r--r--webapp/tests/components/about_build_modal.test.jsx129
-rw-r--r--webapp/tests/components/admin_console/__snapshots__/color_setting.test.jsx.snap95
-rw-r--r--webapp/tests/components/admin_console/color_setting.test.jsx55
-rw-r--r--webapp/tests/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap496
-rw-r--r--webapp/tests/components/admin_console/request_button/request_button.test.jsx215
-rw-r--r--webapp/tests/components/backstage/components/__snapshots__/backstage_header.test.jsx.snap31
-rw-r--r--webapp/tests/components/backstage/components/backstage_header.test.jsx26
-rw-r--r--webapp/tests/components/integrations/__snapshots__/add_command.test.jsx.snap396
-rw-r--r--webapp/tests/components/integrations/__snapshots__/add_incoming_hook.test.jsx.snap26
-rw-r--r--webapp/tests/components/integrations/__snapshots__/add_oauth_app.test.jsx.snap613
-rw-r--r--webapp/tests/components/integrations/__snapshots__/add_outgoing_hook.test.jsx.snap27
-rw-r--r--webapp/tests/components/integrations/__snapshots__/edit_command.test.jsx.snap424
-rw-r--r--webapp/tests/components/integrations/__snapshots__/edit_incoming_hook.test.jsx.snap7
-rw-r--r--webapp/tests/components/integrations/__snapshots__/edit_outgoing_hook.test.jsx.snap7
-rw-r--r--webapp/tests/components/integrations/__snapshots__/installed_command.test.jsx.snap103
-rw-r--r--webapp/tests/components/integrations/__snapshots__/installed_oauth_app.test.jsx.snap155
-rw-r--r--webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap100
-rw-r--r--webapp/tests/components/integrations/add_command.test.jsx30
-rw-r--r--webapp/tests/components/integrations/add_incoming_hook.test.jsx29
-rw-r--r--webapp/tests/components/integrations/add_oauth_app.test.jsx81
-rw-r--r--webapp/tests/components/integrations/add_outgoing_hook.test.jsx29
-rw-r--r--webapp/tests/components/integrations/edit_command.test.jsx36
-rw-r--r--webapp/tests/components/integrations/edit_incoming_hook.test.jsx30
-rw-r--r--webapp/tests/components/integrations/edit_outgoing_hook.test.jsx31
-rw-r--r--webapp/tests/components/integrations/installed_command.test.jsx83
-rw-r--r--webapp/tests/components/integrations/installed_oauth_app.test.jsx71
-rw-r--r--webapp/tests/components/integrations/installed_oauth_apps.test.jsx57
-rw-r--r--webapp/tests/components/new_channel_modal.test.jsx79
-rw-r--r--webapp/tests/components/post_view/post_info/__snapshots__/post_info.test.jsx.snap515
-rw-r--r--webapp/tests/components/post_view/post_info/post_info.test.jsx225
-rw-r--r--webapp/tests/components/reset_status_modal.test.jsx29
-rw-r--r--webapp/tests/components/shortcuts_modal.test.jsx25
-rw-r--r--webapp/tests/components/spinner_button.test.jsx53
-rw-r--r--webapp/tests/components/suggestion/suggestion_box.test.jsx16
-rw-r--r--webapp/tests/helpers/client-test-helper.jsx176
-rw-r--r--webapp/tests/helpers/intl-test-helper.jsx22
-rw-r--r--webapp/tests/plugins/__snapshots__/pluggable.test.jsx.snap111
-rw-r--r--webapp/tests/plugins/pluggable.test.jsx50
-rw-r--r--webapp/tests/utils/channel_utils.test.jsx782
-rw-r--r--webapp/tests/utils/emoticons.test.jsx36
-rw-r--r--webapp/tests/utils/formatting_at_mentions.test.jsx58
-rw-r--r--webapp/tests/utils/formatting_channel_links.test.jsx49
-rw-r--r--webapp/tests/utils/formatting_hashtags.test.jsx198
-rw-r--r--webapp/tests/utils/formatting_imgs.test.jsx53
-rw-r--r--webapp/tests/utils/formatting_links.test.jsx516
-rw-r--r--webapp/tests/utils/latinise.test.jsx23
-rw-r--r--webapp/tests/utils/post_utils.test.jsx147
-rw-r--r--webapp/tests/utils/utils_get_nearest_point.test.jsx31
54 files changed, 0 insertions, 8030 deletions
diff --git a/webapp/tests/.eslintrc.json b/webapp/tests/.eslintrc.json
deleted file mode 100644
index 37f08e664..000000000
--- a/webapp/tests/.eslintrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "rules": {
- "no-console": 0,
- "global-require": 0,
- "func-names": 0,
- "prefer-arrow-callback": 0,
- "no-magic-numbers": 0,
- "no-unreachable": 0,
- "new-cap": 0,
- "max-nested-callbacks": 0
- },
- "env": {
- "jest": true
- }
-}
diff --git a/webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap b/webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap
deleted file mode 100644
index b45b6b7f0..000000000
--- a/webapp/tests/components/__snapshots__/about_build_modal.test.jsx.snap
+++ /dev/null
@@ -1,370 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/AboutBuildModal should match snapshot for enterprise edition 1`] = `
-<Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogClassName="about-modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={true}
->
- <ModalHeader
- bsClass="modal-header"
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle
- bsClass="modal-title"
- componentClass="h4"
- >
- <FormattedMessage
- defaultMessage="About Mattermost"
- id="about.title"
- values={Object {}}
- />
- </ModalTitle>
- </ModalHeader>
- <ModalBody
- bsClass="modal-body"
- componentClass="div"
- >
- <div
- className="about-modal__content"
- >
- <div
- className="about-modal__logo"
- >
- <span
- className="icon"
- dangerouslySetInnerHTML={
- Object {
- "__html": "<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px'viewBox='0 0 500 500' style='enable-background:new 0 0 500 500;' xml:space='preserve'> <style type='text/css'> .st0{fill-rule:evenodd;clip-rule:evenodd;fill:#222222;} </style> <g id='XMLID_1_'> <g id='XMLID_3_'> <path id='XMLID_4_' class='st0' d='M396.9,47.7l2.6,53.1c43,47.5,60,114.8,38.6,178.1c-32,94.4-137.4,144.1-235.4,110.9 S51.1,253.1,83,158.7C104.5,95.2,159.2,52,222.5,40.5l34.2-40.4C150-2.8,49.3,63.4,13.3,169.9C-31,300.6,39.1,442.5,169.9,486.7 s272.6-25.8,316.9-156.6C522.7,223.9,483.1,110.3,396.9,47.7z'/> </g> <path id='XMLID_2_' class='st0' d='M335.6,204.3l-1.8-74.2l-1.5-42.7l-1-37c0,0,0.2-17.8-0.4-22c-0.1-0.9-0.4-1.6-0.7-2.2 c0-0.1-0.1-0.2-0.1-0.3c0-0.1-0.1-0.2-0.1-0.2c-0.7-1.2-1.8-2.1-3.1-2.6c-1.4-0.5-2.9-0.4-4.2,0.2c0,0-0.1,0-0.1,0 c-0.2,0.1-0.3,0.1-0.4,0.2c-0.6,0.3-1.2,0.7-1.8,1.3c-3,3-13.7,17.2-13.7,17.2l-23.2,28.8l-27.1,33l-46.5,57.8 c0,0-21.3,26.6-16.6,59.4s29.1,48.7,48,55.1c18.9,6.4,48,8.5,71.6-14.7C336.4,238.4,335.6,204.3,335.6,204.3z'/> </g> </svg>",
- }
- }
- />
- </div>
- <div>
- <h3
- className="about-modal__title"
- >
- Mattermost
-
- <FormattedMessage
- defaultMessage="Enterprise Edition"
- id="about.teamEditiont1"
- values={Object {}}
- />
- </h3>
- <p
- className="about-modal__subtitle padding-bottom"
- >
- <FormattedMessage
- defaultMessage="Modern communication from behind your firewall."
- id="about.enterpriseEditionSt"
- values={Object {}}
- />
- </p>
- <div
- className="form-group less"
- >
- <div>
- <FormattedMessage
- defaultMessage="Version:"
- id="about.version"
- values={Object {}}
- />
- <span
- id="versionString"
- >
-  3.6.0  (3.6.2)
- </span>
- </div>
- <div>
- <FormattedMessage
- defaultMessage="Database:"
- id="about.database"
- values={Object {}}
- />
-  Postgres
- </div>
- </div>
- </div>
- </div>
- <div
- className="about-modal__footer"
- >
- <div>
- <FormattedMessage
- defaultMessage="Learn more about Enterprise Edition at "
- id="about.enterpriseEditionLearn"
- values={Object {}}
- />
- <a
- href="http://about.mattermost.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- about.mattermost.com
- </a>
- </div>
- <div
- className="form-group about-modal__copyright"
- >
- <FormattedMessage
- defaultMessage="Copyright 2015 - {currentYear} Mattermost, Inc. All rights reserved"
- id="about.copyright"
- values={
- Object {
- "currentYear": 2017,
- }
- }
- />
- </div>
- </div>
- <div
- className="about-modal__notice form-group padding-top x2"
- >
- <p>
- <FormattedHTMLMessage
- defaultMessage="Mattermost is made possible by the open source software used in our <a href=\\"https://about.mattermost.com/platform-notice-txt/\\" target=\\"_blank\\">platform</a>, <a href=\\"https://about.mattermost.com/desktop-notice-txt/\\" target=\\"_blank\\">desktop</a> and <a href=\\"https://about.mattermost.com/mobile-notice-txt/\\" target=\\"_blank\\">mobile</a> apps."
- id="about.notice"
- values={Object {}}
- />
- </p>
- </div>
- <div
- className="about-modal__hash"
- >
- <p>
- <FormattedMessage
- defaultMessage="Build Hash:"
- id="about.hash"
- values={Object {}}
- />
-  
- abcdef1234567890
- <br />
- <FormattedMessage
- defaultMessage="EE Build Hash:"
- id="about.hashee"
- values={Object {}}
- />
-  
- 0123456789abcdef
- </p>
- <p>
- <FormattedMessage
- defaultMessage="Build Date:"
- id="about.date"
- values={Object {}}
- />
-  
- 21 January 2017
- </p>
- </div>
- </ModalBody>
-</Modal>
-`;
-
-exports[`components/AboutBuildModal should match snapshot for team edition 1`] = `
-<Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogClassName="about-modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={true}
->
- <ModalHeader
- bsClass="modal-header"
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle
- bsClass="modal-title"
- componentClass="h4"
- >
- <FormattedMessage
- defaultMessage="About Mattermost"
- id="about.title"
- values={Object {}}
- />
- </ModalTitle>
- </ModalHeader>
- <ModalBody
- bsClass="modal-body"
- componentClass="div"
- >
- <div
- className="about-modal__content"
- >
- <div
- className="about-modal__logo"
- >
- <span
- className="icon"
- dangerouslySetInnerHTML={
- Object {
- "__html": "<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px'viewBox='0 0 500 500' style='enable-background:new 0 0 500 500;' xml:space='preserve'> <style type='text/css'> .st0{fill-rule:evenodd;clip-rule:evenodd;fill:#222222;} </style> <g id='XMLID_1_'> <g id='XMLID_3_'> <path id='XMLID_4_' class='st0' d='M396.9,47.7l2.6,53.1c43,47.5,60,114.8,38.6,178.1c-32,94.4-137.4,144.1-235.4,110.9 S51.1,253.1,83,158.7C104.5,95.2,159.2,52,222.5,40.5l34.2-40.4C150-2.8,49.3,63.4,13.3,169.9C-31,300.6,39.1,442.5,169.9,486.7 s272.6-25.8,316.9-156.6C522.7,223.9,483.1,110.3,396.9,47.7z'/> </g> <path id='XMLID_2_' class='st0' d='M335.6,204.3l-1.8-74.2l-1.5-42.7l-1-37c0,0,0.2-17.8-0.4-22c-0.1-0.9-0.4-1.6-0.7-2.2 c0-0.1-0.1-0.2-0.1-0.3c0-0.1-0.1-0.2-0.1-0.2c-0.7-1.2-1.8-2.1-3.1-2.6c-1.4-0.5-2.9-0.4-4.2,0.2c0,0-0.1,0-0.1,0 c-0.2,0.1-0.3,0.1-0.4,0.2c-0.6,0.3-1.2,0.7-1.8,1.3c-3,3-13.7,17.2-13.7,17.2l-23.2,28.8l-27.1,33l-46.5,57.8 c0,0-21.3,26.6-16.6,59.4s29.1,48.7,48,55.1c18.9,6.4,48,8.5,71.6-14.7C336.4,238.4,335.6,204.3,335.6,204.3z'/> </g> </svg>",
- }
- }
- />
- </div>
- <div>
- <h3
- className="about-modal__title"
- >
- Mattermost
-
- <FormattedMessage
- defaultMessage="Team Edition"
- id="about.teamEditiont0"
- values={Object {}}
- />
- </h3>
- <p
- className="about-modal__subtitle padding-bottom"
- >
- <FormattedMessage
- defaultMessage="All your team communication in one place, instantly searchable and accessible anywhere."
- id="about.teamEditionSt"
- values={Object {}}
- />
- </p>
- <div
- className="form-group less"
- >
- <div>
- <FormattedMessage
- defaultMessage="Version:"
- id="about.version"
- values={Object {}}
- />
- <span
- id="versionString"
- >
-  3.6.0  (3.6.2)
- </span>
- </div>
- <div>
- <FormattedMessage
- defaultMessage="Database:"
- id="about.database"
- values={Object {}}
- />
-  Postgres
- </div>
- </div>
- </div>
- </div>
- <div
- className="about-modal__footer"
- >
- <div>
- <FormattedMessage
- defaultMessage="Join the Mattermost community at "
- id="about.teamEditionLearn"
- values={Object {}}
- />
- <a
- href="http://www.mattermost.org/"
- rel="noopener noreferrer"
- target="_blank"
- >
- mattermost.org
- </a>
- </div>
- <div
- className="form-group about-modal__copyright"
- >
- <FormattedMessage
- defaultMessage="Copyright 2015 - {currentYear} Mattermost, Inc. All rights reserved"
- id="about.copyright"
- values={
- Object {
- "currentYear": 2017,
- }
- }
- />
- </div>
- </div>
- <div
- className="about-modal__notice form-group padding-top x2"
- >
- <p>
- <FormattedHTMLMessage
- defaultMessage="Mattermost is made possible by the open source software used in our <a href=\\"https://about.mattermost.com/platform-notice-txt/\\" target=\\"_blank\\">platform</a>, <a href=\\"https://about.mattermost.com/desktop-notice-txt/\\" target=\\"_blank\\">desktop</a> and <a href=\\"https://about.mattermost.com/mobile-notice-txt/\\" target=\\"_blank\\">mobile</a> apps."
- id="about.notice"
- values={Object {}}
- />
- </p>
- </div>
- <div
- className="about-modal__hash"
- >
- <p>
- <FormattedMessage
- defaultMessage="Build Hash:"
- id="about.hash"
- values={Object {}}
- />
-  
- abcdef1234567890
- <br />
- <FormattedMessage
- defaultMessage="EE Build Hash:"
- id="about.hashee"
- values={Object {}}
- />
-  
- </p>
- <p>
- <FormattedMessage
- defaultMessage="Build Date:"
- id="about.date"
- values={Object {}}
- />
-  
- 21 January 2017
- </p>
- </div>
- </ModalBody>
-</Modal>
-`;
diff --git a/webapp/tests/components/__snapshots__/new_channel_modal.test.jsx.snap b/webapp/tests/components/__snapshots__/new_channel_modal.test.jsx.snap
deleted file mode 100644
index c5582dc7d..000000000
--- a/webapp/tests/components/__snapshots__/new_channel_modal.test.jsx.snap
+++ /dev/null
@@ -1,751 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/NewChannelModal should match snapshot, modal not showing 1`] = `
-<span>
- <Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- bsSize="large"
- dialogClassName="new-channel__modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={true}
- >
- <ModalHeader
- bsClass="modal-header"
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle
- bsClass="modal-title"
- componentClass="h4"
- >
- <FormattedMessage
- defaultMessage="New Channel"
- id="channel_modal.modalTitle"
- values={Object {}}
- />
- </ModalTitle>
- </ModalHeader>
- <form
- className="form-horizontal"
- role="form"
- >
- <ModalBody
- bsClass="modal-body"
- componentClass="div"
- >
- <div>
- <div
- className="modal-intro"
- >
- <FormattedMessage
- defaultMessage="Create a new public channel anyone can join. "
- id="channel_modal.publicChannel2"
- values={Object {}}
- />
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Create a private channel"
- id="channel_modal.privateGroup2"
- values={Object {}}
- />
- </a>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="col-sm-3 form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Name"
- id="channel_modal.name"
- values={Object {}}
- />
- </label>
- <div
- className="col-sm-9"
- >
- <input
- autoFocus={true}
- className="form-control"
- id="newPublicChannelName"
- maxLength={22}
- onChange={[Function]}
- placeholder="E.g.: \\"Bugs\\", \\"Marketing\\", \\"客户支持\\""
- tabIndex="1"
- type="text"
- value="testchannel"
- />
- <p
- className="input__help dark"
- >
- URL: /testchannel (
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Edit"
- id="channel_modal.edit"
- values={Object {}}
- />
- </a>
- )
- </p>
- </div>
- </div>
- <div
- className="form-group"
- >
- <div
- className="col-sm-3"
- >
- <label
- className="form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Purpose"
- id="channel_modal.purpose"
- values={Object {}}
- />
- </label>
- <label
- className="form__label light"
- >
- <FormattedMessage
- defaultMessage="(optional)"
- id="channel_modal.optional"
- values={Object {}}
- />
- </label>
- </div>
- <div
- className="col-sm-9"
- >
- <textarea
- className="form-control no-resize"
- id="newPublicChannelPurpose"
- maxLength="250"
- onChange={[Function]}
- placeholder="E.g.: \\"A channel to file bugs and improvements\\""
- rows="4"
- tabIndex="2"
- value=""
- />
- <p
- className="input__help"
- >
- <FormattedMessage
- defaultMessage="Describe how this channel should be used."
- id="channel_modal.descriptionHelp"
- values={Object {}}
- />
- </p>
- </div>
- </div>
- <div
- className="form-group less"
- >
- <div
- className="col-sm-3"
- >
- <label
- className="form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Header"
- id="channel_modal.header"
- values={Object {}}
- />
- </label>
- <label
- className="form__label light"
- >
- <FormattedMessage
- defaultMessage="(optional)"
- id="channel_modal.optional"
- values={Object {}}
- />
- </label>
- </div>
- <div
- className="col-sm-9"
- >
- <textarea
- className="form-control no-resize"
- id="newPublicChannelHeader"
- maxLength="1024"
- onChange={[Function]}
- placeholder="E.g.: \\"[Link Title](http://example.com)\\""
- rows="4"
- tabIndex="2"
- value=""
- />
- <p
- className="input__help"
- >
- <FormattedMessage
- defaultMessage="Set text that will appear in the header of the channel beside the channel name. For example, include frequently used links by typing [Link Title](http://example.com)."
- id="channel_modal.headerHelp"
- values={Object {}}
- />
- </p>
- </div>
- </div>
- </ModalBody>
- <ModalFooter
- bsClass="modal-footer"
- componentClass="div"
- >
- <button
- className="btn btn-default"
- onClick={[Function]}
- type="button"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="channel_modal.cancel"
- values={Object {}}
- />
- </button>
- <button
- className="btn btn-primary"
- onClick={[Function]}
- tabIndex="3"
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Create New Channel"
- id="channel_modal.createNew"
- values={Object {}}
- />
- </button>
- </ModalFooter>
- </form>
- </Modal>
-</span>
-`;
-
-exports[`components/NewChannelModal should match snapshot, modal showing 1`] = `
-<span>
- <Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- bsSize="large"
- dialogClassName="new-channel__modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={true}
- >
- <ModalHeader
- bsClass="modal-header"
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle
- bsClass="modal-title"
- componentClass="h4"
- >
- <FormattedMessage
- defaultMessage="New Channel"
- id="channel_modal.modalTitle"
- values={Object {}}
- />
- </ModalTitle>
- </ModalHeader>
- <form
- className="form-horizontal"
- role="form"
- >
- <ModalBody
- bsClass="modal-body"
- componentClass="div"
- >
- <div>
- <div
- className="modal-intro"
- >
- <FormattedMessage
- defaultMessage="Create a new public channel anyone can join. "
- id="channel_modal.publicChannel2"
- values={Object {}}
- />
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Create a private channel"
- id="channel_modal.privateGroup2"
- values={Object {}}
- />
- </a>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="col-sm-3 form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Name"
- id="channel_modal.name"
- values={Object {}}
- />
- </label>
- <div
- className="col-sm-9"
- >
- <input
- autoFocus={true}
- className="form-control"
- id="newPublicChannelName"
- maxLength={22}
- onChange={[Function]}
- placeholder="E.g.: \\"Bugs\\", \\"Marketing\\", \\"客户支持\\""
- tabIndex="1"
- type="text"
- value="testchannel"
- />
- <p
- className="input__help dark"
- >
- URL: /testchannel (
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Edit"
- id="channel_modal.edit"
- values={Object {}}
- />
- </a>
- )
- </p>
- </div>
- </div>
- <div
- className="form-group"
- >
- <div
- className="col-sm-3"
- >
- <label
- className="form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Purpose"
- id="channel_modal.purpose"
- values={Object {}}
- />
- </label>
- <label
- className="form__label light"
- >
- <FormattedMessage
- defaultMessage="(optional)"
- id="channel_modal.optional"
- values={Object {}}
- />
- </label>
- </div>
- <div
- className="col-sm-9"
- >
- <textarea
- className="form-control no-resize"
- id="newPublicChannelPurpose"
- maxLength="250"
- onChange={[Function]}
- placeholder="E.g.: \\"A channel to file bugs and improvements\\""
- rows="4"
- tabIndex="2"
- value=""
- />
- <p
- className="input__help"
- >
- <FormattedMessage
- defaultMessage="Describe how this channel should be used."
- id="channel_modal.descriptionHelp"
- values={Object {}}
- />
- </p>
- </div>
- </div>
- <div
- className="form-group less"
- >
- <div
- className="col-sm-3"
- >
- <label
- className="form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Header"
- id="channel_modal.header"
- values={Object {}}
- />
- </label>
- <label
- className="form__label light"
- >
- <FormattedMessage
- defaultMessage="(optional)"
- id="channel_modal.optional"
- values={Object {}}
- />
- </label>
- </div>
- <div
- className="col-sm-9"
- >
- <textarea
- className="form-control no-resize"
- id="newPublicChannelHeader"
- maxLength="1024"
- onChange={[Function]}
- placeholder="E.g.: \\"[Link Title](http://example.com)\\""
- rows="4"
- tabIndex="2"
- value=""
- />
- <p
- className="input__help"
- >
- <FormattedMessage
- defaultMessage="Set text that will appear in the header of the channel beside the channel name. For example, include frequently used links by typing [Link Title](http://example.com)."
- id="channel_modal.headerHelp"
- values={Object {}}
- />
- </p>
- </div>
- </div>
- </ModalBody>
- <ModalFooter
- bsClass="modal-footer"
- componentClass="div"
- >
- <button
- className="btn btn-default"
- onClick={[Function]}
- type="button"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="channel_modal.cancel"
- values={Object {}}
- />
- </button>
- <button
- className="btn btn-primary"
- onClick={[Function]}
- tabIndex="3"
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Create New Channel"
- id="channel_modal.createNew"
- values={Object {}}
- />
- </button>
- </ModalFooter>
- </form>
- </Modal>
-</span>
-`;
-
-exports[`components/NewChannelModal should match snapshot, private channel filled in header and purpose 1`] = `
-<span>
- <Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- bsSize="large"
- dialogClassName="new-channel__modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={true}
- >
- <ModalHeader
- bsClass="modal-header"
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle
- bsClass="modal-title"
- componentClass="h4"
- >
- <FormattedMessage
- defaultMessage="New Channel"
- id="channel_modal.modalTitle"
- values={Object {}}
- />
- </ModalTitle>
- </ModalHeader>
- <form
- className="form-horizontal"
- role="form"
- >
- <ModalBody
- bsClass="modal-body"
- componentClass="div"
- >
- <div>
- <div
- className="modal-intro"
- >
- <FormattedMessage
- defaultMessage="Create a new private channel with restricted membership. "
- id="channel_modal.privateGroup1"
- values={Object {}}
- />
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Create a public channel"
- id="channel_modal.publicChannel1"
- values={Object {}}
- />
- </a>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="col-sm-3 form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Name"
- id="channel_modal.name"
- values={Object {}}
- />
- </label>
- <div
- className="col-sm-9"
- >
- <input
- autoFocus={true}
- className="form-control"
- id="newPrivateChannelName"
- maxLength={22}
- onChange={[Function]}
- placeholder="E.g.: \\"Bugs\\", \\"Marketing\\", \\"客户支持\\""
- tabIndex="1"
- type="text"
- value="testchannel"
- />
- <p
- className="input__help dark"
- >
- URL: /testchannel (
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Edit"
- id="channel_modal.edit"
- values={Object {}}
- />
- </a>
- )
- </p>
- </div>
- </div>
- <div
- className="form-group"
- >
- <div
- className="col-sm-3"
- >
- <label
- className="form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Purpose"
- id="channel_modal.purpose"
- values={Object {}}
- />
- </label>
- <label
- className="form__label light"
- >
- <FormattedMessage
- defaultMessage="(optional)"
- id="channel_modal.optional"
- values={Object {}}
- />
- </label>
- </div>
- <div
- className="col-sm-9"
- >
- <textarea
- className="form-control no-resize"
- id="newPrivateChannelPurpose"
- maxLength="250"
- onChange={[Function]}
- placeholder="E.g.: \\"A channel to file bugs and improvements\\""
- rows="4"
- tabIndex="2"
- value="some purpose"
- />
- <p
- className="input__help"
- >
- <FormattedMessage
- defaultMessage="Describe how this channel should be used."
- id="channel_modal.descriptionHelp"
- values={Object {}}
- />
- </p>
- </div>
- </div>
- <div
- className="form-group less"
- >
- <div
- className="col-sm-3"
- >
- <label
- className="form__label control-label"
- >
- <FormattedMessage
- defaultMessage="Header"
- id="channel_modal.header"
- values={Object {}}
- />
- </label>
- <label
- className="form__label light"
- >
- <FormattedMessage
- defaultMessage="(optional)"
- id="channel_modal.optional"
- values={Object {}}
- />
- </label>
- </div>
- <div
- className="col-sm-9"
- >
- <textarea
- className="form-control no-resize"
- id="newPrivateChannelHeader"
- maxLength="1024"
- onChange={[Function]}
- placeholder="E.g.: \\"[Link Title](http://example.com)\\""
- rows="4"
- tabIndex="2"
- value="some header"
- />
- <p
- className="input__help"
- >
- <FormattedMessage
- defaultMessage="Set text that will appear in the header of the channel beside the channel name. For example, include frequently used links by typing [Link Title](http://example.com)."
- id="channel_modal.headerHelp"
- values={Object {}}
- />
- </p>
- </div>
- </div>
- </ModalBody>
- <ModalFooter
- bsClass="modal-footer"
- componentClass="div"
- >
- <button
- className="btn btn-default"
- onClick={[Function]}
- type="button"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="channel_modal.cancel"
- values={Object {}}
- />
- </button>
- <button
- className="btn btn-primary"
- onClick={[Function]}
- tabIndex="3"
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Create New Channel"
- id="channel_modal.createNew"
- values={Object {}}
- />
- </button>
- </ModalFooter>
- </form>
- </Modal>
-</span>
-`;
diff --git a/webapp/tests/components/__snapshots__/reset_status_modal.test.jsx.snap b/webapp/tests/components/__snapshots__/reset_status_modal.test.jsx.snap
deleted file mode 100644
index e27dd0d44..000000000
--- a/webapp/tests/components/__snapshots__/reset_status_modal.test.jsx.snap
+++ /dev/null
@@ -1,54 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/ResetStatusModal should match snapshot 1`] = `
-<ConfirmModal
- cancelButtonText={
- <FormattedMessage
- defaultMessage="No, keep it as \\"{status}\\""
- id="modal.manaul_status.cancel"
- values={
- Object {
- "status": "",
- }
- }
- />
- }
- checkboxText={
- <FormattedMessage
- defaultMessage="Do not ask me again"
- id="modal.manaul_status.ask"
- values={Object {}}
- />
- }
- confirmButtonClass="btn btn-primary"
- confirmButtonText={
- <FormattedMessage
- defaultMessage="Yes, set my status to \\"Online\\""
- id="modal.manaul_status.button"
- values={Object {}}
- />
- }
- message={
- <FormattedMessage
- defaultMessage="Would you like to switch your status to \\"Online\\"?"
- id="modal.manaul_status.message"
- values={Object {}}
- />
- }
- onCancel={[Function]}
- onConfirm={[Function]}
- show={false}
- showCheckbox={true}
- title={
- <FormattedMessage
- defaultMessage="Your status is set to \\"{status}\\""
- id="modal.manaul_status.title"
- values={
- Object {
- "status": "",
- }
- }
- />
- }
-/>
-`;
diff --git a/webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap b/webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap
deleted file mode 100644
index cfe719ba4..000000000
--- a/webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap
+++ /dev/null
@@ -1,237 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/ShortcutsModal should match snapshot modal for Mac 1`] = `
-<InjectIntl(ShortcutsModal)
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- isMac={true}
->
- <ShortcutsModal
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- isMac={true}
- >
- <Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogClassName="shortcuts-modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- transition={[Function]}
- />
- </Modal>
- </ShortcutsModal>
-</InjectIntl(ShortcutsModal)>
-`;
-
-exports[`components/ShortcutsModal should match snapshot modal for non-Mac like Windows/Linux 1`] = `
-<InjectIntl(ShortcutsModal)
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- isMac={false}
->
- <ShortcutsModal
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- isMac={false}
- >
- <Modal
- animation={true}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogClassName="shortcuts-modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "add": [Function],
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "isTopModal": [Function],
- "modals": Array [],
- "remove": [Function],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- transition={[Function]}
- />
- </Modal>
- </ShortcutsModal>
-</InjectIntl(ShortcutsModal)>
-`;
diff --git a/webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap b/webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap
deleted file mode 100644
index e05132ddd..000000000
--- a/webapp/tests/components/__snapshots__/spinner_button.test.jsx.snap
+++ /dev/null
@@ -1,27 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/SpinnerButton should match snapshot with children 1`] = `
-<button
- className="btn btn-primary"
->
- <span
- id="child1"
- />
- <span
- id="child2"
- />
-</button>
-`;
-
-exports[`components/SpinnerButton should match snapshot with required props 1`] = `
-<button
- className="btn btn-primary"
-/>
-`;
-
-exports[`components/SpinnerButton should match snapshot with spinning 1`] = `
-<img
- className="spinner-button__gif"
- src={Object {}}
-/>
-`;
diff --git a/webapp/tests/components/about_build_modal.test.jsx b/webapp/tests/components/about_build_modal.test.jsx
deleted file mode 100644
index c780c1ff9..000000000
--- a/webapp/tests/components/about_build_modal.test.jsx
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-import {mountWithIntl} from 'tests/helpers/intl-test-helper.jsx';
-
-import AboutBuildModal from 'components/about_build_modal.jsx';
-import {Modal} from 'react-bootstrap';
-
-describe('components/AboutBuildModal', () => {
- afterEach(() => {
- global.window.mm_config = null;
- global.window.mm_license = null;
- });
-
- test('should match snapshot for enterprise edition', () => {
- global.window.mm_config = {
- BuildEnterpriseReady: 'true',
- Version: '3.6.0',
- BuildNumber: '3.6.2',
- SQLDriverName: 'Postgres',
- BuildHash: 'abcdef1234567890',
- BuildHashEnterprise: '0123456789abcdef',
- BuildDate: '21 January 2017'
- };
-
- global.window.mm_license = {
- isLicensed: 'true',
- Company: 'Mattermost Inc'
- };
-
- const wrapper = shallow(
- <AboutBuildModal
- show={true}
- onModalDismissed={null}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot for team edition', () => {
- global.window.mm_config = {
- BuildEnterpriseReady: 'false',
- Version: '3.6.0',
- BuildNumber: '3.6.2',
- SQLDriverName: 'Postgres',
- BuildHash: 'abcdef1234567890',
- BuildDate: '21 January 2017'
- };
-
- global.window.mm_license = null;
-
- const wrapper = shallow(
- <AboutBuildModal
- show={true}
- onModalDismissed={null}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should hide the build number if it is the same as the version number', () => {
- global.window.mm_config = {
- BuildEnterpriseReady: 'false',
- Version: '3.6.0',
- BuildNumber: '3.6.0',
- SQLDriverName: 'Postgres',
- BuildHash: 'abcdef1234567890',
- BuildDate: '21 January 2017'
- };
-
- global.window.mm_license = null;
-
- const wrapper = shallow(
- <AboutBuildModal
- show={true}
- onModalDismissed={null}
- />
- );
- expect(wrapper.find('#versionString').text()).toBe(' 3.6.0');
- });
-
- test('should show the build number if it is the different from the version number', () => {
- global.window.mm_config = {
- BuildEnterpriseReady: 'false',
- Version: '3.6.0',
- BuildNumber: '3.6.2',
- SQLDriverName: 'Postgres',
- BuildHash: 'abcdef1234567890',
- BuildDate: '21 January 2017'
- };
-
- global.window.mm_license = null;
-
- const wrapper = shallow(
- <AboutBuildModal
- show={true}
- onModalDismissed={null}
- />
- );
- expect(wrapper.find('#versionString').text()).toBe(' 3.6.0\u00a0 (3.6.2)');
- });
-
- test('should call onModalDismissed callback when the modal is hidden', (done) => {
- global.window.mm_config = {
- BuildEnterpriseReady: 'false',
- Version: '3.6.0',
- BuildNumber: '3.6.2',
- SQLDriverName: 'Postgres',
- BuildHash: 'abcdef1234567890',
- BuildDate: '21 January 2017'
- };
-
- global.window.mm_license = null;
-
- function onHide() {
- done();
- }
-
- const wrapper = mountWithIntl(
- <AboutBuildModal
- show={true}
- onModalDismissed={onHide}
- />
- );
- wrapper.find(Modal).first().props().onHide();
- });
-});
diff --git a/webapp/tests/components/admin_console/__snapshots__/color_setting.test.jsx.snap b/webapp/tests/components/admin_console/__snapshots__/color_setting.test.jsx.snap
deleted file mode 100644
index 7b8c934ce..000000000
--- a/webapp/tests/components/admin_console/__snapshots__/color_setting.test.jsx.snap
+++ /dev/null
@@ -1,95 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/ColorSetting should match snapshot, all 1`] = `
-<Settings
- helpText="helptext"
- inputId="id"
- label="label"
->
- <div
- className="input-group color-picker colorpicker-element"
- >
- <input
- className="form-control"
- disabled={false}
- onChange={[Function]}
- type="text"
- value="#fff"
- />
- <span
- className="input-group-addon picker-id"
- onClick={[Function]}
- >
- <i
- style={
- Object {
- "backgroundColor": "#fff",
- }
- }
- />
- </span>
- </div>
-</Settings>
-`;
-
-exports[`components/ColorSetting should match snapshot, disabled 1`] = `
-<Settings
- inputId="id"
- label="label"
->
- <div
- className="input-group color-picker colorpicker-element"
- >
- <input
- className="form-control"
- disabled={true}
- onChange={[Function]}
- type="text"
- value="#fff"
- />
- <span
- className="input-group-addon picker-id"
- onClick={[Function]}
- >
- <i
- style={
- Object {
- "backgroundColor": "#fff",
- }
- }
- />
- </span>
- </div>
-</Settings>
-`;
-
-exports[`components/ColorSetting should match snapshot, no help text 1`] = `
-<Settings
- inputId="id"
- label="label"
->
- <div
- className="input-group color-picker colorpicker-element"
- >
- <input
- className="form-control"
- disabled={false}
- onChange={[Function]}
- type="text"
- value="#fff"
- />
- <span
- className="input-group-addon picker-id"
- onClick={[Function]}
- >
- <i
- style={
- Object {
- "backgroundColor": "#fff",
- }
- }
- />
- </span>
- </div>
-</Settings>
-`;
diff --git a/webapp/tests/components/admin_console/color_setting.test.jsx b/webapp/tests/components/admin_console/color_setting.test.jsx
deleted file mode 100644
index a1c44a037..000000000
--- a/webapp/tests/components/admin_console/color_setting.test.jsx
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import ColorSetting from 'components/admin_console/color_setting.jsx';
-
-describe('components/ColorSetting', () => {
- test('should match snapshot, all', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- const wrapper = shallow(
- <ColorSetting
- id='id'
- label='label'
- helpText='helptext'
- value='#fff'
- onChange={emptyFunction}
- disabled={false}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, no help text', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- const wrapper = shallow(
- <ColorSetting
- id='id'
- label='label'
- value='#fff'
- onChange={emptyFunction}
- disabled={false}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, disabled', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- const wrapper = shallow(
- <ColorSetting
- id='id'
- label='label'
- value='#fff'
- onChange={emptyFunction}
- disabled={true}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap b/webapp/tests/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap
deleted file mode 100644
index 83e372564..000000000
--- a/webapp/tests/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap
+++ /dev/null
@@ -1,496 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/admin_console/request_button/request_button.jsx should match snapshot 1`] = `
-<div
- className="form-group"
->
- <div
- className="col-sm-offset-4 col-sm-8"
- >
- <div>
- <button
- className="btn btn-default"
- disabled={false}
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- />
- </button>
- </div>
- <div
- className="help-text"
- >
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- />
- </div>
- </div>
-</div>
-`;
-
-exports[`components/admin_console/request_button/request_button.jsx should match snapshot with request error 1`] = `
-<RequestButton
- buttonText={
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- />
- }
- disabled={false}
- errorMessage={
- Object {
- "defaultMessage": "Error Message: {error}",
- "id": "error.message",
- }
- }
- helpText={
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- />
- }
- includeDetailedError={true}
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- requestAction={[Function]}
- saveNeeded={false}
- showSuccessMessage={true}
- successMessage={
- Object {
- "defaultMessage": "Test Successful",
- "id": "admin.requestButton.requestSuccess",
- }
- }
->
- <div
- className="form-group"
- >
- <div
- className="col-sm-offset-4 col-sm-8"
- >
- <div>
- <button
- className="btn btn-default"
- disabled={false}
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- >
- <span>
- Button Text
- </span>
- </FormattedMessage>
- </button>
- <div>
- <div
- className="alert alert-warning"
- >
- <i
- className="fa fa-warning"
- />
- <FormattedMessage
- defaultMessage="Error Message: {error}"
- id="error.message"
- values={
- Object {
- "error": "__message__ - __detailed_error__",
- }
- }
- >
- <span>
- Error Message: __message__ - __detailed_error__
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
- <div
- className="help-text"
- >
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- >
- <span>
- Help Text
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
-</RequestButton>
-`;
-
-exports[`components/admin_console/request_button/request_button.jsx should match snapshot with request error 2`] = `
-<RequestButton
- buttonText={
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- />
- }
- disabled={false}
- errorMessage={
- Object {
- "defaultMessage": "Error Message: {error}",
- "id": "error.message",
- }
- }
- helpText={
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- />
- }
- includeDetailedError={false}
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- requestAction={[Function]}
- saveNeeded={false}
- showSuccessMessage={true}
- successMessage={
- Object {
- "defaultMessage": "Test Successful",
- "id": "admin.requestButton.requestSuccess",
- }
- }
->
- <div
- className="form-group"
- >
- <div
- className="col-sm-offset-4 col-sm-8"
- >
- <div>
- <button
- className="btn btn-default"
- disabled={false}
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- >
- <span>
- Button Text
- </span>
- </FormattedMessage>
- </button>
- <div>
- <div
- className="alert alert-warning"
- >
- <i
- className="fa fa-warning"
- />
- <FormattedMessage
- defaultMessage="Error Message: {error}"
- id="error.message"
- values={
- Object {
- "error": "__message__",
- }
- }
- >
- <span>
- Error Message: __message__
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
- <div
- className="help-text"
- >
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- >
- <span>
- Help Text
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
-</RequestButton>
-`;
-
-exports[`components/admin_console/request_button/request_button.jsx should match snapshot with successMessage 1`] = `
-<RequestButton
- buttonText={
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- />
- }
- disabled={false}
- errorMessage={
- Object {
- "defaultMessage": "Test Failure: {error}",
- "id": "admin.requestButton.requestFailure",
- }
- }
- helpText={
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- />
- }
- includeDetailedError={false}
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- requestAction={[Function]}
- saveNeeded={false}
- showSuccessMessage={true}
- successMessage={
- Object {
- "defaultMessage": "Success Message",
- "id": "success.message",
- }
- }
->
- <div
- className="form-group"
- >
- <div
- className="col-sm-offset-4 col-sm-8"
- >
- <div>
- <button
- className="btn btn-default"
- disabled={false}
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- >
- <span>
- Button Text
- </span>
- </FormattedMessage>
- </button>
- <div>
- <div
- className="alert alert-success"
- >
- <i
- className="fa fa-success"
- />
- <FormattedMessage
- defaultMessage="Success Message"
- id="success.message"
- values={Object {}}
- >
- <span>
- Success Message
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
- <div
- className="help-text"
- >
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- >
- <span>
- Help Text
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
-</RequestButton>
-`;
-
-exports[`components/admin_console/request_button/request_button.jsx should match snapshot with successMessage 2`] = `
-<RequestButton
- buttonText={
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- />
- }
- disabled={false}
- errorMessage={
- Object {
- "defaultMessage": "Test Failure: {error}",
- "id": "admin.requestButton.requestFailure",
- }
- }
- helpText={
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- />
- }
- includeDetailedError={false}
- intl={
- Object {
- "defaultFormats": Object {},
- "defaultLocale": "en",
- "formatDate": [Function],
- "formatHTMLMessage": [Function],
- "formatMessage": [Function],
- "formatNumber": [Function],
- "formatPlural": [Function],
- "formatRelative": [Function],
- "formatTime": [Function],
- "formats": Object {},
- "formatters": Object {
- "getDateTimeFormat": [Function],
- "getMessageFormat": [Function],
- "getNumberFormat": [Function],
- "getPluralFormat": [Function],
- "getRelativeFormat": [Function],
- },
- "locale": "en",
- "messages": Object {},
- "now": [Function],
- "textComponent": "span",
- }
- }
- requestAction={[Function]}
- saveNeeded={false}
- showSuccessMessage={false}
- successMessage={
- Object {
- "defaultMessage": "Success Message",
- "id": "success.message",
- }
- }
->
- <div
- className="form-group"
- >
- <div
- className="col-sm-offset-4 col-sm-8"
- >
- <div>
- <button
- className="btn btn-default"
- disabled={false}
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Button Text"
- id="test"
- values={Object {}}
- >
- <span>
- Button Text
- </span>
- </FormattedMessage>
- </button>
- </div>
- <div
- className="help-text"
- >
- <FormattedMessage
- defaultMessage="Help Text"
- id="test"
- values={Object {}}
- >
- <span>
- Help Text
- </span>
- </FormattedMessage>
- </div>
- </div>
- </div>
-</RequestButton>
-`;
diff --git a/webapp/tests/components/admin_console/request_button/request_button.test.jsx b/webapp/tests/components/admin_console/request_button/request_button.test.jsx
deleted file mode 100644
index 3b3f4b40b..000000000
--- a/webapp/tests/components/admin_console/request_button/request_button.test.jsx
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {FormattedMessage} from 'react-intl';
-
-import {shallow} from 'enzyme';
-import {mountWithIntl} from 'tests/helpers/intl-test-helper.jsx';
-
-import RequestButton from 'components/admin_console/request_button/request_button.jsx';
-
-describe('components/admin_console/request_button/request_button.jsx', () => {
- test('should match snapshot', () => {
- const emptyFunction = jest.fn();
-
- const wrapper = shallow(
- <RequestButton
- requestAction={emptyFunction}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should call saveConfig and request actions when saveNeeded is true', () => {
- const requestActionSuccess = jest.fn((success) => success());
- const saveConfigActionSuccess = jest.fn((success) => success());
-
- const wrapper = mountWithIntl(
- <RequestButton
- requestAction={requestActionSuccess}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- saveNeeded={false}
- saveConfigAction={saveConfigActionSuccess}
- />
- );
-
- wrapper.find('button').first().simulate('click');
-
- expect(requestActionSuccess.mock.calls.length).toBe(1);
- expect(saveConfigActionSuccess.mock.calls.length).toBe(0);
- });
-
- test('should call only request action when saveNeeded is false', () => {
- const requestActionSuccess = jest.fn((success) => success());
- const saveConfigActionSuccess = jest.fn((success) => success());
-
- const wrapper = mountWithIntl(
- <RequestButton
- requestAction={requestActionSuccess}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- saveNeeded={true}
- saveConfigAction={saveConfigActionSuccess}
- />
- );
-
- wrapper.find('button').first().simulate('click');
-
- expect(requestActionSuccess.mock.calls.length).toBe(1);
- expect(saveConfigActionSuccess.mock.calls.length).toBe(1);
- });
-
- test('should match snapshot with successMessage', () => {
- const requestActionSuccess = jest.fn((success) => success());
-
- // Success & showSuccessMessage=true
- const wrapper1 = mountWithIntl(
- <RequestButton
- requestAction={requestActionSuccess}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- showSuccessMessage={true}
- successMessage={{
- id: 'success.message',
- defaultMessage: 'Success Message'
- }}
- />
- );
-
- wrapper1.find('button').first().simulate('click');
- expect(wrapper1).toMatchSnapshot();
-
- // Success & showSuccessMessage=false
- const wrapper2 = mountWithIntl(
- <RequestButton
- requestAction={requestActionSuccess}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- showSuccessMessage={false}
- successMessage={{
- id: 'success.message',
- defaultMessage: 'Success Message'
- }}
- />
- );
-
- wrapper2.find('button').first().simulate('click');
-
- expect(wrapper2).toMatchSnapshot();
- });
-
- test('should match snapshot with request error', () => {
- const requestActionFailure = jest.fn((success, error) => error({
- message: '__message__',
- detailed_error: '__detailed_error__'
- }));
-
- // Error & includeDetailedError=true
- const wrapper1 = mountWithIntl(
- <RequestButton
- requestAction={requestActionFailure}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- includeDetailedError={true}
- errorMessage={{
- id: 'error.message',
- defaultMessage: 'Error Message: {error}'
- }}
- />
- );
-
- wrapper1.find('button').first().simulate('click');
- expect(wrapper1).toMatchSnapshot();
-
- // Error & includeDetailedError=false
- const wrapper2 = mountWithIntl(
- <RequestButton
- requestAction={requestActionFailure}
- helpText={
- <FormattedMessage
- id='test'
- defaultMessage='Help Text'
- />
- }
- buttonText={
- <FormattedMessage
- id='test'
- defaultMessage='Button Text'
- />
- }
- errorMessage={{
- id: 'error.message',
- defaultMessage: 'Error Message: {error}'
- }}
- />
- );
-
- wrapper2.find('button').first().simulate('click');
-
- expect(wrapper2).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/backstage/components/__snapshots__/backstage_header.test.jsx.snap b/webapp/tests/components/backstage/components/__snapshots__/backstage_header.test.jsx.snap
deleted file mode 100644
index 7a0ae9e0c..000000000
--- a/webapp/tests/components/backstage/components/__snapshots__/backstage_header.test.jsx.snap
+++ /dev/null
@@ -1,31 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/backstage/components/BackstageHeader should match snapshot with children 1`] = `
-<div
- className="backstage-header"
->
- <h1>
- <div>
- Child 1
- </div>
- <span
- className="backstage-header__divider"
- >
- <i
- className="fa fa-angle-right"
- />
- </span>
- <div>
- Child 2
- </div>
- </h1>
-</div>
-`;
-
-exports[`components/backstage/components/BackstageHeader should match snapshot without children 1`] = `
-<div
- className="backstage-header"
->
- <h1 />
-</div>
-`;
diff --git a/webapp/tests/components/backstage/components/backstage_header.test.jsx b/webapp/tests/components/backstage/components/backstage_header.test.jsx
deleted file mode 100644
index f6da444d9..000000000
--- a/webapp/tests/components/backstage/components/backstage_header.test.jsx
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import BackstageHeader from 'components/backstage/components/backstage_header.jsx';
-
-describe('components/backstage/components/BackstageHeader', () => {
- test('should match snapshot without children', () => {
- const wrapper = shallow(
- <BackstageHeader/>
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot with children', () => {
- const wrapper = shallow(
- <BackstageHeader>
- <div>{'Child 1'}</div>
- <div>{'Child 2'}</div>
- </BackstageHeader>
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/integrations/__snapshots__/add_command.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/add_command.test.jsx.snap
deleted file mode 100644
index 99e5d7ad8..000000000
--- a/webapp/tests/components/integrations/__snapshots__/add_command.test.jsx.snap
+++ /dev/null
@@ -1,396 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/AddCommand should match snapshot 1`] = `
-<div
- className="backstage-content row"
->
- <BackstageHeader>
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/commands"
- >
- <FormattedMessage
- defaultMessage="Slash Commands"
- id="installed_command.header"
- values={Object {}}
- />
- </Link>
- <FormattedMessage
- defaultMessage="Add"
- id="integrations.add"
- values={Object {}}
- />
- </BackstageHeader>
- <div
- className="backstage-form"
- >
- <form
- className="form-horizontal"
- onSubmit={[Function]}
- >
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="displayName"
- >
- <FormattedMessage
- defaultMessage="Display Name"
- id="add_command.displayName"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="displayName"
- maxLength="64"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Display name for your slash command made of up to 64 characters."
- id="add_command.displayName.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="description"
- >
- <FormattedMessage
- defaultMessage="Description"
- id="add_command.description"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="description"
- maxLength="128"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Description for your incoming webhook."
- id="add_command.description.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="trigger"
- >
- <FormattedMessage
- defaultMessage="Command Trigger Word"
- id="add_command.trigger"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="trigger"
- maxLength={128}
- onChange={[Function]}
- placeholder="Command trigger e.g. \\"hello\\" not including the slash"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Trigger word must be unique, and cannot begin with a slash or contain any spaces."
- id="add_command.trigger.help"
- values={Object {}}
- />
- </div>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Examples: client, employee, patient, weather"
- id="add_command.trigger.helpExamples"
- values={Object {}}
- />
- </div>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Reserved: {link}"
- id="add_command.trigger.helpReserved"
- values={
- Object {
- "link": <a
- href="https://docs.mattermost.com/help/messaging/executing-commands.html#built-in-commands"
- rel="noopener noreferrer"
- target="_blank"
- >
- <FormattedMessage
- defaultMessage="see list of built-in slash commands"
- id="add_command.trigger.helpReservedLinkText"
- values={Object {}}
- />
- </a>,
- }
- }
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="url"
- >
- <FormattedMessage
- defaultMessage="Request URL"
- id="add_command.url"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="url"
- maxLength="1024"
- onChange={[Function]}
- placeholder="Must start with http:// or https://"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The callback URL to receive the HTTP POST or GET event request when the slash command is run."
- id="add_command.url.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="method"
- >
- <FormattedMessage
- defaultMessage="Request Method"
- id="add_command.method"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <select
- className="form-control"
- id="method"
- onChange={[Function]}
- value="P"
- >
- <option
- value="P"
- >
- POST
- </option>
- <option
- value="G"
- >
- GET
- </option>
- </select>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The type of command request issued to the Request URL."
- id="add_command.method.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="username"
- >
- <FormattedMessage
- defaultMessage="Response Username"
- id="add_command.username"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="username"
- maxLength="64"
- onChange={[Function]}
- placeholder="Username"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="(Optional) Choose a username override for responses for this slash command. Usernames can consist of up to 22 characters consisting of lowercase letters, numbers and they symbols \\"-\\", \\"_\\", and \\".\\" ."
- id="add_command.username.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="iconUrl"
- >
- <FormattedMessage
- defaultMessage="Response Icon"
- id="add_command.iconUrl"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="iconUrl"
- maxLength="1024"
- onChange={[Function]}
- placeholder="https://www.example.com/myicon.png"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="(Optional) Choose a profile picture override for the post responses to this slash command. Enter the URL of a .png or .jpg file at least 128 pixels by 128 pixels."
- id="add_command.iconUrl.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="autocomplete"
- >
- <FormattedMessage
- defaultMessage="Autocomplete"
- id="add_command.autocomplete"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8 checkbox"
- >
- <input
- checked={false}
- id="autocomplete"
- onChange={[Function]}
- type="checkbox"
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="(Optional) Show slash command in autocomplete list."
- id="add_command.autocomplete.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="backstage-form__footer"
- >
- <FormError
- error={null}
- errors={
- Array [
- "",
- null,
- ]
- }
- type="backstage"
- />
- <Link
- className="btn btn-sm"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/commands"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="add_command.cancel"
- values={Object {}}
- />
- </Link>
- <SpinnerButton
- className="btn btn-primary"
- onClick={[Function]}
- spinning={false}
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Save"
- id="add_command.save"
- values={Object {}}
- />
- </SpinnerButton>
- </div>
- </form>
- </div>
-</div>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/add_incoming_hook.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/add_incoming_hook.test.jsx.snap
deleted file mode 100644
index ce34d81bc..000000000
--- a/webapp/tests/components/integrations/__snapshots__/add_incoming_hook.test.jsx.snap
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/AddIncomingWebhook should match snapshot 1`] = `
-<AbstractIncomingWebhook
- action={[Function]}
- footer={
- Object {
- "defaultMessage": "Save",
- "id": "add_incoming_webhook.save",
- }
- }
- header={
- Object {
- "defaultMessage": "Add",
- "id": "integrations.add",
- }
- }
- serverError=""
- team={
- Object {
- "id": "testteamid",
- "name": "test",
- }
- }
-/>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/add_oauth_app.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/add_oauth_app.test.jsx.snap
deleted file mode 100644
index eceffcddb..000000000
--- a/webapp/tests/components/integrations/__snapshots__/add_oauth_app.test.jsx.snap
+++ /dev/null
@@ -1,613 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/AddOAuthApp should match snapshot 1`] = `
-<div
- className="backstage-content"
->
- <BackstageHeader>
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/oauth2-apps"
- >
- <FormattedMessage
- defaultMessage="Installed OAuth2 Apps"
- id="installed_oauth_apps.header"
- values={Object {}}
- />
- </Link>
- <FormattedMessage
- defaultMessage="Add"
- id="add_oauth_app.header"
- values={Object {}}
- />
- </BackstageHeader>
- <div
- className="backstage-form"
- >
- <form
- className="form-horizontal"
- >
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="is_trusted"
- >
- <FormattedMessage
- defaultMessage="Is Trusted"
- id="installed_oauth_apps.trusted"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <label
- className="radio-inline"
- >
- <input
- checked={false}
- name="is_trusted"
- onChange={[Function]}
- type="radio"
- value="true"
- />
- <FormattedMessage
- defaultMessage="Yes"
- id="installed_oauth_apps.trusted.yes"
- values={Object {}}
- />
- </label>
- <label
- className="radio-inline"
- >
- <input
- checked={true}
- name="is_trusted"
- onChange={[Function]}
- type="radio"
- value="false"
- />
- <FormattedMessage
- defaultMessage="No"
- id="installed_oauth_apps.trusted.no"
- values={Object {}}
- />
- </label>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="When true, the OAuth 2.0 application is considered trusted by the Mattermost server and doesn't require the user to accept authorization. When false, an additional window will appear, asking the user to accept or deny the authorization."
- id="add_oauth_app.trusted.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="name"
- >
- <FormattedMessage
- defaultMessage="Display Name"
- id="installed_oauth_apps.name"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="name"
- maxLength="64"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Display name for your OAuth 2.0 application made of up to 64 characters."
- id="add_oauth_app.name.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="description"
- >
- <FormattedMessage
- defaultMessage="Description"
- id="installed_oauth_apps.description"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="description"
- maxLength="512"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Description for your OAuth 2.0 application."
- id="add_oauth_app.description.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="homepage"
- >
- <FormattedMessage
- defaultMessage="Homepage"
- id="installed_oauth_apps.homepage"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="homepage"
- maxLength="256"
- onChange={[Function]}
- type="url"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The URL for the homepage of the OAuth 2.0 application. Make sure you use HTTP or HTTPS in your URL depending on your server configuration."
- id="add_oauth_app.homepage.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="icon_url"
- >
- <FormattedMessage
- defaultMessage="Icon URL"
- id="installed_oauth_apps.iconUrl"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="icon_url"
- maxLength="512"
- onChange={[Function]}
- type="url"
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The URL for the homepage of the OAuth 2.0 application. Make sure you use HTTP or HTTPS in your URL depending on your server configuration."
- id="add_oauth_app.icon.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="callbackUrls"
- >
- <FormattedMessage
- defaultMessage="Callback URLs (One Per Line)"
- id="installed_oauth_apps.callbackUrls"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <textarea
- className="form-control"
- id="callbackUrls"
- maxLength="1024"
- onChange={[Function]}
- rows="3"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The redirect URIs to which the service will redirect users after accepting or denying authorization of your application, and which will handle authorization codes or access tokens. Must be a valid URL and start with http:// or https://."
- id="add_oauth_app.callbackUrls.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="backstage-form__footer"
- >
- <FormError
- error={null}
- errors={
- Array [
- "",
- null,
- ]
- }
- type="backstage"
- />
- <Link
- className="btn btn-sm"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/oauth2-apps"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="installed_oauth_apps.cancel"
- values={Object {}}
- />
- </Link>
- <SpinnerButton
- className="btn btn-primary"
- onClick={[Function]}
- spinning={false}
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Save"
- id="installed_oauth_apps.save"
- values={Object {}}
- />
- </SpinnerButton>
- </div>
- </form>
- </div>
-</div>
-`;
-
-exports[`components/integrations/AddOAuthApp should match snapshot, displays client error 1`] = `
-<div
- className="backstage-content"
->
- <BackstageHeader>
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/oauth2-apps"
- >
- <FormattedMessage
- defaultMessage="Installed OAuth2 Apps"
- id="installed_oauth_apps.header"
- values={Object {}}
- />
- </Link>
- <FormattedMessage
- defaultMessage="Add"
- id="add_oauth_app.header"
- values={Object {}}
- />
- </BackstageHeader>
- <div
- className="backstage-form"
- >
- <form
- className="form-horizontal"
- >
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="is_trusted"
- >
- <FormattedMessage
- defaultMessage="Is Trusted"
- id="installed_oauth_apps.trusted"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <label
- className="radio-inline"
- >
- <input
- checked={false}
- name="is_trusted"
- onChange={[Function]}
- type="radio"
- value="true"
- />
- <FormattedMessage
- defaultMessage="Yes"
- id="installed_oauth_apps.trusted.yes"
- values={Object {}}
- />
- </label>
- <label
- className="radio-inline"
- >
- <input
- checked={true}
- name="is_trusted"
- onChange={[Function]}
- type="radio"
- value="false"
- />
- <FormattedMessage
- defaultMessage="No"
- id="installed_oauth_apps.trusted.no"
- values={Object {}}
- />
- </label>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="When true, the OAuth 2.0 application is considered trusted by the Mattermost server and doesn't require the user to accept authorization. When false, an additional window will appear, asking the user to accept or deny the authorization."
- id="add_oauth_app.trusted.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="name"
- >
- <FormattedMessage
- defaultMessage="Display Name"
- id="installed_oauth_apps.name"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="name"
- maxLength="64"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Display name for your OAuth 2.0 application made of up to 64 characters."
- id="add_oauth_app.name.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="description"
- >
- <FormattedMessage
- defaultMessage="Description"
- id="installed_oauth_apps.description"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="description"
- maxLength="512"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Description for your OAuth 2.0 application."
- id="add_oauth_app.description.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="homepage"
- >
- <FormattedMessage
- defaultMessage="Homepage"
- id="installed_oauth_apps.homepage"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="homepage"
- maxLength="256"
- onChange={[Function]}
- type="url"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The URL for the homepage of the OAuth 2.0 application. Make sure you use HTTP or HTTPS in your URL depending on your server configuration."
- id="add_oauth_app.homepage.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="icon_url"
- >
- <FormattedMessage
- defaultMessage="Icon URL"
- id="installed_oauth_apps.iconUrl"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="icon_url"
- maxLength="512"
- onChange={[Function]}
- type="url"
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The URL for the homepage of the OAuth 2.0 application. Make sure you use HTTP or HTTPS in your URL depending on your server configuration."
- id="add_oauth_app.icon.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="callbackUrls"
- >
- <FormattedMessage
- defaultMessage="Callback URLs (One Per Line)"
- id="installed_oauth_apps.callbackUrls"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <textarea
- className="form-control"
- id="callbackUrls"
- maxLength="1024"
- onChange={[Function]}
- rows="3"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The redirect URIs to which the service will redirect users after accepting or denying authorization of your application, and which will handle authorization codes or access tokens. Must be a valid URL and start with http:// or https://."
- id="add_oauth_app.callbackUrls.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="backstage-form__footer"
- >
- <FormError
- error={null}
- errors={
- Array [
- "",
- <FormattedMessage
- defaultMessage="Name for the OAuth 2.0 application is required."
- id="add_oauth_app.nameRequired"
- values={Object {}}
- />,
- ]
- }
- type="backstage"
- />
- <Link
- className="btn btn-sm"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/oauth2-apps"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="installed_oauth_apps.cancel"
- values={Object {}}
- />
- </Link>
- <SpinnerButton
- className="btn btn-primary"
- onClick={[Function]}
- spinning={false}
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Save"
- id="installed_oauth_apps.save"
- values={Object {}}
- />
- </SpinnerButton>
- </div>
- </form>
- </div>
-</div>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/add_outgoing_hook.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/add_outgoing_hook.test.jsx.snap
deleted file mode 100644
index a55f5db5e..000000000
--- a/webapp/tests/components/integrations/__snapshots__/add_outgoing_hook.test.jsx.snap
+++ /dev/null
@@ -1,27 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/AddOutgoingWebhook should match snapshot 1`] = `
-<AbstractOutgoingWebhook
- action={[Function]}
- footer={
- Object {
- "defaultMessage": "Save",
- "id": "add_outgoing_webhook.save",
- }
- }
- header={
- Object {
- "defaultMessage": "Add",
- "id": "integrations.add",
- }
- }
- renderExtra=""
- serverError=""
- team={
- Object {
- "id": "testteamid",
- "name": "test",
- }
- }
-/>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/edit_command.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/edit_command.test.jsx.snap
deleted file mode 100644
index dd4fcffef..000000000
--- a/webapp/tests/components/integrations/__snapshots__/edit_command.test.jsx.snap
+++ /dev/null
@@ -1,424 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/EditCommand should match snapshot 1`] = `
-<div
- className="backstage-content row"
->
- <BackstageHeader>
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/commands"
- >
- <FormattedMessage
- defaultMessage="Slash Commands"
- id="installed_command.header"
- values={Object {}}
- />
- </Link>
- <FormattedMessage
- defaultMessage="Edit"
- id="integrations.edit"
- values={Object {}}
- />
- </BackstageHeader>
- <div
- className="backstage-form"
- >
- <form
- className="form-horizontal"
- onSubmit={[Function]}
- >
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="displayName"
- >
- <FormattedMessage
- defaultMessage="Display Name"
- id="add_command.displayName"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="displayName"
- maxLength="64"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Display name for your slash command made of up to 64 characters."
- id="add_command.displayName.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="description"
- >
- <FormattedMessage
- defaultMessage="Description"
- id="add_command.description"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="description"
- maxLength="128"
- onChange={[Function]}
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Description for your incoming webhook."
- id="add_command.description.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="trigger"
- >
- <FormattedMessage
- defaultMessage="Command Trigger Word"
- id="add_command.trigger"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="trigger"
- maxLength={128}
- onChange={[Function]}
- placeholder="Command trigger e.g. \\"hello\\" not including the slash"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Trigger word must be unique, and cannot begin with a slash or contain any spaces."
- id="add_command.trigger.help"
- values={Object {}}
- />
- </div>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Examples: client, employee, patient, weather"
- id="add_command.trigger.helpExamples"
- values={Object {}}
- />
- </div>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="Reserved: {link}"
- id="add_command.trigger.helpReserved"
- values={
- Object {
- "link": <a
- href="https://docs.mattermost.com/help/messaging/executing-commands.html#built-in-commands"
- rel="noopener noreferrer"
- target="_blank"
- >
- <FormattedMessage
- defaultMessage="see list of built-in slash commands"
- id="add_command.trigger.helpReservedLinkText"
- values={Object {}}
- />
- </a>,
- }
- }
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="url"
- >
- <FormattedMessage
- defaultMessage="Request URL"
- id="add_command.url"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="url"
- maxLength="1024"
- onChange={[Function]}
- placeholder="Must start with http:// or https://"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The callback URL to receive the HTTP POST or GET event request when the slash command is run."
- id="add_command.url.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="method"
- >
- <FormattedMessage
- defaultMessage="Request Method"
- id="add_command.method"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <select
- className="form-control"
- id="method"
- onChange={[Function]}
- value="P"
- >
- <option
- value="P"
- >
- POST
- </option>
- <option
- value="G"
- >
- GET
- </option>
- </select>
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="The type of command request issued to the Request URL."
- id="add_command.method.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="username"
- >
- <FormattedMessage
- defaultMessage="Response Username"
- id="add_command.username"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="username"
- maxLength="64"
- onChange={[Function]}
- placeholder="Username"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="(Optional) Choose a username override for responses for this slash command. Usernames can consist of up to 22 characters consisting of lowercase letters, numbers and they symbols \\"-\\", \\"_\\", and \\".\\" ."
- id="add_command.username.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="iconUrl"
- >
- <FormattedMessage
- defaultMessage="Response Icon"
- id="add_command.iconUrl"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8"
- >
- <input
- className="form-control"
- id="iconUrl"
- maxLength="1024"
- onChange={[Function]}
- placeholder="https://www.example.com/myicon.png"
- type="text"
- value=""
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="(Optional) Choose a profile picture override for the post responses to this slash command. Enter the URL of a .png or .jpg file at least 128 pixels by 128 pixels."
- id="add_command.iconUrl.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="form-group"
- >
- <label
- className="control-label col-sm-4"
- htmlFor="autocomplete"
- >
- <FormattedMessage
- defaultMessage="Autocomplete"
- id="add_command.autocomplete"
- values={Object {}}
- />
- </label>
- <div
- className="col-md-5 col-sm-8 checkbox"
- >
- <input
- checked={false}
- id="autocomplete"
- onChange={[Function]}
- type="checkbox"
- />
- <div
- className="form__help"
- >
- <FormattedMessage
- defaultMessage="(Optional) Show slash command in autocomplete list."
- id="add_command.autocomplete.help"
- values={Object {}}
- />
- </div>
- </div>
- </div>
- <div
- className="backstage-form__footer"
- >
- <FormError
- error={null}
- errors={
- Array [
- "",
- null,
- ]
- }
- type="backstage"
- />
- <Link
- className="btn btn-sm"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/commands"
- >
- <FormattedMessage
- defaultMessage="Cancel"
- id="add_command.cancel"
- values={Object {}}
- />
- </Link>
- <SpinnerButton
- className="btn btn-primary"
- disabled={true}
- onClick={[Function]}
- spinning={false}
- type="submit"
- >
- <FormattedMessage
- defaultMessage="Update"
- id="edit_command.save"
- values={Object {}}
- />
- </SpinnerButton>
- <ConfirmModal
- confirmButtonClass="btn btn-primary"
- confirmButtonText={
- <FormattedMessage
- defaultMessage="Update"
- id="update_command.update"
- values={Object {}}
- />
- }
- message={
- <FormattedMessage
- defaultMessage="Your changes may break the existing slash command. Are you sure you would like to update it?"
- id="update_command.question"
- values={Object {}}
- />
- }
- onCancel={[Function]}
- onConfirm={[Function]}
- show={false}
- title={
- <FormattedMessage
- defaultMessage="Edit Slash Command"
- id="update_command.confirm"
- values={Object {}}
- />
- }
- />
- </div>
- </form>
- </div>
-</div>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/edit_incoming_hook.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/edit_incoming_hook.test.jsx.snap
deleted file mode 100644
index ed392dcbd..000000000
--- a/webapp/tests/components/integrations/__snapshots__/edit_incoming_hook.test.jsx.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/EditIncomingWebhook should match snapshot 1`] = `
-<LoadingScreen
- position="relative"
-/>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/edit_outgoing_hook.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/edit_outgoing_hook.test.jsx.snap
deleted file mode 100644
index d7656b08f..000000000
--- a/webapp/tests/components/integrations/__snapshots__/edit_outgoing_hook.test.jsx.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/EditOutgoingWebhook should match snapshot 1`] = `
-<LoadingScreen
- position="relative"
-/>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/installed_command.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/installed_command.test.jsx.snap
deleted file mode 100644
index 910b35e25..000000000
--- a/webapp/tests/components/integrations/__snapshots__/installed_command.test.jsx.snap
+++ /dev/null
@@ -1,103 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/InstalledCommand should filter out command 1`] = `null`;
-
-exports[`components/integrations/InstalledCommand should match snapshot 1`] = `
-<div
- className="backstage-list__item"
->
- <div
- className="item-details"
- >
- <div
- className="item-details__row"
- >
- <span
- className="item-details__name"
- >
- test
- </span>
- <span
- className="item-details__trigger"
- >
- - /trigger test
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__description"
- >
- test
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__token"
- >
- <FormattedMessage
- defaultMessage="Token: {token}"
- id="installed_integrations.token"
- values={
- Object {
- "token": "testToken",
- }
- }
- />
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__creation"
- >
- <FormattedMessage
- defaultMessage="Created by {creator} on {createAt, date, full}"
- id="installed_integrations.creation"
- values={
- Object {
- "createAt": "1499722850203",
- "creator": "test",
- }
- }
- />
- </span>
- </div>
- </div>
- <div
- className="item-actions"
- >
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Regenerate Token"
- id="installed_integrations.regenToken"
- values={Object {}}
- />
- </a>
- -
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/test/integrations/commands/edit?id=r5tpgt4iepf45jt768jz84djic"
- >
- <FormattedMessage
- defaultMessage="Edit"
- id="installed_integrations.edit"
- values={Object {}}
- />
- </Link>
- -
- <DeleteIntegration
- messageId="installed_commands.delete.confirm"
- onDelete={[Function]}
- />
- </div>
-</div>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/installed_oauth_app.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/installed_oauth_app.test.jsx.snap
deleted file mode 100644
index f4e8fb464..000000000
--- a/webapp/tests/components/integrations/__snapshots__/installed_oauth_app.test.jsx.snap
+++ /dev/null
@@ -1,155 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/InstalledOAuthApp should filter out OAuthApp 1`] = `null`;
-
-exports[`components/integrations/InstalledOAuthApp should match snapshot 1`] = `
-<div
- className="backstage-list__item"
->
- <div
- className="integration__icon integration-list__icon"
- >
- <img
- src="https://test.com/icon"
- />
- </div>
- <div
- className="item-details"
- >
- <div
- className="item-details__row"
- >
- <span
- className="item-details__name"
- >
- testApp
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__description"
- >
- testing
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__url"
- >
- <FormattedHTMLMessage
- defaultMessage="Is Trusted: <strong>{isTrusted}</strong>"
- id="installed_oauth_apps.is_trusted"
- values={
- Object {
- "isTrusted": "Yes",
- }
- }
- />
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__token"
- >
- <FormattedHTMLMessage
- defaultMessage="Client ID: <strong>{clientId}</strong>"
- id="installed_integrations.client_id"
- values={
- Object {
- "clientId": "facxd9wpzpbpfp8pad78xj75pr",
- }
- }
- />
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__token"
- >
- <FormattedHTMLMessage
- defaultMessage="Client Secret: <strong>{clientSecret}</strong>"
- id="installed_integrations.client_secret"
- values={
- Object {
- "clientSecret": "***************",
- }
- }
- />
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__url"
- >
- <FormattedMessage
- defaultMessage="Callback URLs: {urls}"
- id="installed_integrations.callback_urls"
- values={
- Object {
- "urls": "https://test.com/callback, https://test.com/callback2",
- }
- }
- />
- </span>
- </div>
- <div
- className="item-details__row"
- >
- <span
- className="item-details__creation"
- >
- <FormattedMessage
- defaultMessage="Created by {creator} on {createAt, date, full}"
- id="installed_integrations.creation"
- values={
- Object {
- "createAt": 1501365458934,
- "creator": "",
- }
- }
- />
- </span>
- </div>
- </div>
- <div
- className="item-actions"
- >
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Show Secret"
- id="installed_integrations.showSecret"
- values={Object {}}
- />
- </a>
- -
- <a
- href="#"
- onClick={[Function]}
- >
- <FormattedMessage
- defaultMessage="Regenerate Secret"
- id="installed_integrations.regenSecret"
- values={Object {}}
- />
- </a>
- -
- <DeleteIntegration
- messageId="installed_oauth_apps.delete.confirm"
- onDelete={[Function]}
- />
- </div>
-</div>
-`;
diff --git a/webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap
deleted file mode 100644
index c6ef12112..000000000
--- a/webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap
+++ /dev/null
@@ -1,100 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/integrations/InstalledOAuthApps should match snapshot 1`] = `
-<BackstageList
- addLink="/test/integrations/oauth2-apps/add"
- addText="Add OAuth 2.0 Application"
- emptyText={
- <FormattedMessage
- defaultMessage="No OAuth 2.0 Applications found"
- id="installed_oauth_apps.empty"
- values={Object {}}
- />
- }
- header={
- <FormattedMessage
- defaultMessage="OAuth 2.0 Applications"
- id="installed_oauth_apps.header"
- values={Object {}}
- />
- }
- helpText={
- <FormattedMessage
- defaultMessage="Create {oauthApplications} to securely integrate bots and third-party apps with Mattermost. Visit the {appDirectory} to find available self-hosted apps."
- id="installed_oauth_apps.help"
- values={
- Object {
- "appDirectory": <a
- href="https://about.mattermost.com/default-app-directory/"
- rel="noopener noreferrer"
- target="_blank"
- >
- <FormattedMessage
- defaultMessage="App Directory"
- id="installed_oauth_apps.help.appDirectory"
- values={Object {}}
- />
- </a>,
- "oauthApplications": <a
- href="https://docs.mattermost.com/developer/oauth-2-0-applications.html"
- rel="noopener noreferrer"
- target="_blank"
- >
- <FormattedMessage
- defaultMessage="OAuth 2.0 applications"
- id="installed_oauth_apps.help.oauthApplications"
- values={Object {}}
- />
- </a>,
- }
- }
- />
- }
- loading={true}
- searchPlaceholder="Search OAuth 2.0 Applications"
->
- <InstalledOAuthApp
- oauthApp={
- Object {
- "callback_urls": Array [
- "https://test.com/callback",
- ],
- "client_secret": "88cxd9wpzpbpfp8pad78xj75pr",
- "create_at": 1501365458934,
- "creator_id": "88oybd1dwfdoxpkpw1h5kpbyco",
- "description": "testing",
- "homepage": "https://test.com",
- "icon_url": "https://test.com/icon",
- "id": "facxd9wpzpbpfp8pad78xj75pr",
- "is_trusted": false,
- "name": "firstApp",
- "update_at": 1501365458934,
- }
- }
- onDelete={[Function]}
- onRegenerateSecret={[Function]}
- />
- <InstalledOAuthApp
- oauthApp={
- Object {
- "callback_urls": Array [
- "https://test2.com/callback",
- "https://test2.com/callback2",
- ],
- "client_secret": "decxd9wpzpbpfp8pad78xj75pr",
- "create_at": 1501365459984,
- "creator_id": "88oybd2dwfdoxpkpw1h5kpbyco",
- "description": "testing2",
- "homepage": "https://test2.com",
- "icon_url": "https://test2.com/icon",
- "id": "fzcxd9wpzpbpfp8pad78xj75pr",
- "is_trusted": true,
- "name": "secondApp",
- "update_at": 1501365479988,
- }
- }
- onDelete={[Function]}
- onRegenerateSecret={[Function]}
- />
-</BackstageList>
-`;
diff --git a/webapp/tests/components/integrations/add_command.test.jsx b/webapp/tests/components/integrations/add_command.test.jsx
deleted file mode 100644
index cf8a31e07..000000000
--- a/webapp/tests/components/integrations/add_command.test.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import * as Utils from 'utils/utils.jsx';
-import AddCommand from 'components/integrations/components/add_command/add_command.jsx';
-
-describe('components/integrations/AddCommand', () => {
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
- const teamId = Utils.generateId();
-
- const wrapper = shallow(
- <AddCommand
- team={{
- id: teamId,
- name: 'test'
- }}
- addCommandRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{addCommand: emptyFunction}}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/integrations/add_incoming_hook.test.jsx b/webapp/tests/components/integrations/add_incoming_hook.test.jsx
deleted file mode 100644
index ae5a46cb2..000000000
--- a/webapp/tests/components/integrations/add_incoming_hook.test.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
- import React from 'react';
- import {shallow} from 'enzyme';
-
- import AddIncomingWebhook from 'components/integrations/components/add_incoming_webhook/add_incoming_webhook.jsx';
-
- describe('components/integrations/AddIncomingWebhook', () => {
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
- const teamId = 'testteamid';
-
- const wrapper = shallow(
- <AddIncomingWebhook
- team={{
- id: teamId,
- name: 'test'
- }}
- createIncomingHookRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{createIncomingHook: emptyFunction}}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
- });
diff --git a/webapp/tests/components/integrations/add_oauth_app.test.jsx b/webapp/tests/components/integrations/add_oauth_app.test.jsx
deleted file mode 100644
index 11e743ff5..000000000
--- a/webapp/tests/components/integrations/add_oauth_app.test.jsx
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import AddOAuthApp from 'components/integrations/components/add_oauth_app/add_oauth_app.jsx';
-
-describe('components/integrations/AddOAuthApp', () => {
- const emptyFunction = jest.fn();
- const team = {
- id: 'dbcxd9wpzpbpfp8pad78xj12pr',
- name: 'test'
- };
-
- test('should match snapshot', () => {
- const wrapper = shallow(
- <AddOAuthApp
- team={team}
- addOAuthAppRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{addOAuthApp: emptyFunction}}
- />
- );
-
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, displays client error', () => {
- const wrapper = shallow(
- <AddOAuthApp
- team={team}
- addOAuthAppRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{addOAuthApp: emptyFunction}}
- />
- );
-
- wrapper.find('.btn-primary').simulate('click', {preventDefault() {
- return jest.fn();
- }});
-
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should call addOAuthApp function', () => {
- const addOAuthApp = jest.genMockFunction().mockImplementation(
- () => {
- return new Promise((resolve) => {
- process.nextTick(() => resolve());
- });
- }
- );
-
- const wrapper = shallow(
- <AddOAuthApp
- team={team}
- addOAuthAppRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{addOAuthApp}}
- />
- );
-
- wrapper.find('#name').simulate('change', {target: {value: 'name'}});
- wrapper.find('#description').simulate('change', {target: {value: 'description'}});
- wrapper.find('#homepage').simulate('change', {target: {value: 'http://test.com'}});
- wrapper.find('#callbackUrls').simulate('change', {target: {value: 'http://callback.com'}});
-
- wrapper.find('.btn-primary').simulate('click', {preventDefault() {
- return jest.fn();
- }});
-
- expect(addOAuthApp).toBeCalled();
- });
-}); \ No newline at end of file
diff --git a/webapp/tests/components/integrations/add_outgoing_hook.test.jsx b/webapp/tests/components/integrations/add_outgoing_hook.test.jsx
deleted file mode 100644
index 0c92a7c83..000000000
--- a/webapp/tests/components/integrations/add_outgoing_hook.test.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import AddOutgoingWebhook from 'components/integrations/components/add_outgoing_webhook/add_outgoing_webhook.jsx';
-
-describe('components/integrations/AddOutgoingWebhook', () => {
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
- const teamId = 'testteamid';
-
- const wrapper = shallow(
- <AddOutgoingWebhook
- team={{
- id: teamId,
- name: 'test'
- }}
- createOutgoingHookRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{createOutgoingHook: emptyFunction}}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/integrations/edit_command.test.jsx b/webapp/tests/components/integrations/edit_command.test.jsx
deleted file mode 100644
index 6b919cb86..000000000
--- a/webapp/tests/components/integrations/edit_command.test.jsx
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import EditCommand from 'components/integrations/components/edit_command/edit_command.jsx';
-
-describe('components/integrations/EditCommand', () => {
- test('should match snapshot', () => {
- const emptyFunction = jest.fn();
- const id = 'r5tpgt4iepf45jt768jz84djic';
- global.window.mm_config = {};
- global.window.mm_config.EnableCommands = 'true';
-
- const wrapper = shallow(
- <EditCommand
- team={{
- id,
- name: 'test'
- }}
- commandId={id}
- commands={[]}
- editCommandRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{
- getCustomTeamCommands: emptyFunction,
- editCommand: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/webapp/tests/components/integrations/edit_incoming_hook.test.jsx b/webapp/tests/components/integrations/edit_incoming_hook.test.jsx
deleted file mode 100644
index cb7544314..000000000
--- a/webapp/tests/components/integrations/edit_incoming_hook.test.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
- import React from 'react';
- import {shallow} from 'enzyme';
-
- import EditIncomingWebhook from 'components/integrations/components/edit_incoming_webhook/edit_incoming_webhook.jsx';
-
- describe('components/integrations/EditIncomingWebhook', () => {
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
- const teamId = 'testteamid';
-
- const wrapper = shallow(
- <EditIncomingWebhook
- team={{
- id: teamId,
- name: 'test'
- }}
- hookId={'somehookid'}
- updateIncomingHookRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{updateIncomingHook: emptyFunction, getIncomingHook: emptyFunction}}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
- });
diff --git a/webapp/tests/components/integrations/edit_outgoing_hook.test.jsx b/webapp/tests/components/integrations/edit_outgoing_hook.test.jsx
deleted file mode 100644
index c2a5020a6..000000000
--- a/webapp/tests/components/integrations/edit_outgoing_hook.test.jsx
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import EditOutgoingWebhook from 'components/integrations/components/edit_outgoing_webhook/edit_outgoing_webhook.jsx';
-
-describe('components/integrations/EditOutgoingWebhook', () => {
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
- const teamId = 'testteamid';
-
- const wrapper = shallow(
- <EditOutgoingWebhook
- team={{
- id: teamId,
- name: 'test'
- }}
- hookId={'somehookid'}
- updateOutgoingHookRequest={{
- status: 'not_started',
- error: null
- }}
- actions={{updateOutgoingHook: emptyFunction, getOutgoingHook: emptyFunction}}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
-
diff --git a/webapp/tests/components/integrations/installed_command.test.jsx b/webapp/tests/components/integrations/installed_command.test.jsx
deleted file mode 100644
index b38d04754..000000000
--- a/webapp/tests/components/integrations/installed_command.test.jsx
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import InstalledCommand from 'components/integrations/components/installed_command.jsx';
-
-describe('components/integrations/InstalledCommand', () => {
- const emptyFunction = jest.fn();
- const command = {
- id: 'r5tpgt4iepf45jt768jz84djic',
- display_name: 'test',
- description: 'test',
- trigger: 'trigger',
- auto_complete: 'test',
- auto_complete_hint: 'test',
- token: 'testToken',
- create_at: '1499722850203'
- };
-
- test('should match snapshot', () => {
- const wrapper = shallow(
- <InstalledCommand
- team={{
- name: 'test'
- }}
- command={command}
- onRegenToken={emptyFunction}
- onDelete={emptyFunction}
- filter={'trigger'}
- creator={{
- username: 'test'
- }}
- canChange={true}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should call onRegenToken function', () => {
- const onRegenToken = jest.fn();
- const wrapper = shallow(
- <InstalledCommand
- team={{
- name: 'test'
- }}
- command={command}
- onRegenToken={onRegenToken}
- onDelete={emptyFunction}
- filter={''}
- creator={{
- username: 'test'
- }}
- canChange={true}
- />
- );
- wrapper.find('div.item-actions a').first().simulate('click', {preventDefault() {
- return jest.fn();
- }});
-
- expect(onRegenToken).toBeCalled();
- });
-
- test('should filter out command', () => {
- const wrapper = shallow(
- <InstalledCommand
- team={{
- name: 'test'
- }}
- command={command}
- onRegenToken={emptyFunction}
- onDelete={emptyFunction}
- filter={'filter'}
- creator={{
- username: 'test'
- }}
- canChange={true}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/integrations/installed_oauth_app.test.jsx b/webapp/tests/components/integrations/installed_oauth_app.test.jsx
deleted file mode 100644
index ff27a5768..000000000
--- a/webapp/tests/components/integrations/installed_oauth_app.test.jsx
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import InstalledOAuthApp from 'components/integrations/components/installed_oauth_app.jsx';
-
-describe('components/integrations/InstalledOAuthApp', () => {
- const emptyFunction = jest.fn();
- const app = {
- id: 'facxd9wpzpbpfp8pad78xj75pr',
- name: 'testApp',
- client_secret: '88cxd9wpzpbpfp8pad78xj75pr',
- create_at: 1501365458934,
- creator_id: '88oybd1dwfdoxpkpw1h5kpbyco',
- description: 'testing',
- homepage: 'https://test.com',
- icon_url: 'https://test.com/icon',
- is_trusted: true,
- update_at: 1501365458934,
- callback_urls: ['https://test.com/callback', 'https://test.com/callback2']
- };
-
- test('should match snapshot', () => {
- const wrapper = shallow(
- <InstalledOAuthApp
- oauthApp={app}
- onRegenerateSecret={emptyFunction}
- onDelete={emptyFunction}
- filter={''}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should call onRegenerateSecret function', () => {
- const onRegenerateSecret = jest.genMockFunction().mockImplementation(
- () => {
- return new Promise((resolve) => {
- process.nextTick(() => resolve());
- });
- }
- );
-
- const wrapper = shallow(
- <InstalledOAuthApp
- oauthApp={app}
- onRegenerateSecret={onRegenerateSecret}
- onDelete={emptyFunction}
- filter={''}
- />
- );
- wrapper.find('div.item-actions a').at(1).simulate('click', {preventDefault() {
- return jest.fn();
- }});
- expect(onRegenerateSecret).toBeCalled();
- });
-
- test('should filter out OAuthApp', () => {
- const wrapper = shallow(
- <InstalledOAuthApp
- oauthApp={app}
- onRegenerateSecret={emptyFunction}
- onDelete={emptyFunction}
- filter={'filter'}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/webapp/tests/components/integrations/installed_oauth_apps.test.jsx b/webapp/tests/components/integrations/installed_oauth_apps.test.jsx
deleted file mode 100644
index 2e5ccad7a..000000000
--- a/webapp/tests/components/integrations/installed_oauth_apps.test.jsx
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import InstalledOAuthApps from 'components/integrations/components/installed_oauth_apps/installed_oauth_apps.jsx';
-
-describe('components/integrations/InstalledOAuthApps', () => {
- test('should match snapshot', () => {
- const emptyFunction = jest.fn();
- const oauthApps = {
- facxd9wpzpbpfp8pad78xj75pr: {
- id: 'facxd9wpzpbpfp8pad78xj75pr',
- name: 'firstApp',
- client_secret: '88cxd9wpzpbpfp8pad78xj75pr',
- create_at: 1501365458934,
- creator_id: '88oybd1dwfdoxpkpw1h5kpbyco',
- description: 'testing',
- homepage: 'https://test.com',
- icon_url: 'https://test.com/icon',
- is_trusted: false,
- update_at: 1501365458934,
- callback_urls: ['https://test.com/callback']
- },
- fzcxd9wpzpbpfp8pad78xj75pr: {
- id: 'fzcxd9wpzpbpfp8pad78xj75pr',
- name: 'secondApp',
- client_secret: 'decxd9wpzpbpfp8pad78xj75pr',
- create_at: 1501365459984,
- creator_id: '88oybd2dwfdoxpkpw1h5kpbyco',
- description: 'testing2',
- homepage: 'https://test2.com',
- icon_url: 'https://test2.com/icon',
- is_trusted: true,
- update_at: 1501365479988,
- callback_urls: ['https://test2.com/callback', 'https://test2.com/callback2']
- }
- };
- global.window.mm_config = {EnableOAuthServiceProvider: 'true'};
-
- const wrapper = shallow(
- <InstalledOAuthApps
- team={{name: 'test'}}
- oauthApps={oauthApps}
- isSystemAdmin={true}
- actions={{
- getOAuthApps: emptyFunction,
- regenOAuthAppSecret: emptyFunction,
- deleteOAuthApp: emptyFunction
- }}
- />
- );
- expect(wrapper.find('InstalledOAuthApp').length).toBe(2);
- expect(wrapper).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/webapp/tests/components/new_channel_modal.test.jsx b/webapp/tests/components/new_channel_modal.test.jsx
deleted file mode 100644
index 358a839a3..000000000
--- a/webapp/tests/components/new_channel_modal.test.jsx
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import Constants from 'utils/constants.jsx';
-
-import NewChannelModal from 'components/new_channel_modal/new_channel_modal.jsx';
-
-describe('components/NewChannelModal', () => {
- afterEach(() => {
- global.window.mm_config = null;
- global.window.mm_license = null;
- });
-
- test('should match snapshot, modal not showing', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_license = {};
- global.window.mm_license.IsLicensed = 'false';
-
- const wrapper = shallow(
- <NewChannelModal
- show={true}
- channelType={Constants.OPEN_CHANNEL}
- channelData={{name: 'testchannel', displayName: 'testchannel', header: '', purpose: ''}}
- onSubmitChannel={emptyFunction}
- onModalDismissed={emptyFunction}
- onTypeSwitched={emptyFunction}
- onChangeURLPressed={emptyFunction}
- onDataChanged={emptyFunction}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, modal showing', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_license = {};
- global.window.mm_license.IsLicensed = 'false';
-
- const wrapper = shallow(
- <NewChannelModal
- show={true}
- channelType={Constants.OPEN_CHANNEL}
- channelData={{name: 'testchannel', displayName: 'testchannel', header: '', purpose: ''}}
- onSubmitChannel={emptyFunction}
- onModalDismissed={emptyFunction}
- onTypeSwitched={emptyFunction}
- onChangeURLPressed={emptyFunction}
- onDataChanged={emptyFunction}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, private channel filled in header and purpose', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_license = {};
- global.window.mm_license.IsLicensed = 'false';
-
- const wrapper = shallow(
- <NewChannelModal
- show={true}
- channelType={Constants.PRIVATE_CHANNEL}
- channelData={{name: 'testchannel', displayName: 'testchannel', header: 'some header', purpose: 'some purpose'}}
- onSubmitChannel={emptyFunction}
- onModalDismissed={emptyFunction}
- onTypeSwitched={emptyFunction}
- onChangeURLPressed={emptyFunction}
- onDataChanged={emptyFunction}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/post_view/post_info/__snapshots__/post_info.test.jsx.snap b/webapp/tests/components/post_view/post_info/__snapshots__/post_info.test.jsx.snap
deleted file mode 100644
index d58df052d..000000000
--- a/webapp/tests/components/post_view/post_info/__snapshots__/post_info.test.jsx.snap
+++ /dev/null
@@ -1,515 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`components/post_view/PostInfo should match snapshot 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={false}
- />
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={false}
- isFlagged={false}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- </div>
- <div
- className="col col__reply"
- >
- <Connect(DotMenu)
- commentCount={0}
- handleCommentClick={[Function]}
- handleDropdownOpened={[Function]}
- idCount={-1}
- idPrefix="center"
- isFlagged={false}
- post={
- Object {
- "channel_id": "g6139tbospd18cmxroesdk3kkc",
- "create_at": 1502715365009,
- "delete_at": 0,
- "edit_at": 1502715372443,
- "hashtags": "",
- "id": "e584uzbwwpny9kengqayx5ayzw",
- "is_pinned": false,
- "message": "post message",
- "original_id": "",
- "parent_id": "",
- "pending_post_id": "",
- "props": Object {},
- "root_id": "",
- "type": "",
- "update_at": 1502715372443,
- "user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
- }
- }
- />
- <span>
- <EmojiPickerOverlay
- container={[Function]}
- onEmojiClick={[Function]}
- onHide={[Function]}
- rightOffset={7}
- show={false}
- spaceRequiredAbove={422}
- spaceRequiredBelow={436}
- target={[Function]}
- />
- <a
- className="reacticon__container"
- href="#"
- onClick={[Function]}
- >
- <span
- className="icon icon--emoji"
- dangerouslySetInnerHTML={
- Object {
- "__html": "<svg width='15px' height='15px' viewBox='0 0 15 15' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> <g stroke='none' stroke-width='1' fill='inherit' fill-rule='evenodd'> <g transform='translate(-1071.000000, -954.000000)' fill='inherit'> <g transform='translate(25.000000, 937.000000)'> <g transform='translate(1046.000000, 17.000000)'> <path d='M7.5,0.0852272727 C3.405,0.0852272727 0.0852272727,3.405 0.0852272727,7.5 C0.0852272727,11.595 3.405,14.9147727 7.5,14.9147727 C11.595,14.9147727 14.9147727,11.595 14.9147727,7.5 C14.9147727,3.405 11.595,0.0852272727 7.5,0.0852272727 Z M7.5,14.0663436 C3.87926951,14.0663436 0.933656417,11.1207305 0.933656417,7.5 C0.933656417,3.87926951 3.87926951,0.933656417 7.5,0.933656417 C11.1207305,0.933656417 14.0663436,3.87926951 14.0663436,7.5 C14.0663436,11.1207305 11.1207305,14.0663436 7.5,14.0663436 Z'></path> <path d='M11.7732955,8.95397727 C12.0119318,8.90488636 12.2159659,9.11778409 12.1684091,9.35676136 C11.8063636,11.1790909 9.85346591,12.5710227 7.49846591,12.5710227 C5.15096591,12.5710227 3.20284091,11.1877841 2.83193182,9.37397727 C2.78181818,9.129375 2.99267045,8.911875 3.23744318,8.96198864 C4.85369318,9.29232955 10.1786932,9.28142045 11.7732955,8.95397727 Z'></path> <ellipse cx='4.94318182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> <ellipse cx='10.0568182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> </g> </g> </g> </g> </svg>",
- }
- }
- />
- </a>
- </span>
- <CommentIcon
- commentCount={0}
- handleCommentClick={[Function]}
- id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
- idCount={-1}
- idPrefix="commentIcon"
- searchStyle=""
- />
- </div>
-</div>
-`;
-
-exports[`components/post_view/PostInfo should match snapshot, compact display 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={false}
- />
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={false}
- isFlagged={false}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- </div>
- <div
- className="col col__reply"
- >
- <Connect(DotMenu)
- commentCount={0}
- handleCommentClick={[Function]}
- handleDropdownOpened={[Function]}
- idCount={-1}
- idPrefix="center"
- isFlagged={false}
- post={
- Object {
- "channel_id": "g6139tbospd18cmxroesdk3kkc",
- "create_at": 1502715365009,
- "delete_at": 0,
- "edit_at": 1502715372443,
- "hashtags": "",
- "id": "e584uzbwwpny9kengqayx5ayzw",
- "is_pinned": false,
- "message": "post message",
- "original_id": "",
- "parent_id": "",
- "pending_post_id": "",
- "props": Object {},
- "root_id": "",
- "type": "",
- "update_at": 1502715372443,
- "user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
- }
- }
- />
- <span>
- <EmojiPickerOverlay
- container={[Function]}
- onEmojiClick={[Function]}
- onHide={[Function]}
- rightOffset={7}
- show={false}
- spaceRequiredAbove={422}
- spaceRequiredBelow={436}
- target={[Function]}
- />
- <a
- className="reacticon__container"
- href="#"
- onClick={[Function]}
- >
- <span
- className="icon icon--emoji"
- dangerouslySetInnerHTML={
- Object {
- "__html": "<svg width='15px' height='15px' viewBox='0 0 15 15' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> <g stroke='none' stroke-width='1' fill='inherit' fill-rule='evenodd'> <g transform='translate(-1071.000000, -954.000000)' fill='inherit'> <g transform='translate(25.000000, 937.000000)'> <g transform='translate(1046.000000, 17.000000)'> <path d='M7.5,0.0852272727 C3.405,0.0852272727 0.0852272727,3.405 0.0852272727,7.5 C0.0852272727,11.595 3.405,14.9147727 7.5,14.9147727 C11.595,14.9147727 14.9147727,11.595 14.9147727,7.5 C14.9147727,3.405 11.595,0.0852272727 7.5,0.0852272727 Z M7.5,14.0663436 C3.87926951,14.0663436 0.933656417,11.1207305 0.933656417,7.5 C0.933656417,3.87926951 3.87926951,0.933656417 7.5,0.933656417 C11.1207305,0.933656417 14.0663436,3.87926951 14.0663436,7.5 C14.0663436,11.1207305 11.1207305,14.0663436 7.5,14.0663436 Z'></path> <path d='M11.7732955,8.95397727 C12.0119318,8.90488636 12.2159659,9.11778409 12.1684091,9.35676136 C11.8063636,11.1790909 9.85346591,12.5710227 7.49846591,12.5710227 C5.15096591,12.5710227 3.20284091,11.1877841 2.83193182,9.37397727 C2.78181818,9.129375 2.99267045,8.911875 3.23744318,8.96198864 C4.85369318,9.29232955 10.1786932,9.28142045 11.7732955,8.95397727 Z'></path> <ellipse cx='4.94318182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> <ellipse cx='10.0568182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> </g> </g> </g> </g> </svg>",
- }
- }
- />
- </a>
- </span>
- <CommentIcon
- commentCount={0}
- handleCommentClick={[Function]}
- id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
- idCount={-1}
- idPrefix="commentIcon"
- searchStyle=""
- />
- </div>
-</div>
-`;
-
-exports[`components/post_view/PostInfo should match snapshot, ephemeral deleted post 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={false}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={false}
- />
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={true}
- isFlagged={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- </div>
- <div
- className="col col__remove"
- >
- <a
- className="post__remove theme"
- href="#"
- onClick={[Function]}
- type="button"
- >
- ×
- </a>
- </div>
-</div>
-`;
-
-exports[`components/post_view/PostInfo should match snapshot, ephemeral post 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={false}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={false}
- />
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={true}
- isFlagged={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- <span
- className="post__visibility"
- >
- <FormattedMessage
- defaultMessage="(Only visible to you)"
- id="post_info.message.visible"
- values={Object {}}
- />
- </span>
- </div>
- <div
- className="col col__remove"
- >
- <a
- className="post__remove theme"
- href="#"
- onClick={[Function]}
- type="button"
- >
- ×
- </a>
- </div>
-</div>
-`;
-
-exports[`components/post_view/PostInfo should match snapshot, flagged post 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={false}
- />
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={false}
- isFlagged={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- </div>
- <div
- className="col col__reply"
- >
- <Connect(DotMenu)
- commentCount={0}
- handleCommentClick={[Function]}
- handleDropdownOpened={[Function]}
- idCount={-1}
- idPrefix="center"
- isFlagged={true}
- post={
- Object {
- "channel_id": "g6139tbospd18cmxroesdk3kkc",
- "create_at": 1502715365009,
- "delete_at": 0,
- "edit_at": 1502715372443,
- "hashtags": "",
- "id": "e584uzbwwpny9kengqayx5ayzw",
- "is_pinned": false,
- "message": "post message",
- "original_id": "",
- "parent_id": "",
- "pending_post_id": "",
- "props": Object {},
- "root_id": "",
- "type": "",
- "update_at": 1502715372443,
- "user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
- }
- }
- />
- <span>
- <EmojiPickerOverlay
- container={[Function]}
- onEmojiClick={[Function]}
- onHide={[Function]}
- rightOffset={7}
- show={false}
- spaceRequiredAbove={422}
- spaceRequiredBelow={436}
- target={[Function]}
- />
- <a
- className="reacticon__container"
- href="#"
- onClick={[Function]}
- >
- <span
- className="icon icon--emoji"
- dangerouslySetInnerHTML={
- Object {
- "__html": "<svg width='15px' height='15px' viewBox='0 0 15 15' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> <g stroke='none' stroke-width='1' fill='inherit' fill-rule='evenodd'> <g transform='translate(-1071.000000, -954.000000)' fill='inherit'> <g transform='translate(25.000000, 937.000000)'> <g transform='translate(1046.000000, 17.000000)'> <path d='M7.5,0.0852272727 C3.405,0.0852272727 0.0852272727,3.405 0.0852272727,7.5 C0.0852272727,11.595 3.405,14.9147727 7.5,14.9147727 C11.595,14.9147727 14.9147727,11.595 14.9147727,7.5 C14.9147727,3.405 11.595,0.0852272727 7.5,0.0852272727 Z M7.5,14.0663436 C3.87926951,14.0663436 0.933656417,11.1207305 0.933656417,7.5 C0.933656417,3.87926951 3.87926951,0.933656417 7.5,0.933656417 C11.1207305,0.933656417 14.0663436,3.87926951 14.0663436,7.5 C14.0663436,11.1207305 11.1207305,14.0663436 7.5,14.0663436 Z'></path> <path d='M11.7732955,8.95397727 C12.0119318,8.90488636 12.2159659,9.11778409 12.1684091,9.35676136 C11.8063636,11.1790909 9.85346591,12.5710227 7.49846591,12.5710227 C5.15096591,12.5710227 3.20284091,11.1877841 2.83193182,9.37397727 C2.78181818,9.129375 2.99267045,8.911875 3.23744318,8.96198864 C4.85369318,9.29232955 10.1786932,9.28142045 11.7732955,8.95397727 Z'></path> <ellipse cx='4.94318182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> <ellipse cx='10.0568182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> </g> </g> </g> </g> </svg>",
- }
- }
- />
- </a>
- </span>
- <CommentIcon
- commentCount={0}
- handleCommentClick={[Function]}
- id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
- idCount={-1}
- idPrefix="commentIcon"
- searchStyle=""
- />
- </div>
-</div>
-`;
-
-exports[`components/post_view/PostInfo should match snapshot, military time 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={true}
- />
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={false}
- isFlagged={false}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- </div>
- <div
- className="col col__reply"
- >
- <Connect(DotMenu)
- commentCount={0}
- handleCommentClick={[Function]}
- handleDropdownOpened={[Function]}
- idCount={-1}
- idPrefix="center"
- isFlagged={false}
- post={
- Object {
- "channel_id": "g6139tbospd18cmxroesdk3kkc",
- "create_at": 1502715365009,
- "delete_at": 0,
- "edit_at": 1502715372443,
- "hashtags": "",
- "id": "e584uzbwwpny9kengqayx5ayzw",
- "is_pinned": false,
- "message": "post message",
- "original_id": "",
- "parent_id": "",
- "pending_post_id": "",
- "props": Object {},
- "root_id": "",
- "type": "",
- "update_at": 1502715372443,
- "user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
- }
- }
- />
- <CommentIcon
- commentCount={0}
- handleCommentClick={[Function]}
- id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
- idCount={-1}
- idPrefix="commentIcon"
- searchStyle=""
- />
- </div>
-</div>
-`;
-
-exports[`components/post_view/PostInfo should match snapshot, pinned post 1`] = `
-<div
- className="post__header--info"
->
- <div
- className="col"
- >
- <PostTime
- eventTime={1502715365009}
- isPermalink={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- useMilitaryTime={false}
- />
- <span
- className="post__pinned-badge"
- >
- <FormattedMessage
- defaultMessage="Pinned"
- id="post_info.pinned"
- values={Object {}}
- />
- </span>
- <PostFlagIcon
- idCount={-1}
- idPrefix="centerPostFlag"
- isEphemeral={false}
- isFlagged={true}
- postId="e584uzbwwpny9kengqayx5ayzw"
- />
- </div>
- <div
- className="col col__reply"
- >
- <Connect(DotMenu)
- commentCount={0}
- handleCommentClick={[Function]}
- handleDropdownOpened={[Function]}
- idCount={-1}
- idPrefix="center"
- isFlagged={true}
- post={
- Object {
- "channel_id": "g6139tbospd18cmxroesdk3kkc",
- "create_at": 1502715365009,
- "delete_at": 0,
- "edit_at": 1502715372443,
- "hashtags": "",
- "id": "e584uzbwwpny9kengqayx5ayzw",
- "is_pinned": true,
- "message": "post message",
- "original_id": "",
- "parent_id": "",
- "pending_post_id": "",
- "props": Object {},
- "root_id": "",
- "type": "",
- "update_at": 1502715372443,
- "user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
- }
- }
- />
- <span>
- <EmojiPickerOverlay
- container={[Function]}
- onEmojiClick={[Function]}
- onHide={[Function]}
- rightOffset={7}
- show={false}
- spaceRequiredAbove={422}
- spaceRequiredBelow={436}
- target={[Function]}
- />
- <a
- className="reacticon__container"
- href="#"
- onClick={[Function]}
- >
- <span
- className="icon icon--emoji"
- dangerouslySetInnerHTML={
- Object {
- "__html": "<svg width='15px' height='15px' viewBox='0 0 15 15' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> <g stroke='none' stroke-width='1' fill='inherit' fill-rule='evenodd'> <g transform='translate(-1071.000000, -954.000000)' fill='inherit'> <g transform='translate(25.000000, 937.000000)'> <g transform='translate(1046.000000, 17.000000)'> <path d='M7.5,0.0852272727 C3.405,0.0852272727 0.0852272727,3.405 0.0852272727,7.5 C0.0852272727,11.595 3.405,14.9147727 7.5,14.9147727 C11.595,14.9147727 14.9147727,11.595 14.9147727,7.5 C14.9147727,3.405 11.595,0.0852272727 7.5,0.0852272727 Z M7.5,14.0663436 C3.87926951,14.0663436 0.933656417,11.1207305 0.933656417,7.5 C0.933656417,3.87926951 3.87926951,0.933656417 7.5,0.933656417 C11.1207305,0.933656417 14.0663436,3.87926951 14.0663436,7.5 C14.0663436,11.1207305 11.1207305,14.0663436 7.5,14.0663436 Z'></path> <path d='M11.7732955,8.95397727 C12.0119318,8.90488636 12.2159659,9.11778409 12.1684091,9.35676136 C11.8063636,11.1790909 9.85346591,12.5710227 7.49846591,12.5710227 C5.15096591,12.5710227 3.20284091,11.1877841 2.83193182,9.37397727 C2.78181818,9.129375 2.99267045,8.911875 3.23744318,8.96198864 C4.85369318,9.29232955 10.1786932,9.28142045 11.7732955,8.95397727 Z'></path> <ellipse cx='4.94318182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> <ellipse cx='10.0568182' cy='5.50431818' rx='1' ry='1.06534091'></ellipse> </g> </g> </g> </g> </svg>",
- }
- }
- />
- </a>
- </span>
- <CommentIcon
- commentCount={0}
- handleCommentClick={[Function]}
- id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
- idCount={-1}
- idPrefix="commentIcon"
- searchStyle=""
- />
- </div>
-</div>
-`;
diff --git a/webapp/tests/components/post_view/post_info/post_info.test.jsx b/webapp/tests/components/post_view/post_info/post_info.test.jsx
deleted file mode 100644
index d254226eb..000000000
--- a/webapp/tests/components/post_view/post_info/post_info.test.jsx
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import Constants from 'utils/constants.jsx';
-import PostInfo from 'components/post_view/post_info/post_info.jsx';
-import {Posts} from 'mattermost-redux/constants';
-
-const post = {
- channel_id: 'g6139tbospd18cmxroesdk3kkc',
- create_at: 1502715365009,
- delete_at: 0,
- edit_at: 1502715372443,
- hashtags: '',
- id: 'e584uzbwwpny9kengqayx5ayzw',
- is_pinned: false,
- message: 'post message',
- original_id: '',
- parent_id: '',
- pending_post_id: '',
- props: {},
- root_id: '',
- type: '',
- update_at: 1502715372443,
- user_id: 'b4pfxi8sn78y8yq7phzxxfor7h'
-};
-
-describe('components/post_view/PostInfo', () => {
- afterEach(() => {
- global.window.mm_config = null;
- global.window.EnableEmojiPicker = null;
- });
-
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'true';
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={false}
- isFlagged={false}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, compact display', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'true';
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={false}
- isFlagged={false}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, military time', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'false';
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={true}
- isFlagged={false}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, flagged post', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'true';
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={false}
- isFlagged={true}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, pinned post', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'true';
-
- post.is_pinned = true;
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={false}
- isFlagged={true}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, ephemeral post', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'true';
-
- post.is_pinned = false;
- post.type = Constants.PostTypes.EPHEMERAL;
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={false}
- isFlagged={true}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot, ephemeral deleted post', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- global.window.mm_config = {};
- global.window.mm_config.EnableEmojiPicker = 'true';
-
- post.type = Constants.PostTypes.EPHEMERAL;
- post.state = Posts.POST_DELETED;
-
- const wrapper = shallow(
- <PostInfo
- post={post}
- handleCommentClick={emptyFunction}
- handleDropdownOpened={emptyFunction}
- compactDisplay={false}
- lastPostCount={0}
- replyCount={0}
- getPostList={emptyFunction}
- useMilitaryTime={false}
- isFlagged={true}
- actions={{
- removePost: emptyFunction,
- addReaction: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/webapp/tests/components/reset_status_modal.test.jsx b/webapp/tests/components/reset_status_modal.test.jsx
deleted file mode 100644
index 420bb2bfe..000000000
--- a/webapp/tests/components/reset_status_modal.test.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow} from 'enzyme';
-
-import ResetStatusModal from 'components/reset_status_modal/reset_status_modal.jsx';
-
-describe('components/ResetStatusModal', () => {
- test('should match snapshot', () => {
- function emptyFunction() {} //eslint-disable-line no-empty-function
-
- async function fakeAutoReset() { //eslint-disable-line require-await
- return {status: 'away', manual: true, user_id: 'fake'};
- }
-
- const wrapper = shallow(
- <ResetStatusModal
- autoResetPref=''
- actions={{
- autoResetStatus: fakeAutoReset,
- setStatus: emptyFunction,
- savePreferences: emptyFunction
- }}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/shortcuts_modal.test.jsx b/webapp/tests/components/shortcuts_modal.test.jsx
deleted file mode 100644
index 04fa51a76..000000000
--- a/webapp/tests/components/shortcuts_modal.test.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-import {mountWithIntl} from 'tests/helpers/intl-test-helper.jsx';
-import ShortcutsModal from 'components/shortcuts_modal.jsx';
-
-describe('components/ShortcutsModal', () => {
- test('should match snapshot modal for Mac', () => {
- const wrapper = mountWithIntl(
- <ShortcutsModal isMac={true}/>
- );
-
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot modal for non-Mac like Windows/Linux', () => {
- const wrapper = mountWithIntl(
- <ShortcutsModal isMac={false}/>
- );
-
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/components/spinner_button.test.jsx b/webapp/tests/components/spinner_button.test.jsx
deleted file mode 100644
index 40a323f44..000000000
--- a/webapp/tests/components/spinner_button.test.jsx
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {shallow, mount} from 'enzyme';
-
-import SpinnerButton from 'components/spinner_button.jsx';
-
-describe('components/SpinnerButton', () => {
- test('should match snapshot with required props', () => {
- const wrapper = shallow(
- <SpinnerButton
- spinning={false}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot with spinning', () => {
- const wrapper = shallow(
- <SpinnerButton
- spinning={true}
- />
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot with children', () => {
- const wrapper = shallow(
- <SpinnerButton
- spinning={false}
- >
- <span id='child1'/>
- <span id='child2'/>
- </SpinnerButton>
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should handle onClick', (done) => {
- function onClick() {
- done();
- }
-
- const wrapper = mount(
- <SpinnerButton
- spinning={false}
- onClick={onClick}
- />
- );
- wrapper.find('button').first().props().onClick();
- });
-});
diff --git a/webapp/tests/components/suggestion/suggestion_box.test.jsx b/webapp/tests/components/suggestion/suggestion_box.test.jsx
deleted file mode 100644
index 85ca634ad..000000000
--- a/webapp/tests/components/suggestion/suggestion_box.test.jsx
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import SuggestionBox from 'components/suggestion/suggestion_box.jsx';
-
-describe('components/SuggestionBox', function() {
- test('findOverlap', () => {
- expect(SuggestionBox.findOverlap('', 'blue')).toBe('');
- expect(SuggestionBox.findOverlap('red', '')).toBe('');
- expect(SuggestionBox.findOverlap('red', 'blue')).toBe('');
- expect(SuggestionBox.findOverlap('red', 'dog')).toBe('d');
- expect(SuggestionBox.findOverlap('red', 'education')).toBe('ed');
- expect(SuggestionBox.findOverlap('red', 'reduce')).toBe('red');
- expect(SuggestionBox.findOverlap('black', 'ack')).toBe('ack');
- });
-});
diff --git a/webapp/tests/helpers/client-test-helper.jsx b/webapp/tests/helpers/client-test-helper.jsx
deleted file mode 100644
index 26e8d6ba5..000000000
--- a/webapp/tests/helpers/client-test-helper.jsx
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import Client from 'client/client.jsx';
-import WebSocketClient from 'client/websocket_client.jsx';
-import jqd from 'jquery-deferred';
-
-var HEADER_TOKEN = 'token';
-
-class TestHelperClass {
- basicClient = () => {
- return this.basicc;
- }
-
- basicWebSocketClient = () => {
- return this.basicwsc;
- }
-
- basicTeam = () => {
- return this.basict;
- }
-
- basicUser = () => {
- return this.basicu;
- }
-
- basicChannel = () => {
- return this.basicch;
- }
-
- basicPost = () => {
- return this.basicp;
- }
-
- generateId = () => {
- // implementation taken from http://stackoverflow.com/a/2117523
- var id = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
-
- id = id.replace(/[xy]/g, function replaceRandom(c) {
- var r = Math.floor(Math.random() * 16);
-
- var v;
- if (c === 'x') {
- v = r;
- } else {
- v = (r & 0x3) | 0x8;
- }
-
- return v.toString(16);
- });
-
- return 'uid' + id;
- }
-
- createClient() {
- var c = new Client();
- c.setUrl('http://localhost:8065');
- c.useHeaderToken();
- c.enableLogErrorsToConsole(true);
- return c;
- }
-
- createWebSocketClient(token) {
- var ws = new WebSocketClient();
- ws.initialize('http://localhost:8065/api/v3/users/websocket', token);
- return ws;
- }
-
- fakeEmail = () => {
- return 'success' + this.generateId() + '@simulator.amazonses.com';
- }
-
- fakeUser = () => {
- var user = {};
- user.email = this.fakeEmail();
- user.allow_marketing = true;
- user.password = 'password1';
- user.username = this.generateId();
- return user;
- }
-
- fakeTeam = () => {
- var team = {};
- team.name = this.generateId();
- team.display_name = `Unit Test ${team.name}`;
- team.type = 'O';
- team.email = this.fakeEmail();
- team.allowed_domains = '';
- return team;
- }
-
- fakeChannel = () => {
- var channel = {};
- channel.name = this.generateId();
- channel.display_name = `Unit Test ${channel.name}`;
- channel.type = 'O'; // open channel
- return channel;
- }
-
- fakePost = () => {
- var post = {};
- post.message = `Unit Test ${this.generateId()}`;
- return post;
- }
-
- initBasic = (done, callback, connectWS) => {
- this.basicc = this.createClient();
-
- function throwerror(err) {
- done.fail(new Error(err.message));
- }
-
- var d1 = jqd.Deferred();
- var email = this.fakeEmail();
- var user = this.fakeUser();
- var team = this.fakeTeam();
- team.email = email;
- user.email = email;
- var self = this;
-
- this.basicClient().createUser(
- user,
- function(ruser) {
- self.basicu = ruser;
- self.basicu.password = user.password;
- self.basicClient().login(
- self.basicu.email,
- self.basicu.password,
- null,
- function(data, res) {
- if (connectWS) {
- self.basicwsc = self.createWebSocketClient(res.header[HEADER_TOKEN]);
- }
- self.basicClient().useHeaderToken();
- self.basicClient().createTeam(team,
- function(rteam) {
- self.basict = rteam;
- self.basicClient().setTeamId(rteam.id);
- var channel = self.fakeChannel();
- channel.team_id = self.basicTeam().id;
- self.basicClient().createChannel(
- channel,
- function(rchannel) {
- self.basicch = rchannel;
- var post = self.fakePost();
- post.channel_id = rchannel.id;
-
- self.basicClient().createPost(
- post,
- function(rpost) {
- self.basicp = rpost;
- d1.resolve();
- },
- throwerror
- );
- },
- throwerror
- );
- },
- throwerror
- );
- },
- throwerror
- );
- },
- throwerror
- );
-
- jqd.when(d1).done(() => {
- callback();
- });
- }
-}
-
-var TestHelper = new TestHelperClass();
-export default TestHelper;
diff --git a/webapp/tests/helpers/intl-test-helper.jsx b/webapp/tests/helpers/intl-test-helper.jsx
deleted file mode 100644
index db164c45c..000000000
--- a/webapp/tests/helpers/intl-test-helper.jsx
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import {mount, shallow} from 'enzyme';
-import React from 'react';
-import {IntlProvider, intlShape} from 'react-intl';
-
-const intlProvider = new IntlProvider({locale: 'en'}, {});
-const {intl} = intlProvider.getChildContext();
-
-export function shallowWithIntl(node, {context} = {}) {
- return shallow(React.cloneElement(node, {intl}), {
- context: Object.assign({}, context, {intl})
- });
-}
-
-export function mountWithIntl(node, {context, childContextTypes} = {}) {
- return mount(React.cloneElement(node, {intl}), {
- context: Object.assign({}, context, {intl}),
- childContextTypes: Object.assign({}, {intl: intlShape}, childContextTypes)
- });
-}
diff --git a/webapp/tests/plugins/__snapshots__/pluggable.test.jsx.snap b/webapp/tests/plugins/__snapshots__/pluggable.test.jsx.snap
deleted file mode 100644
index 2f7a5e232..000000000
--- a/webapp/tests/plugins/__snapshots__/pluggable.test.jsx.snap
+++ /dev/null
@@ -1,111 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`plugins/Pluggable should match snapshot with no overridden component 1`] = `
-<IntlProvider>
- <Pluggable
- components={Object {}}
- theme={Object {}}
- >
- <ProfilePopover
- hasMention={false}
- isRHS={false}
- src="src"
- theme={Object {}}
- user={Object {}}
- >
- <Popover
- bsClass="popover"
- id="user-profile-popover"
- placement="right"
- theme={Object {}}
- title="@undefined"
- >
- <div
- className="popover right"
- id="user-profile-popover"
- role="tooltip"
- style={
- Object {
- "display": "block",
- "left": undefined,
- "top": undefined,
- }
- }
- theme={Object {}}
- >
- <div
- className="arrow"
- style={
- Object {
- "left": undefined,
- "top": undefined,
- }
- }
- />
- <h3
- className="popover-title"
- >
- @undefined
- </h3>
- <div
- className="popover-content"
- >
- <img
- className="user-popover__image"
- height="128"
- src="src"
- width="128"
- />
- <div
- className="popover__row first"
- data-toggle="tooltip"
- >
- <a
- className="text-nowrap text-lowercase user-popover__email"
- href="#"
- onClick={[Function]}
- >
- <i
- className="fa fa-paper-plane"
- />
- <FormattedMessage
- defaultMessage="Send Message"
- id="user_profile.send.dm"
- values={Object {}}
- >
- <span>
- Send Message
- </span>
- </FormattedMessage>
- </a>
- </div>
- </div>
- </div>
- </Popover>
- </ProfilePopover>
- </Pluggable>
-</IntlProvider>
-`;
-
-exports[`plugins/Pluggable should match snapshot with overridden component 1`] = `
-<Pluggable
- components={
- Object {
- "ProfilePopover": [Function],
- }
- }
- theme={Object {}}
->
- <ProfilePopoverPlugin
- hasMention={false}
- isRHS={false}
- src="src"
- theme={Object {}}
- user={Object {}}
- >
- <span>
- ProfilePopoverPlugin
- </span>
- </ProfilePopoverPlugin>
-</Pluggable>
-`;
diff --git a/webapp/tests/plugins/pluggable.test.jsx b/webapp/tests/plugins/pluggable.test.jsx
deleted file mode 100644
index 96dedb037..000000000
--- a/webapp/tests/plugins/pluggable.test.jsx
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-import {mount} from 'enzyme';
-import {IntlProvider} from 'react-intl';
-
-import Pluggable from 'plugins/pluggable/pluggable.jsx';
-import ProfilePopover from 'components/profile_popover.jsx';
-
-class ProfilePopoverPlugin extends React.PureComponent {
- render() {
- return <span>{'ProfilePopoverPlugin'}</span>;
- }
-}
-
-describe('plugins/Pluggable', () => {
- test('should match snapshot with overridden component', () => {
- const wrapper = mount(
- <Pluggable
- components={{ProfilePopover: ProfilePopoverPlugin}}
- theme={{}}
- >
- <ProfilePopover
- user={{}}
- src='src'
- />
- </Pluggable>
- );
- expect(wrapper).toMatchSnapshot();
- });
-
- test('should match snapshot with no overridden component', () => {
- window.mm_config = {};
- const wrapper = mount(
- <IntlProvider>
- <Pluggable
- components={{}}
- theme={{}}
- >
- <ProfilePopover
- user={{}}
- src='src'
- />
- </Pluggable>
- </IntlProvider>
- );
- expect(wrapper).toMatchSnapshot();
- });
-});
diff --git a/webapp/tests/utils/channel_utils.test.jsx b/webapp/tests/utils/channel_utils.test.jsx
deleted file mode 100644
index 74a9339e2..000000000
--- a/webapp/tests/utils/channel_utils.test.jsx
+++ /dev/null
@@ -1,782 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import * as Utils from 'utils/channel_utils.jsx';
-import Constants from 'utils/constants.jsx';
-
-describe('Channel Utils', () => {
- describe('showDeleteOption', () => {
- test('all users can delete channels on unlicensed instances', () => {
- global.window.mm_license = {IsLicensed: 'false'};
- expect(Utils.showDeleteOptionForCurrentUser(null, true, true, true)).
- toEqual(true);
- });
-
- test('users cannot delete default channels', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- const channel = {name: Constants.DEFAULT_CHANNEL};
- expect(Utils.showDeleteOptionForCurrentUser(channel, true, true, true)).
- toEqual(false);
- });
-
- test('system admins can delete private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins can delete private channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins can delete public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins can delete public channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can delete private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can delete private channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can delete public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can delete public channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can delete private channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, true, false)).
- toEqual(true);
- });
-
- test('system admins or team admins can delete public channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete public channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, true, false, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, true, false, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete public channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, true)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, true)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can delete public channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(false);
- });
-
- test('channel, team, and system admins can delete private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(false);
- });
-
- test('any member can delete public channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelDeletion: Constants.PERMISSIONS_ALL};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(true);
- });
-
- test('any member can delete private channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_ALL};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showDeleteOptionForCurrentUser(channel, false, false, false)).
- toEqual(true);
- });
- });
-
- describe('showManagementOptions', () => {
- test('all users can manage channel options on unlicensed instances', () => {
- global.window.mm_license = {IsLicensed: 'false'};
- expect(Utils.showManagementOptions(null, true, true, true)).
- toEqual(true);
- });
-
- test('system admins can manage channel options in private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins can manage channel options in private channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins can manage channel options in public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins can manage channel options in public channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can manage channel options in private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can manage channel options in private channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can manage channel options in public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can manage channel options in public channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can manage channel options in private channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, true, false)).
- toEqual(true);
- });
-
- test('system admins or team admins can manage channel options in public channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in public channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, true, false, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, true, false, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in public channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, true)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, true)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel options in public channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(false);
- });
-
- test('channel, team, and system admins can manage channel options in private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(false);
- });
-
- test('any member can manage channel options in public channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelManagement: Constants.PERMISSIONS_ALL};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(true);
- });
-
- test('any member can manage channel options in private channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManagement: Constants.PERMISSIONS_ALL};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.showManagementOptions(channel, false, false, false)).
- toEqual(true);
- });
- });
-
- describe('showCreateOption', () => {
- test('all users can create new channels on unlicensed instances', () => {
- global.window.mm_license = {IsLicensed: 'false'};
- expect(Utils.showCreateOption(null, true, true)).
- toEqual(true);
- });
-
- test('system admins can create new private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, false, true)).
- toEqual(true);
- });
-
- test('system admins can create new private channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, false, false)).
- toEqual(false);
- });
-
- test('system admins can create new public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, true)).
- toEqual(true);
- });
-
- test('system admins can create new public channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can create new private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_TEAM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can create new private channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_TEAM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can create new public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_TEAM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can create new public channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_TEAM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can create new private channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_TEAM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, true, false)).
- toEqual(true);
- });
-
- test('system admins or team admins can create new public channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_TEAM_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can create new public channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can create new public channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can create new private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can create new public channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, true)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can create new private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, false, true)).
- toEqual(true);
- });
-
- test('any member can create new public channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPublicChannelCreation: Constants.PERMISSIONS_ALL};
-
- expect(Utils.showCreateOption(Constants.OPEN_CHANNEL, false, false)).
- toEqual(true);
- });
-
- test('any member can create new private channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelCreation: Constants.PERMISSIONS_ALL};
-
- expect(Utils.showCreateOption(Constants.PRIVATE_CHANNEL, false, false)).
- toEqual(true);
- });
- });
-
- describe('canManageMembers', () => {
- test('all users can manage channel members on unlicensed instances', () => {
- global.window.mm_license = {IsLicensed: 'false'};
- expect(Utils.canManageMembers(null, true, true, true)).
- toEqual(true);
- });
-
- test('system admins can manage channel members in private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins can manage channel members in private channels, user is not system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_SYSTEM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can manage channel members in private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, true)).
- toEqual(true);
- });
-
- test('system admins or team admins can manage channel members in private channels, user is not system admin or team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, false)).
- toEqual(false);
- });
-
- test('system admins or team admins can manage channel members in private channels, user is team admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_TEAM_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel members in private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, true, false, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel members in private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, true, false)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel members in private channels, user is system admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, true)).
- toEqual(true);
- });
-
- test('channel, team, and system admins can manage channel members in private channels, user is channel admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_CHANNEL_ADMIN};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.PRIVATE_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, false)).
- toEqual(false);
- });
-
- test('any member can manage channel members in public channels, user is not admin test', () => {
- global.window.mm_license = {IsLicensed: 'true'};
- global.window.mm_config = {RestrictPrivateChannelManageMembers: Constants.PERMISSIONS_ALL};
-
- const channel = {
- name: 'fakeChannelName',
- type: Constants.OPEN_CHANNEL
- };
- expect(Utils.canManageMembers(channel, false, false, false)).
- toEqual(true);
- });
- });
-}); \ No newline at end of file
diff --git a/webapp/tests/utils/emoticons.test.jsx b/webapp/tests/utils/emoticons.test.jsx
deleted file mode 100644
index 28829428b..000000000
--- a/webapp/tests/utils/emoticons.test.jsx
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import EmojiStore from 'stores/emoji_store.jsx';
-import * as Emoticons from 'utils/emoticons.jsx';
-
-describe('Emoticons', () => {
- describe('handleEmoticons', () => {
- const emojis = EmojiStore.getEmojis();
-
- test('should replace emoticons with tokens', () => {
- expect(Emoticons.handleEmoticons(':goat: :dash:', new Map(), emojis)).
- toEqual('$MM_EMOTICON0 $MM_EMOTICON1');
- });
-
- test('should replace emoticons not separated by whitespace', () => {
- expect(Emoticons.handleEmoticons(':goat::dash:', new Map(), emojis)).
- toEqual('$MM_EMOTICON0$MM_EMOTICON1');
- });
-
- test('should replace emoticons separated by punctuation', () => {
- expect(Emoticons.handleEmoticons('/:goat:..:dash:)', new Map(), emojis)).
- toEqual('/$MM_EMOTICON0..$MM_EMOTICON1)');
- });
-
- test('should replace emoticons separated by text', () => {
- expect(Emoticons.handleEmoticons('asdf:goat:asdf:dash:asdf', new Map(), emojis)).
- toEqual('asdf$MM_EMOTICON0asdf$MM_EMOTICON1asdf');
- });
-
- test('shouldn\'t replace invalid emoticons', () => {
- expect(Emoticons.handleEmoticons(':asdf: :goat : : dash:', new Map(), emojis)).
- toEqual(':asdf: :goat : : dash:');
- });
- });
-});
diff --git a/webapp/tests/utils/formatting_at_mentions.test.jsx b/webapp/tests/utils/formatting_at_mentions.test.jsx
deleted file mode 100644
index e9147b565..000000000
--- a/webapp/tests/utils/formatting_at_mentions.test.jsx
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import assert from 'assert';
-
-import * as TextFormatting from 'utils/text_formatting.jsx';
-
-describe('TextFormatting.AtMentions', function() {
- it('At mentions', function() {
- assert.equal(
- TextFormatting.autolinkAtMentions('@user', new Map()),
- '$MM_ATMENTION0',
- 'should replace mention with token'
- );
-
- assert.equal(
- TextFormatting.autolinkAtMentions('abc"@user"def', new Map()),
- 'abc"$MM_ATMENTION0"def',
- 'should replace mention surrounded by punctuation with token'
- );
-
- assert.equal(
- TextFormatting.autolinkAtMentions('@user1 @user2', new Map()),
- '$MM_ATMENTION0 $MM_ATMENTION1',
- 'should replace multiple mentions with tokens'
- );
-
- assert.equal(
- TextFormatting.autolinkAtMentions('@user1/@user2/@user3', new Map()),
- '$MM_ATMENTION0/$MM_ATMENTION1/$MM_ATMENTION2',
- 'should replace multiple mentions with tokens'
- );
-
- assert.equal(
- TextFormatting.autolinkAtMentions('@us_-e.r', new Map()),
- '$MM_ATMENTION0',
- 'should replace multiple mentions containing punctuation with token'
- );
-
- assert.equal(
- TextFormatting.autolinkAtMentions('@user.', new Map()),
- '$MM_ATMENTION0',
- 'should capture trailing punctuation as part of mention'
- );
- });
-
- it('Not at mentions', function() {
- assert.equal(
- TextFormatting.autolinkAtMentions('user@host', new Map()),
- 'user@host'
- );
-
- assert.equal(
- TextFormatting.autolinkAtMentions('user@email.com', new Map()),
- 'user@email.com'
- );
- });
-});
diff --git a/webapp/tests/utils/formatting_channel_links.test.jsx b/webapp/tests/utils/formatting_channel_links.test.jsx
deleted file mode 100644
index 39dddf008..000000000
--- a/webapp/tests/utils/formatting_channel_links.test.jsx
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import assert from 'assert';
-
-import * as TextFormatting from 'utils/text_formatting.jsx';
-
-describe('TextFormatting.ChannelLinks', () => {
- it('Not channel links', (done) => {
- assert.equal(
- TextFormatting.formatText('~123').trim(),
- '<p>~123</p>'
- );
-
- assert.equal(
- TextFormatting.formatText('~town-square').trim(),
- '<p>~town-square</p>'
- );
-
- done();
- });
-
- it('Channel links', (done) => {
- assert.equal(
- TextFormatting.formatText('~town-square', {
- channelNamesMap: {'town-square': {display_name: 'Town Square'}},
- team: {name: 'myteam'}
- }).trim(),
- '<p><a class="mention-link" href="/myteam/channels/town-square" data-channel-mention="town-square">~Town Square</a></p>'
- );
- assert.equal(
- TextFormatting.formatText('~town-square.', {
- channelNamesMap: {'town-square': {display_name: 'Town Square'}},
- team: {name: 'myteam'}
- }).trim(),
- '<p><a class="mention-link" href="/myteam/channels/town-square" data-channel-mention="town-square">~Town Square</a>.</p>'
- );
-
- assert.equal(
- TextFormatting.formatText('~town-square', {
- channelNamesMap: {'town-square': {display_name: '<b>Reception</b>'}},
- team: {name: 'myteam'}
- }).trim(),
- '<p><a class="mention-link" href="/myteam/channels/town-square" data-channel-mention="town-square">~&lt;b&gt;Reception&lt;/b&gt;</a></p>'
- );
-
- done();
- });
-});
diff --git a/webapp/tests/utils/formatting_hashtags.test.jsx b/webapp/tests/utils/formatting_hashtags.test.jsx
deleted file mode 100644
index ee18a7769..000000000
--- a/webapp/tests/utils/formatting_hashtags.test.jsx
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import assert from 'assert';
-
-import * as TextFormatting from 'utils/text_formatting.jsx';
-
-describe('TextFormatting.Hashtags', function() {
- it('Not hashtags', function(done) {
- assert.equal(
- TextFormatting.formatText('# hashtag').trim(),
- '<h1 class="markdown__heading">hashtag</h1>'
- );
-
- assert.equal(
- TextFormatting.formatText('#ab').trim(),
- '<p>#ab</p>'
- );
-
- assert.equal(
- TextFormatting.formatText('#123test').trim(),
- '<p>#123test</p>'
- );
-
- done();
- });
-
- it('Hashtags', function(done) {
- assert.equal(
- TextFormatting.formatText('#test').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test'>#test</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test123').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test123'>#test123</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test-test').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test-test'>#test-test</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test_test').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test_test'>#test_test</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test.test').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test.test'>#test.test</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test1/#test2').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test1'>#test1</a>/<a class='mention-link' href='#' data-hashtag='#test2'>#test2</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('(#test)').trim(),
- "<p>(<a class='mention-link' href='#' data-hashtag='#test'>#test</a>)</p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test-').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test'>#test</a>-</p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test.').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test'>#test</a>.</p>"
- );
-
- assert.equal(
- TextFormatting.formatText('This is a sentence #test containing a hashtag').trim(),
- "<p>This is a sentence <a class='mention-link' href='#' data-hashtag='#test'>#test</a> containing a hashtag</p>"
- );
-
- done();
- });
-
- it('Formatted hashtags', function(done) {
- assert.equal(
- TextFormatting.formatText('*#test*').trim(),
- "<p><em><a class='mention-link' href='#' data-hashtag='#test'>#test</a></em></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('_#test_').trim(),
- "<p><em><a class='mention-link' href='#' data-hashtag='#test'>#test</a></em></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('**#test**').trim(),
- "<p><strong><a class='mention-link' href='#' data-hashtag='#test'>#test</a></strong></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('__#test__').trim(),
- "<p><strong><a class='mention-link' href='#' data-hashtag='#test'>#test</a></strong></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('~~#test~~').trim(),
- "<p><del><a class='mention-link' href='#' data-hashtag='#test'>#test</a></del></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('`#test`').trim(),
- '<p>' +
- '<span class="codespan__pre-wrap">' +
- '<code>' +
- '#test' +
- '</code>' +
- '</span>' +
- '</p>'
- );
-
- assert.equal(
- TextFormatting.formatText('[this is a link #test](example.com)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">this is a link #test</a></p>'
- );
-
- done();
- });
-
- it('Searching for hashtags', function(done) {
- assert.equal(
- TextFormatting.formatText('#test', {searchTerm: 'test'}).trim(),
- "<p><span class='search-highlight'><a class='mention-link' href='#' data-hashtag='#test'>#test</a></span></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#test', {searchTerm: '#test'}).trim(),
- "<p><span class='search-highlight'><a class='mention-link' href='#' data-hashtag='#test'>#test</a></span></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#foo/#bar', {searchTerm: '#foo'}).trim(),
- "<p><span class='search-highlight'><a class='mention-link' href='#' data-hashtag='#foo'>#foo</a></span>/<a class='mention-link' href='#' data-hashtag='#bar'>#bar</a></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('#foo/#bar', {searchTerm: 'bar'}).trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#foo'>#foo</a>/<span class='search-highlight'><a class='mention-link' href='#' data-hashtag='#bar'>#bar</a></span></p>"
- );
-
- assert.equal(
- TextFormatting.formatText('not#test', {searchTerm: '#test'}).trim(),
- '<p>not#test</p>'
- );
-
- done();
- });
-
- it('Potential hashtags with other entities nested', function(done) {
- assert.equal(
- TextFormatting.formatText('#@test').trim(),
- '<p>#@test</p>'
- );
-
- let options = {
- atMentions: true
- };
- assert.equal(
- TextFormatting.formatText('#@test', options).trim(),
- '<p>#<span data-mention="test">@test</span></p>'
- );
-
- assert.equal(
- TextFormatting.formatText('#~test').trim(),
- '<p>#~test</p>'
- );
-
- options = {
- channelNamesMap: {
- test: {id: '1234', name: 'test', display_name: 'Test Channel'}
- },
- team: {id: 'abcd', name: 'abcd', display_name: 'Alphabet'}
- };
- assert.equal(
- TextFormatting.formatText('#~test', options).trim(),
- '<p>#~test</p>'
- );
-
- assert.equal(
- TextFormatting.formatText('#:mattermost:').trim(),
- '<p>#<span alt=":mattermost:" class="emoticon" title=":mattermost:" style="background-image:url(/static/emoji/mattermost.png)"></span></p>'
- );
-
- assert.equal(
- TextFormatting.formatText('#test@example.com').trim(),
- "<p><a class='mention-link' href='#' data-hashtag='#test'>#test</a>@example.com</p>"
- );
-
- done();
- });
-});
diff --git a/webapp/tests/utils/formatting_imgs.test.jsx b/webapp/tests/utils/formatting_imgs.test.jsx
deleted file mode 100644
index 3e19a1e06..000000000
--- a/webapp/tests/utils/formatting_imgs.test.jsx
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import assert from 'assert';
-
-import * as Markdown from 'utils/markdown.jsx';
-
-describe('Markdown.Imgs', function() {
- it('Inline mage', function(done) {
- assert.equal(
- Markdown.format('![Mattermost](/images/icon.png)').trim(),
- '<p><img src="/images/icon.png" alt="Mattermost" class="markdown-inline-img"></p>'
- );
-
- done();
- });
-
- it('Image with hover text', function(done) {
- assert.equal(
- Markdown.format('![Mattermost](/images/icon.png "Mattermost Icon")').trim(),
- '<p><img src="/images/icon.png" alt="Mattermost" title="Mattermost Icon" class="markdown-inline-img"></p>'
- );
-
- done();
- });
-
- it('Image with link', function(done) {
- assert.equal(
- Markdown.format('[![Mattermost](../../images/icon-76x76.png)](https://github.com/mattermost/platform)').trim(),
- '<p><a class="theme markdown__link" href="https://github.com/mattermost/platform" rel="noreferrer" target="_blank"><img src="../../images/icon-76x76.png" alt="Mattermost" class="markdown-inline-img"></a></p>'
- );
-
- done();
- });
-
- it('Image with width and height', function(done) {
- assert.equal(
- Markdown.format('![Mattermost](../../images/icon-76x76.png =50x76 "Mattermost Icon")').trim(),
- '<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" height="76" class="markdown-inline-img"></p>'
- );
-
- done();
- });
-
- it('Image with width', function(done) {
- assert.equal(
- Markdown.format('![Mattermost](../../images/icon-76x76.png =50 "Mattermost Icon")').trim(),
- '<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" class="markdown-inline-img"></p>'
- );
-
- done();
- });
-});
diff --git a/webapp/tests/utils/formatting_links.test.jsx b/webapp/tests/utils/formatting_links.test.jsx
deleted file mode 100644
index c4f949203..000000000
--- a/webapp/tests/utils/formatting_links.test.jsx
+++ /dev/null
@@ -1,516 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import assert from 'assert';
-
-import * as Markdown from 'utils/markdown.jsx';
-import * as TextFormatting from 'utils/text_formatting.jsx';
-
-describe('Markdown.Links', function() {
- it('Not links', function(done) {
- assert.equal(
- Markdown.format('example.com').trim(),
- '<p>example.com</p>'
- );
-
- assert.equal(
- Markdown.format('readme.md').trim(),
- '<p>readme.md</p>'
- );
-
- assert.equal(
- Markdown.format('@example.com').trim(),
- '<p>@example.com</p>'
- );
-
- assert.equal(
- Markdown.format('./make-compiled-client.sh').trim(),
- '<p>./make-compiled-client.sh</p>'
- );
-
- assert.equal(
- Markdown.format('test.:test').trim(),
- '<p>test.:test</p>'
- );
-
- assert.equal(
- Markdown.format('`https://example.com`').trim(),
- '<p>' +
- '<span class="codespan__pre-wrap">' +
- '<code>' +
- 'https://example.com' +
- '</code>' +
- '</span>' +
- '</p>'
- );
-
- assert.equal(
- Markdown.format('[link](example.com').trim(),
- '<p>[link](example.com</p>'
- );
-
- done();
- });
-
- it('External links', function(done) {
- assert.equal(
- Markdown.format('http://example.com').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('https://example.com').trim(),
- '<p><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com" rel="noreferrer" target="_blank">www.example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com/index').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/index" rel="noreferrer" target="_blank">www.example.com/index</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com/index.html').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/index.html" rel="noreferrer" target="_blank">www.example.com/index.html</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com/index/sub').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/index/sub" rel="noreferrer" target="_blank">www.example.com/index/sub</a></p>'
- );
-
- assert.equal(
- Markdown.format('www1.example.com').trim(),
- '<p><a class="theme markdown__link" href="http://www1.example.com" rel="noreferrer" target="_blank">www1.example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('example.com/index').trim(),
- '<p><a class="theme markdown__link" href="http://example.com/index" rel="noreferrer" target="_blank">example.com/index</a></p>'
- );
-
- done();
- });
-
- it('IP addresses', function(done) {
- assert.equal(
- Markdown.format('http://127.0.0.1').trim(),
- '<p><a class="theme markdown__link" href="http://127.0.0.1" rel="noreferrer" target="_blank">http://127.0.0.1</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://192.168.1.1:4040').trim(),
- '<p><a class="theme markdown__link" href="http://192.168.1.1:4040" rel="noreferrer" target="_blank">http://192.168.1.1:4040</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://[::1]:80').trim(),
- '<p><a class="theme markdown__link" href="http://[::1]:80" rel="noreferrer" target="_blank">http://[::1]:80</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://[::1]:8065').trim(),
- '<p><a class="theme markdown__link" href="http://[::1]:8065" rel="noreferrer" target="_blank">http://[::1]:8065</a></p>'
- );
-
- assert.equal(
- Markdown.format('https://[::1]:80').trim(),
- '<p><a class="theme markdown__link" href="https://[::1]:80" rel="noreferrer" target="_blank">https://[::1]:80</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80').trim(),
- '<p><a class="theme markdown__link" href="http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80" rel="noreferrer" target="_blank">http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:8065').trim(),
- '<p><a class="theme markdown__link" href="http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:8065" rel="noreferrer" target="_blank">http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:8065</a></p>'
- );
-
- assert.equal(
- Markdown.format('https://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:443').trim(),
- '<p><a class="theme markdown__link" href="https://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:443" rel="noreferrer" target="_blank">https://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:443</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://username:password@127.0.0.1').trim(),
- '<p><a class="theme markdown__link" href="http://username:password@127.0.0.1" rel="noreferrer" target="_blank">http://username:password@127.0.0.1</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://username:password@[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80').trim(),
- '<p><a class="theme markdown__link" href="http://username:password@[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80" rel="noreferrer" target="_blank">http://username:password@[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80</a></p>'
- );
-
- done();
- });
-
- it('Links with anchors', function(done) {
- assert.equal(
- Markdown.format('https://en.wikipedia.org/wiki/URLs#Syntax').trim(),
- '<p><a class="theme markdown__link" href="https://en.wikipedia.org/wiki/URLs#Syntax" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/URLs#Syntax</a></p>'
- );
-
- assert.equal(
- Markdown.format('https://groups.google.com/forum/#!msg').trim(),
- '<p><a class="theme markdown__link" href="https://groups.google.com/forum/#!msg" rel="noreferrer" target="_blank">https://groups.google.com/forum/#!msg</a></p>'
- );
-
- done();
- });
-
- it('Links with parameters', function(done) {
- assert.equal(
- Markdown.format('www.example.com/index?params=1').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/index?params=1" rel="noreferrer" target="_blank">www.example.com/index?params=1</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com/index?params=1&other=2').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/index?params=1&amp;other=2" rel="noreferrer" target="_blank">www.example.com/index?params=1&amp;other=2</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com/index?params=1;other=2').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/index?params=1;other=2" rel="noreferrer" target="_blank">www.example.com/index?params=1;other=2</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://example.com:8065').trim(),
- '<p><a class="theme markdown__link" href="http://example.com:8065" rel="noreferrer" target="_blank">http://example.com:8065</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://username:password@example.com').trim(),
- '<p><a class="theme markdown__link" href="http://username:password@example.com" rel="noreferrer" target="_blank">http://username:password@example.com</a></p>'
- );
-
- done();
- });
-
- it('Special characters', function(done) {
- assert.equal(
- Markdown.format('http://www.example.com/_/page').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/_/page" rel="noreferrer" target="_blank">http://www.example.com/_/page</a></p>'
- );
-
- assert.equal(
- Markdown.format('www.example.com/_/page').trim(),
- '<p><a class="theme markdown__link" href="http://www.example.com/_/page" rel="noreferrer" target="_blank">www.example.com/_/page</a></p>'
- );
-
- assert.equal(
- Markdown.format('https://en.wikipedia.org/wiki/🐬').trim(),
- '<p><a class="theme markdown__link" href="https://en.wikipedia.org/wiki/🐬" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/🐬</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://✪df.ws/1234').trim(),
- '<p><a class="theme markdown__link" href="http://✪df.ws/1234" rel="noreferrer" target="_blank">http://✪df.ws/1234</a></p>'
- );
-
- done();
- });
-
- it('Brackets', function(done) {
- assert.equal(
- Markdown.format('https://en.wikipedia.org/wiki/Rendering_(computer_graphics)').trim(),
- '<p><a class="theme markdown__link" href="https://en.wikipedia.org/wiki/Rendering_(computer_graphics)" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Rendering_(computer_graphics)</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://example.com/more_(than)_one_(parens)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com/more_(than)_one_(parens)" rel="noreferrer" target="_blank">http://example.com/more_(than)_one_(parens)</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://example.com/(something)?after=parens').trim(),
- '<p><a class="theme markdown__link" href="http://example.com/(something)?after=parens" rel="noreferrer" target="_blank">http://example.com/(something)?after=parens</a></p>'
- );
-
- assert.equal(
- Markdown.format('http://foo.com/unicode_(✪)_in_parens').trim(),
- '<p><a class="theme markdown__link" href="http://foo.com/unicode_(✪)_in_parens" rel="noreferrer" target="_blank">http://foo.com/unicode_(✪)_in_parens</a></p>'
- );
-
- done();
- });
-
- it('Email addresses', function(done) {
- assert.equal(
- Markdown.format('test@example.com').trim(),
- '<p><a class="theme" href="mailto:test@example.com">test@example.com</a></p>'
- );
- assert.equal(
- Markdown.format('test_underscore@example.com').trim(),
- '<p><a class="theme" href="mailto:test_underscore@example.com">test_underscore@example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('mailto:test@example.com').trim(),
- '<p><a class="theme markdown__link" href="mailto:test@example.com" rel="noreferrer" target="_blank">mailto:test@example.com</a></p>'
- );
-
- done();
- });
-
- it('Formatted links', function(done) {
- assert.equal(
- Markdown.format('*https://example.com*').trim(),
- '<p><em><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></em></p>'
- );
-
- assert.equal(
- Markdown.format('_https://example.com_').trim(),
- '<p><em><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></em></p>'
- );
-
- assert.equal(
- Markdown.format('**https://example.com**').trim(),
- '<p><strong><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></strong></p>'
- );
-
- assert.equal(
- Markdown.format('__https://example.com__').trim(),
- '<p><strong><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></strong></p>'
- );
-
- assert.equal(
- Markdown.format('***https://example.com***').trim(),
- '<p><strong><em><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></em></strong></p>'
- );
-
- assert.equal(
- Markdown.format('___https://example.com___').trim(),
- '<p><strong><em><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></em></strong></p>'
- );
-
- assert.equal(
- Markdown.format('<https://example.com>').trim(),
- '<p><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('<https://en.wikipedia.org/wiki/Rendering_(computer_graphics)>').trim(),
- '<p><a class="theme markdown__link" href="https://en.wikipedia.org/wiki/Rendering_(computer_graphics)" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Rendering_(computer_graphics)</a></p>'
- );
-
- done();
- });
-
- it('Links with text', function(done) {
- assert.equal(
- Markdown.format('[example link](example.com)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">example link</a></p>'
- );
-
- assert.equal(
- Markdown.format('[example.com](example.com)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">example.com</a></p>'
- );
-
- assert.equal(
- Markdown.format('[example.com/other](example.com)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">example.com/other</a></p>'
- );
-
- assert.equal(
- Markdown.format('[example.com/other_link](example.com/example)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com/example" rel="noreferrer" target="_blank">example.com/other_link</a></p>'
- );
-
- assert.equal(
- Markdown.format('[link with spaces](example.com/ spaces in the url)').trim(),
- '<p><a class="theme markdown__link" href="http://example.com/ spaces in the url" rel="noreferrer" target="_blank">link with spaces</a></p>'
- );
-
- assert.equal(
- Markdown.format('[This whole #sentence should be a link](https://example.com)').trim(),
- '<p><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">This whole #sentence should be a link</a></p>'
- );
-
- assert.equal(
- Markdown.format('[email link](mailto:test@example.com)').trim(),
- '<p><a class="theme markdown__link" href="mailto:test@example.com" rel="noreferrer" target="_blank">email link</a></p>'
- );
-
- assert.equal(
- Markdown.format('[other link](ts3server://example.com)').trim(),
- '<p><a class="theme markdown__link" href="ts3server://example.com" rel="noreferrer" target="_blank">other link</a></p>'
- );
-
- done();
- });
-
- it('Links with tooltips', function(done) {
- assert.equal(
- Markdown.format('[link](example.com "catch phrase!")').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank" title="catch phrase!">link</a></p>'
- );
-
- assert.equal(
- Markdown.format('[link](example.com "title with "quotes"")').trim(),
- '<p><a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank" title="title with &quot;quotes&quot;">link</a></p>'
- );
- assert.equal(
- Markdown.format('[link with spaces](example.com/ spaces in the url "and a title")').trim(),
- '<p><a class="theme markdown__link" href="http://example.com/ spaces in the url" rel="noreferrer" target="_blank" title="and a title">link with spaces</a></p>'
- );
-
- done();
- });
-
- it('Links with surrounding text', function(done) {
- assert.equal(
- Markdown.format('This is a sentence with a http://example.com in it.').trim(),
- '<p>This is a sentence with a <a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a> in it.</p>'
- );
-
- assert.equal(
- Markdown.format('This is a sentence with a http://example.com/_/underscore in it.').trim(),
- '<p>This is a sentence with a <a class="theme markdown__link" href="http://example.com/_/underscore" rel="noreferrer" target="_blank">http://example.com/_/underscore</a> in it.</p>'
- );
-
- assert.equal(
- Markdown.format('This is a sentence with a http://192.168.1.1:4040 in it.').trim(),
- '<p>This is a sentence with a <a class="theme markdown__link" href="http://192.168.1.1:4040" rel="noreferrer" target="_blank">http://192.168.1.1:4040</a> in it.</p>'
- );
-
- assert.equal(
- Markdown.format('This is a sentence with a https://[::1]:80 in it.').trim(),
- '<p>This is a sentence with a <a class="theme markdown__link" href="https://[::1]:80" rel="noreferrer" target="_blank">https://[::1]:80</a> in it.</p>'
- );
-
- done();
- });
-
- it('Links with trailing punctuation', function(done) {
- assert.equal(
- Markdown.format('This is a link to http://example.com.').trim(),
- '<p>This is a link to <a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>.</p>'
- );
-
- assert.equal(
- Markdown.format('This is a link containing http://example.com/something?with,commas,in,url, but not at the end').trim(),
- '<p>This is a link containing <a class="theme markdown__link" href="http://example.com/something?with,commas,in,url" rel="noreferrer" target="_blank">http://example.com/something?with,commas,in,url</a>, but not at the end</p>'
- );
-
- assert.equal(
- Markdown.format('This is a question about a link http://example.com?').trim(),
- '<p>This is a question about a link <a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>?</p>'
- );
-
- done();
- });
-
- it('Links with surrounding brackets', function(done) {
- assert.equal(
- Markdown.format('(http://example.com)').trim(),
- '<p>(<a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(see http://example.com)').trim(),
- '<p>(see <a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(http://example.com watch this)').trim(),
- '<p>(<a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a> watch this)</p>'
- );
-
- assert.equal(
- Markdown.format('(www.example.com)').trim(),
- '<p>(<a class="theme markdown__link" href="http://www.example.com" rel="noreferrer" target="_blank">www.example.com</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(see www.example.com)').trim(),
- '<p>(see <a class="theme markdown__link" href="http://www.example.com" rel="noreferrer" target="_blank">www.example.com</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(www.example.com watch this)').trim(),
- '<p>(<a class="theme markdown__link" href="http://www.example.com" rel="noreferrer" target="_blank">www.example.com</a> watch this)</p>'
- );
- assert.equal(
- Markdown.format('([link](http://example.com))').trim(),
- '<p>(<a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">link</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(see [link](http://example.com))').trim(),
- '<p>(see <a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">link</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('([link](http://example.com) watch this)').trim(),
- '<p>(<a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">link</a> watch this)</p>'
- );
-
- assert.equal(
- Markdown.format('(test@example.com)').trim(),
- '<p>(<a class="theme" href="mailto:test@example.com">test@example.com</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(email test@example.com)').trim(),
- '<p>(email <a class="theme" href="mailto:test@example.com">test@example.com</a>)</p>'
- );
-
- assert.equal(
- Markdown.format('(test@example.com email)').trim(),
- '<p>(<a class="theme" href="mailto:test@example.com">test@example.com</a> email)</p>'
- );
-
- assert.equal(
- Markdown.format('This is a sentence with a [link](http://example.com) in it.').trim(),
- '<p>This is a sentence with a <a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">link</a> in it.</p>'
- );
-
- assert.equal(
- Markdown.format('This is a sentence with a link (http://example.com) in it.').trim(),
- '<p>This is a sentence with a link (<a class="theme markdown__link" href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>) in it.</p>'
- );
-
- assert.equal(
- Markdown.format('This is a sentence with a (https://en.wikipedia.org/wiki/Rendering_(computer_graphics)) in it.').trim(),
- '<p>This is a sentence with a (<a class="theme markdown__link" href="https://en.wikipedia.org/wiki/Rendering_(computer_graphics)" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Rendering_(computer_graphics)</a>) in it.</p>'
- );
-
- done();
- });
-
- it('Searching for links', function(done) {
- assert.equal(
- TextFormatting.formatText('https://en.wikipedia.org/wiki/Unix', {searchTerm: 'wikipedia'}).trim(),
- '<p><a class="theme markdown__link search-highlight" href="https://en.wikipedia.org/wiki/Unix" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Unix</a></p>'
- );
-
- assert.equal(
- TextFormatting.formatText('[Link](https://en.wikipedia.org/wiki/Unix)', {searchTerm: 'unix'}).trim(),
- '<p><a class="theme markdown__link search-highlight" href="https://en.wikipedia.org/wiki/Unix" rel="noreferrer" target="_blank">Link</a></p>'
- );
-
- done();
- });
-
- it('Links containing %', function(done) {
- assert.equal(
- Markdown.format('https://en.wikipedia.org/wiki/%C3%89').trim(),
- '<p><a class="theme markdown__link" href="https://en.wikipedia.org/wiki/%C3%89" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/%C3%89</a></p>'
- );
-
- assert.equal(
- Markdown.format('https://en.wikipedia.org/wiki/%E9').trim(),
- '<p><a class="theme markdown__link" href="https://en.wikipedia.org/wiki/%E9" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/%E9</a></p>'
- );
-
- done();
- });
-});
diff --git a/webapp/tests/utils/latinise.test.jsx b/webapp/tests/utils/latinise.test.jsx
deleted file mode 100644
index c50859524..000000000
--- a/webapp/tests/utils/latinise.test.jsx
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import {latinise} from 'utils/latinise.jsx';
-
-describe('Latinise', () => {
- describe('handleNames', () => {
- test('should return ascii version of Dév Spé', () => {
- expect(latinise('Dév Spé')).
- toEqual('Dev Spe');
- });
-
- test('should not replace any characters', () => {
- expect(latinise('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')).
- toEqual('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
- });
-
- test('should replace characters with diacritics with ascii equivalents', () => {
- expect(latinise('àáâãäåæçèéêëìíîïñòóôõöœùúûüýÿ')).
- toEqual('aaaaaaaeceeeeiiiinooooooeuuuuyy');
- });
- });
-});
diff --git a/webapp/tests/utils/post_utils.test.jsx b/webapp/tests/utils/post_utils.test.jsx
deleted file mode 100644
index bcb5c039e..000000000
--- a/webapp/tests/utils/post_utils.test.jsx
+++ /dev/null
@@ -1,147 +0,0 @@
-import * as PostUtils from 'utils/post_utils.jsx';
-
-describe('PostUtils.containsAtMention', function() {
- test('should return correct @all (same for @channel)', function() {
- for (const data of [
- {
- text: undefined, // eslint-disable-line no-undefined
- key: undefined, // eslint-disable-line no-undefined
- result: false
- },
- {
- text: '',
- key: '',
- result: false
- },
- {
- text: 'all',
- key: '@all',
- result: false
- },
- {
- text: '@allison',
- key: '@all',
- result: false
- },
- {
- text: '@ALLISON',
- key: '@all',
- result: false
- },
- {
- text: '@all123',
- key: '@all',
- result: false
- },
- {
- text: '123@all',
- key: '@all',
- result: false
- },
- {
- text: 'hey@all',
- key: '@all',
- result: false
- },
- {
- text: 'hey@all.com',
- key: '@all',
- result: false
- },
- {
- text: '@all',
- key: '@all',
- result: true
- },
- {
- text: '@ALL',
- key: '@all',
- result: true
- },
- {
- text: '@all hey',
- key: '@all',
- result: true
- },
- {
- text: 'hey @all',
- key: '@all',
- result: true
- },
- {
- text: 'HEY @ALL',
- key: '@all',
- result: true
- },
- {
- text: 'hey @all!',
- key: '@all',
- result: true
- },
- {
- text: 'hey @all:+1:',
- key: '@all',
- result: true
- },
- {
- text: 'hey @ALL:+1:',
- key: '@all',
- result: true
- },
- {
- text: '`@all`',
- key: '@all',
- result: false
- },
- {
- text: '@someone `@all`',
- key: '@all',
- result: false
- },
- {
- text: '@someone `@all`',
- key: '@someone',
- result: true
- },
- {
- text: '``@all``',
- key: '@all',
- result: false
- },
- {
- text: '```@all```',
- key: '@all',
- result: false
- },
- {
- text: '```\n@all\n```',
- key: '@all',
- result: false
- },
- {
- text: '```````\n@all\n```````',
- key: '@all',
- result: false
- },
- {
- text: '```code\n@all\n```',
- key: '@all',
- result: false
- },
- {
- text: '~~~@all~~~',
- key: '@all',
- result: true
- },
- {
- text: '~~~\n@all\n~~~',
- key: '@all',
- result: false
- }
- ]) {
- const containsAtMention = PostUtils.containsAtMention(data.text, data.key);
-
- expect(containsAtMention).toEqual(data.result);
- }
- });
-});
diff --git a/webapp/tests/utils/utils_get_nearest_point.test.jsx b/webapp/tests/utils/utils_get_nearest_point.test.jsx
deleted file mode 100644
index 101f768bb..000000000
--- a/webapp/tests/utils/utils_get_nearest_point.test.jsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import * as CommonUtils from 'utils/commons.jsx';
-
-describe('CommonUtils.getNearestPoint', function() {
- test('should return nearest point', function() {
- for (const data of [
- {
- points: [{x: 30, y: 40}, {x: 50, y: 50}, {x: 100, y: 2}, {x: 500, y: 200}, {x: 110, y: 20}, {x: 10, y: 20}],
- pivotPoint: {x: 10, y: 20},
- nearestPoint: {x: 10, y: 20},
- nearestPointLte: {x: 10, y: 20}
- },
- {
- points: [{x: 50, y: 50}, {x: 100, y: 2}, {x: 500, y: 200}, {x: 110, y: 20}, {x: 100, y: 90}, {x: 30, y: 40}],
- pivotPoint: {x: 10, y: 20},
- nearestPoint: {x: 30, y: 40},
- nearestPointLte: {}
- },
- {
- points: [{x: 50, y: 50}, {x: 1, y: 1}, {x: 15, y: 25}, {x: 100, y: 2}, {x: 500, y: 200}, {x: 110, y: 20}],
- pivotPoint: {x: 10, y: 20},
- nearestPoint: {x: 15, y: 25},
- nearestPointLte: {x: 1, y: 1}
- }
- ]) {
- const nearestPoint = CommonUtils.getNearestPoint(data.pivotPoint, data.points);
-
- expect(nearestPoint.x).toEqual(data.nearestPoint.x);
- expect(nearestPoint.y).toEqual(data.nearestPoint.y);
- }
- });
-});