* 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
60 lines
No EOL
1.9 KiB
JavaScript
60 lines
No EOL
1.9 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 ProgressiveImage from './progressive_image';
|
|
|
|
jest.useFakeTimers();
|
|
|
|
describe('ProgressiveImage', () => {
|
|
test('should match snapshot for Image', () => {
|
|
const baseProps = {
|
|
isBackgroundImage: false,
|
|
imageUri: 'https://images.com/image.png',
|
|
onError: jest.fn(),
|
|
resizeMethod: 'auto',
|
|
resizeMode: 'contain',
|
|
theme: Preferences.THEMES.default,
|
|
tintDefaultSource: false,
|
|
defaultSource: undefined,
|
|
};
|
|
|
|
const wrapper = shallow(<ProgressiveImage {...baseProps}/>);
|
|
expect(wrapper.getElement()).toMatchSnapshot();
|
|
});
|
|
|
|
test('should match snapshot for Default Image', () => {
|
|
const baseProps = {
|
|
isBackgroundImage: false,
|
|
defaultSource: 'https://images.com/image.png',
|
|
onError: jest.fn(),
|
|
resizeMethod: 'auto',
|
|
resizeMode: 'contain',
|
|
theme: Preferences.THEMES.default,
|
|
tintDefaultSource: false,
|
|
};
|
|
|
|
const wrapper = shallow(<ProgressiveImage {...baseProps}/>);
|
|
expect(wrapper.getElement()).toMatchSnapshot();
|
|
});
|
|
|
|
test('should match snapshot for BackgroundImage', () => {
|
|
const baseProps = {
|
|
isBackgroundImage: true,
|
|
imageUri: 'https://images.com/image.png',
|
|
onError: jest.fn(),
|
|
resizeMethod: 'auto',
|
|
resizeMode: 'contain',
|
|
theme: Preferences.THEMES.default,
|
|
tintDefaultSource: false,
|
|
defaultSource: null,
|
|
};
|
|
|
|
const wrapper = shallow(<ProgressiveImage {...baseProps}/>);
|
|
expect(wrapper.getElement()).toMatchSnapshot();
|
|
});
|
|
}); |