-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathuse-typography-props.js
50 lines (48 loc) · 1.13 KB
/
use-typography-props.js
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
/**
* Internal dependencies
*/
import { getTypographyClassesAndStyles } from '../use-typography-props';
describe( 'getTypographyClassesAndStyles', () => {
it( 'should return styles and classes', () => {
const attributes = {
fontFamily: 'tofu',
fontSize: 'large',
style: {
typography: {
letterSpacing: '22px',
fontSize: '2rem',
textTransform: 'uppercase',
},
},
};
expect( getTypographyClassesAndStyles( attributes ) ).toEqual( {
className: 'has-tofu-font-family has-large-font-size',
style: {
letterSpacing: '22px',
fontSize: '2rem',
textTransform: 'uppercase',
},
} );
} );
it( 'should return fluid font size styles', () => {
const attributes = {
fontFamily: 'tofu',
style: {
typography: {
letterSpacing: '22px',
fontSize: '2rem',
textTransform: 'uppercase',
},
},
};
expect( getTypographyClassesAndStyles( attributes, true ) ).toEqual( {
className: 'has-tofu-font-family',
style: {
letterSpacing: '22px',
fontSize:
'clamp(1.5rem, 1.5rem + ((1vw - 0.48rem) * 0.962), 2rem)',
textTransform: 'uppercase',
},
} );
} );
} );