You've already forked mattermost-webapp
mirror of
https://github.com/zerotier/mattermost-webapp.git
synced 2026-05-22 16:23:25 -07:00
593a8bbd00
* MM-13272: Adding Loading Component * MM-13272: Improving loaders consistency * Updated i18n/en.json * Applying proposed changes * Lot of naming and path changes * Changing classes names
59 lines
1.5 KiB
React
59 lines
1.5 KiB
React
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
import {shallow} from 'enzyme';
|
|
|
|
import LoadingWrapper from './loading_wrapper.jsx';
|
|
|
|
describe('components/widgets/loading/LoadingWrapper', () => {
|
|
const testCases = [
|
|
{
|
|
name: 'showing spinner with text',
|
|
loading: true,
|
|
text: 'test',
|
|
children: 'children',
|
|
snapshot: `
|
|
<LoadingSpinner
|
|
text="test"
|
|
/>
|
|
`,
|
|
},
|
|
{
|
|
name: 'showing spinner without text',
|
|
loading: true,
|
|
children: 'text',
|
|
snapshot: `
|
|
<LoadingSpinner
|
|
text={null}
|
|
/>
|
|
`,
|
|
},
|
|
{
|
|
name: 'showing content with children',
|
|
loading: false,
|
|
children: 'text',
|
|
snapshot: '"text"',
|
|
},
|
|
{
|
|
name: 'showing content without children',
|
|
loading: false,
|
|
snapshot: '""',
|
|
},
|
|
];
|
|
for (const testCase of testCases) {
|
|
test(testCase.name, () => {
|
|
const wrapper = shallow(
|
|
<LoadingWrapper
|
|
loading={testCase.loading}
|
|
text={testCase.text}
|
|
type={testCase.type}
|
|
>
|
|
{testCase.children}
|
|
</LoadingWrapper>
|
|
);
|
|
expect(wrapper).toMatchInlineSnapshot(testCase.snapshot, '""');
|
|
});
|
|
}
|
|
});
|