Files
Jesús Espino 593a8bbd00 MM-13272: New LoadingWrapper component (#2149)
* 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
2018-12-19 05:28:56 +01:00

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, '""');
});
}
});