summaryrefslogtreecommitdiffstats
path: root/webapp/tests/components
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-09-06 04:34:53 +0800
committerGitHub <noreply@github.com>2017-09-06 04:34:53 +0800
commit2977b31a3942ac0e6bd2ad1c38f2c008037c54a6 (patch)
tree3bb0077cdbd11a9bab5cff65f309c12e4371139b /webapp/tests/components
parent8d680cf64ec7fb6c8b242b8048989d0f0550cb68 (diff)
downloadchat-2977b31a3942ac0e6bd2ad1c38f2c008037c54a6.tar.gz
chat-2977b31a3942ac0e6bd2ad1c38f2c008037c54a6.tar.bz2
chat-2977b31a3942ac0e6bd2ad1c38f2c008037c54a6.zip
slight modifications to keyboards dialog and also fix error with non-Mac (#7367)
Diffstat (limited to 'webapp/tests/components')
-rw-r--r--webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap237
-rw-r--r--webapp/tests/components/shortcuts_modal.test.jsx25
2 files changed, 262 insertions, 0 deletions
diff --git a/webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap b/webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap
new file mode 100644
index 000000000..cfe719ba4
--- /dev/null
+++ b/webapp/tests/components/__snapshots__/shortcuts_modal.test.jsx.snap
@@ -0,0 +1,237 @@
+// 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/shortcuts_modal.test.jsx b/webapp/tests/components/shortcuts_modal.test.jsx
new file mode 100644
index 000000000..04fa51a76
--- /dev/null
+++ b/webapp/tests/components/shortcuts_modal.test.jsx
@@ -0,0 +1,25 @@
+// 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();
+ });
+});