-
Notifications
You must be signed in to change notification settings - Fork 227
/
Body1.test.tsx
33 lines (29 loc) · 968 Bytes
/
Body1.test.tsx
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
import {assert} from 'chai';
import {shallow} from 'enzyme';
import * as React from 'react';
import {Body1} from '../../../packages/typography/index';
suite('TypographyBody1');
test('classNames adds classes', () => {
const wrapper = shallow(<Body1 className='test-class-name'>Text</Body1>, {
disableLifecycleMethods: true,
});
assert.isTrue(wrapper.hasClass('mdc-typography'));
assert.isTrue(wrapper.hasClass('mdc-typography--body1'));
assert.isTrue(wrapper.hasClass('test-class-name'));
});
test('renders a different tag', () => {
const wrapper = shallow(<Body1 tag='h1'>Text</Body1>, {
disableLifecycleMethods: true,
});
assert.equal(wrapper.type(), 'h1');
});
test('keeps custom props', () => {
const wrapper = shallow(
<Body1 disabled={true} label='test-prop'>
Children
</Body1>,
{disableLifecycleMethods: true}
);
assert.isTrue(wrapper.props().disabled);
assert.equal(wrapper.props().label, 'test-prop');
});