blob: 40a323f44ae0b3ba708d26bf93df6236fca775c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import {shallow, mount} from 'enzyme';
import SpinnerButton from 'components/spinner_button.jsx';
describe('components/SpinnerButton', () => {
test('should match snapshot with required props', () => {
const wrapper = shallow(
<SpinnerButton
spinning={false}
/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot with spinning', () => {
const wrapper = shallow(
<SpinnerButton
spinning={true}
/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot with children', () => {
const wrapper = shallow(
<SpinnerButton
spinning={false}
>
<span id='child1'/>
<span id='child2'/>
</SpinnerButton>
);
expect(wrapper).toMatchSnapshot();
});
test('should handle onClick', (done) => {
function onClick() {
done();
}
const wrapper = mount(
<SpinnerButton
spinning={false}
onClick={onClick}
/>
);
wrapper.find('button').first().props().onClick();
});
});
|