-
Notifications
You must be signed in to change notification settings - Fork 171
Expand file tree
/
Copy pathCompoundButton.test.tsx
More file actions
29 lines (24 loc) · 1.17 KB
/
CompoundButton.test.tsx
File metadata and controls
29 lines (24 loc) · 1.17 KB
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
import * as React from 'react';
import { CompoundButton } from '../src/CompoundButton/CompoundButton';
import { checkRenderConsistency, checkReRender } from '@fluentui-react-native/test-tools';
import * as renderer from 'react-test-renderer';
export const compountButtonTests = () => {
it('CompoundButton default', () => {
const tree = renderer.create(<CompoundButton secondaryContent="sublabel">Default Button</CompoundButton>).toJSON();
expect(tree).toMatchSnapshot();
});
it('Button simple rendering does not invalidate styling', () => {
checkRenderConsistency(() => <CompoundButton>Default button</CompoundButton>, 2);
});
it('Button re-renders correctly', () => {
checkReRender(() => <CompoundButton>Render twice</CompoundButton>, 2);
});
it('Button shares produced styles across multiple renders', () => {
const style = { backgroundColor: 'black' };
checkRenderConsistency(() => <CompoundButton style={style}>Shared styles</CompoundButton>, 2);
});
it('Button re-renders correctly with style', () => {
const style = { borderColor: 'blue' };
checkReRender(() => <CompoundButton style={style}>Shared Style Render</CompoundButton>, 2);
});
};