mattermost-mobile/app/components/post_draft/send_action/send.test.js
Elias Nahum 48f1875cf1
MM-23090 MM-26078 && MM-26876 Refactor post draft component (#4621)
* Refactor post draft component
Re-styled ReadOnly channels
Remove filename from upload error

* Update canSubmit based on file attachment changes

* Fix error message for max file size

* Fix select autocomplete values on iOS

* Style readonly and refactor accessory view for iOS

* Make PostDraft scrollViewNativeID prop not required

* Update ReadOnly to have a background with 0.40 opacity

* Update max file size error message

* Fix shift+enter with HW keyboard
2020-08-06 19:39:25 -04:00

47 lines
1.3 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme';
import Preferences from '@mm-redux/constants/preferences';
import {changeOpacity} from '@utils/theme';
import SendAction from './index';
describe('SendAction', () => {
const baseProps = {
theme: Preferences.THEMES.default,
handleSendMessage: jest.fn(),
disabled: false,
};
function getWrapper(props = {}) {
return shallow(
<SendAction
{...baseProps}
{...props}
/>,
);
}
test('should match snapshot', () => {
const wrapper = getWrapper();
expect(wrapper.getElement()).toMatchSnapshot();
});
test('should render theme backgroundColor', () => {
const wrapper = getWrapper();
expect(wrapper.getElement()).toMatchSnapshot();
expect(wrapper.childAt(0)).toHaveStyle('backgroundColor', baseProps.theme.buttonBg);
});
test('should change theme backgroundColor to 0.3 opacity', () => {
const wrapper = getWrapper({disabled: true});
expect(wrapper.getElement()).toMatchSnapshot();
expect(wrapper.childAt(0)).toHaveStyle('backgroundColor', changeOpacity(baseProps.theme.buttonBg, 0.3));
});
});