mattermost-mobile/app/screens/settings/display_settings/display_settings.test.js
Dean Whillier fb8238ab0b
[MM-37553] Update default themes (#5648)
* new themes and theme type updates

* update theme processing

port newer functionality from webapp

* update theme UI

including new svg-based thumbnail

* lint fixes

* update snapshots and tests

* update theme tile border approach

* remove unused path component

* remove old variable typo

* remove old variable type from theme type

* lint and snapshot updates

* update snapshots
2021-09-03 10:50:24 -04:00

48 lines
1.6 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {DeviceTypes} from '@constants';
import Preferences from '@mm-redux/constants/preferences';
import SettingsItem from '@screens/settings/settings_item';
import {shallowWithIntl} from '@test/intl-test-helper';
import DisplaySettings from './display_settings';
describe('DisplaySettings', () => {
const baseProps = {
theme: Preferences.THEMES.denim,
enableTheme: false,
enableTimezone: false,
componentId: 'component-id',
};
test('should match snapshot', () => {
const wrapper = shallowWithIntl(
<DisplaySettings {...baseProps}/>,
);
expect(wrapper.getElement()).toMatchSnapshot();
expect(wrapper.find(SettingsItem).length).toBe(1);
wrapper.setProps({enableTheme: true});
expect(wrapper.find(SettingsItem).length).toBe(2);
wrapper.setProps({enableTimezone: true});
expect(wrapper.find(SettingsItem).length).toBe(3);
});
test('should match snapshot on Tablet devices', () => {
DeviceTypes.IS_TABLET = true;
const wrapper = shallowWithIntl(
<DisplaySettings {...baseProps}/>,
);
expect(wrapper.getElement()).toMatchSnapshot();
expect(wrapper.find(SettingsItem).length).toBe(2);
wrapper.setProps({enableTheme: true});
expect(wrapper.find(SettingsItem).length).toBe(3);
wrapper.setProps({enableTimezone: true});
expect(wrapper.find(SettingsItem).length).toBe(4);
});
});