creactive 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser.d.ts +1 -0
- package/build/browser.js +2 -0
- package/build/browser.js.LICENSE.txt +9 -0
- package/build/node.d.ts +1 -0
- package/build/node.js +2 -0
- package/build/node.js.LICENSE.txt +9 -0
- package/package.json +11 -6
- package/build/index.js +0 -1656
- package/source/components/index.ts +0 -2
- package/source/components/text/constants/color.ts +0 -26
- package/source/components/text/constants/font.ts +0 -32
- package/source/components/text/constants/index.ts +0 -5
- package/source/components/text/constants/role.ts +0 -12
- package/source/components/text/constants/text.ts +0 -22
- package/source/components/text/constants/type.ts +0 -27
- package/source/components/text/index.ts +0 -2
- package/source/components/text/spec/children.spec.tsx +0 -13
- package/source/components/text/spec/color.spec.native.tsx +0 -15
- package/source/components/text/spec/color.spec.tsx +0 -159
- package/source/components/text/spec/color.spec.web.tsx +0 -15
- package/source/components/text/spec/font.spec.tsx +0 -196
- package/source/components/text/spec/position.spec.tsx +0 -15
- package/source/components/text/spec/text.spec.native.tsx +0 -1043
- package/source/components/text/spec/text.spec.tsx +0 -39
- package/source/components/text/spec/text.spec.web.tsx +0 -1043
- package/source/components/text/spec/type.spec.web.tsx +0 -55
- package/source/components/text/text.stories.tsx +0 -46
- package/source/components/text/text.tsx +0 -262
- package/source/components/text/text.types.ts +0 -67
- package/source/constants/index.ts +0 -46
- package/source/constants/theme/color.ts +0 -27
- package/source/constants/theme/font.ts +0 -48
- package/source/constants/theme/index.ts +0 -50
- package/source/constants/theme/text.ts +0 -12
- package/source/contexts/index.ts +0 -15
- package/source/contexts/media/components/index.ts +0 -4
- package/source/contexts/media/components/media/index.ts +0 -2
- package/source/contexts/media/components/media/media.tsx +0 -37
- package/source/contexts/media/components/media/media.types.ts +0 -26
- package/source/contexts/media/components/wrapper/index.ts +0 -2
- package/source/contexts/media/components/wrapper/wrapper.tsx +0 -73
- package/source/contexts/media/components/wrapper/wrapper.types.ts +0 -3
- package/source/contexts/media/constants/breakpoint.ts +0 -18
- package/source/contexts/media/constants/index.ts +0 -6
- package/source/contexts/media/hooks/index.ts +0 -1
- package/source/contexts/media/hooks/use-breakpoint.ts +0 -18
- package/source/contexts/media/index.ts +0 -7
- package/source/contexts/media/media.tsx +0 -36
- package/source/contexts/media/media.types.ts +0 -38
- package/source/contexts/theme/index.ts +0 -8
- package/source/contexts/theme/theme.tsx +0 -280
- package/source/contexts/theme/theme.types.ts +0 -284
- package/source/helpers/index.ts +0 -3
- package/source/helpers/storybook/constants/control.ts +0 -25
- package/source/helpers/storybook/constants/index.ts +0 -1
- package/source/helpers/storybook/control.spec.ts +0 -140
- package/source/helpers/storybook/control.ts +0 -115
- package/source/helpers/storybook/index.ts +0 -1
- package/source/helpers/style/index.ts +0 -2
- package/source/helpers/style/style.spec.web.ts +0 -20
- package/source/helpers/style/style.ts +0 -14
- package/source/helpers/style/style.types.ts +0 -14
- package/source/hooks/index.ts +0 -1
- package/source/hooks/use-theme-style-sheet.ts +0 -135
- package/source/index.ts +0 -24
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported text color constants.
|
|
3
|
-
* Part of theme colors, suitable for text coloring.
|
|
4
|
-
* Some extra constants like transparent for example are also included.
|
|
5
|
-
*/
|
|
6
|
-
export enum TextColor {
|
|
7
|
-
TRANSPARENT,
|
|
8
|
-
BASE_100,
|
|
9
|
-
BASE_200,
|
|
10
|
-
BASE_300,
|
|
11
|
-
BASE_400,
|
|
12
|
-
BASE_500,
|
|
13
|
-
BASE_600,
|
|
14
|
-
BASE_700,
|
|
15
|
-
BASE_800,
|
|
16
|
-
BASE_900,
|
|
17
|
-
INVERSE_100,
|
|
18
|
-
INVERSE_200,
|
|
19
|
-
INVERSE_300,
|
|
20
|
-
INVERSE_400,
|
|
21
|
-
INVERSE_500,
|
|
22
|
-
INVERSE_600,
|
|
23
|
-
INVERSE_700,
|
|
24
|
-
INVERSE_800,
|
|
25
|
-
INVERSE_900,
|
|
26
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported by text component font weights enum.
|
|
3
|
-
* Should be used to control the weight of the text.
|
|
4
|
-
*/
|
|
5
|
-
export enum TextFontWeight {
|
|
6
|
-
THIN,
|
|
7
|
-
EXTRA_LIGHT,
|
|
8
|
-
LIGHT,
|
|
9
|
-
REGULAR,
|
|
10
|
-
MEDIUM,
|
|
11
|
-
SEMIBOLD,
|
|
12
|
-
BOLD,
|
|
13
|
-
EXTRA_BOLD,
|
|
14
|
-
BLACK,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Supported text font sizes enum.
|
|
19
|
-
* Should be used to control the size of the text.
|
|
20
|
-
*/
|
|
21
|
-
export enum TextFontSize {
|
|
22
|
-
X2S,
|
|
23
|
-
XS,
|
|
24
|
-
SM,
|
|
25
|
-
MD,
|
|
26
|
-
LG,
|
|
27
|
-
XL,
|
|
28
|
-
X2L,
|
|
29
|
-
X3L,
|
|
30
|
-
X4L,
|
|
31
|
-
X5L,
|
|
32
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text role enum (for inner usage).
|
|
3
|
-
* A part of react-native role type, used by text.
|
|
4
|
-
*/
|
|
5
|
-
export const enum TextRole {
|
|
6
|
-
HEADING = 'heading',
|
|
7
|
-
/**
|
|
8
|
-
* There is no paragraph role in react-native types.
|
|
9
|
-
* But thats how we render text to paragraph tag in react-native-web.
|
|
10
|
-
*/
|
|
11
|
-
PARAGRAPH = 'paragraph',
|
|
12
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text align enum supported by compoent.
|
|
3
|
-
* Allows to control text alignment if required.
|
|
4
|
-
*/
|
|
5
|
-
export enum TextAlign {
|
|
6
|
-
LEFT,
|
|
7
|
-
CENTER,
|
|
8
|
-
RIGHT,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Available text line height enum.
|
|
13
|
-
* Should be used to control the line height of the text.
|
|
14
|
-
*/
|
|
15
|
-
export enum TextLineHeight {
|
|
16
|
-
NONE,
|
|
17
|
-
TIGHT,
|
|
18
|
-
SNUG,
|
|
19
|
-
NORMAL,
|
|
20
|
-
RELAXED,
|
|
21
|
-
LOOSE,
|
|
22
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported specific text types enum.
|
|
3
|
-
* Responsible for text appearance, accessibility and semantics.
|
|
4
|
-
*/
|
|
5
|
-
export enum TextType {
|
|
6
|
-
H1,
|
|
7
|
-
H2,
|
|
8
|
-
H3,
|
|
9
|
-
H4,
|
|
10
|
-
H5,
|
|
11
|
-
H6,
|
|
12
|
-
P,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Types, that are considered as heading types.
|
|
17
|
-
* We convert them into heading text role.
|
|
18
|
-
* This types comes with aria-level attribute.
|
|
19
|
-
*/
|
|
20
|
-
export const TEXT_TYPE_HEADING = [
|
|
21
|
-
TextType.H1,
|
|
22
|
-
TextType.H2,
|
|
23
|
-
TextType.H3,
|
|
24
|
-
TextType.H4,
|
|
25
|
-
TextType.H5,
|
|
26
|
-
TextType.H6,
|
|
27
|
-
]
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { faker } from '@faker-js/faker'
|
|
2
|
-
import { render, screen } from '@testing-library/react-native'
|
|
3
|
-
import { Text } from '../text'
|
|
4
|
-
|
|
5
|
-
describe('@/components/text', () => {
|
|
6
|
-
describe('children passing as property', () => {
|
|
7
|
-
it('renders provided string as a child', () => {
|
|
8
|
-
const text = faker.lorem.words(2)
|
|
9
|
-
render(<Text>{text}</Text>)
|
|
10
|
-
expect(screen.getByText(text)).toBeTruthy()
|
|
11
|
-
})
|
|
12
|
-
})
|
|
13
|
-
})
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { faker } from '@faker-js/faker'
|
|
2
|
-
import { render, screen } from '@testing-library/react-native'
|
|
3
|
-
import { Text } from '../text'
|
|
4
|
-
|
|
5
|
-
describe('@/components/text', () => {
|
|
6
|
-
describe('color passing as property', () => {
|
|
7
|
-
it('renders with TRANSPARENT color', () => {
|
|
8
|
-
const text = faker.lorem.words(2)
|
|
9
|
-
render(<Text color={Text.Color.TRANSPARENT}>{text}</Text>)
|
|
10
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
11
|
-
color: 'transparent',
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
})
|
|
15
|
-
})
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { faker } from '@faker-js/faker'
|
|
2
|
-
import { render, screen } from '@testing-library/react-native'
|
|
3
|
-
import { Text } from '../text'
|
|
4
|
-
|
|
5
|
-
describe('@/components/text', () => {
|
|
6
|
-
describe('color passing as property', () => {
|
|
7
|
-
it('renders with BASE_800 color by default', () => {
|
|
8
|
-
const text = faker.lorem.words(2)
|
|
9
|
-
render(<Text>{text}</Text>)
|
|
10
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
11
|
-
color: 'rgb(39,39,42)',
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('renders with BASE_100 color', () => {
|
|
16
|
-
const text = faker.lorem.words(2)
|
|
17
|
-
render(<Text color={Text.Color.BASE_100}>{text}</Text>)
|
|
18
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
19
|
-
color: 'rgb(244,244,245)',
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('renders with BASE_200 color', () => {
|
|
24
|
-
const text = faker.lorem.words(2)
|
|
25
|
-
render(<Text color={Text.Color.BASE_200}>{text}</Text>)
|
|
26
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
27
|
-
color: 'rgb(228,228,231)',
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('renders with BASE_300 color', () => {
|
|
32
|
-
const text = faker.lorem.words(2)
|
|
33
|
-
render(<Text color={Text.Color.BASE_300}>{text}</Text>)
|
|
34
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
35
|
-
color: 'rgb(212,212,216)',
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('renders with BASE_400 color', () => {
|
|
40
|
-
const text = faker.lorem.words(2)
|
|
41
|
-
render(<Text color={Text.Color.BASE_400}>{text}</Text>)
|
|
42
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
43
|
-
color: 'rgb(159,159,169)',
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('renders with BASE_500 color', () => {
|
|
48
|
-
const text = faker.lorem.words(2)
|
|
49
|
-
render(<Text color={Text.Color.BASE_500}>{text}</Text>)
|
|
50
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
51
|
-
color: 'rgb(113,113,123)',
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('renders with BASE_600 color', () => {
|
|
56
|
-
const text = faker.lorem.words(2)
|
|
57
|
-
render(<Text color={Text.Color.BASE_600}>{text}</Text>)
|
|
58
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
59
|
-
color: 'rgb(82,82,92)',
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('renders with BASE_700 color', () => {
|
|
64
|
-
const text = faker.lorem.words(2)
|
|
65
|
-
render(<Text color={Text.Color.BASE_700}>{text}</Text>)
|
|
66
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
67
|
-
color: 'rgb(63,63,70)',
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('renders with BASE_800 color', () => {
|
|
72
|
-
const text = faker.lorem.words(2)
|
|
73
|
-
render(<Text color={Text.Color.BASE_800}>{text}</Text>)
|
|
74
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
75
|
-
color: 'rgb(39,39,42)',
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('renders with BASE_900 color', () => {
|
|
80
|
-
const text = faker.lorem.words(2)
|
|
81
|
-
render(<Text color={Text.Color.BASE_900}>{text}</Text>)
|
|
82
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
83
|
-
color: 'rgb(24,24,27)',
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('renders with INVERSE_100 color', () => {
|
|
88
|
-
const text = faker.lorem.words(2)
|
|
89
|
-
render(<Text color={Text.Color.INVERSE_100}>{text}</Text>)
|
|
90
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
91
|
-
color: 'rgb(24,24,27)',
|
|
92
|
-
})
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it('renders with INVERSE_200 color', () => {
|
|
96
|
-
const text = faker.lorem.words(2)
|
|
97
|
-
render(<Text color={Text.Color.INVERSE_200}>{text}</Text>)
|
|
98
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
99
|
-
color: 'rgb(39,39,42)',
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it('renders with INVERSE_300 color', () => {
|
|
104
|
-
const text = faker.lorem.words(2)
|
|
105
|
-
render(<Text color={Text.Color.INVERSE_300}>{text}</Text>)
|
|
106
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
107
|
-
color: 'rgb(63,63,70)',
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('renders with INVERSE_400 color', () => {
|
|
112
|
-
const text = faker.lorem.words(2)
|
|
113
|
-
render(<Text color={Text.Color.INVERSE_400}>{text}</Text>)
|
|
114
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
115
|
-
color: 'rgb(82,82,92)',
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
it('renders with INVERSE_500 color', () => {
|
|
120
|
-
const text = faker.lorem.words(2)
|
|
121
|
-
render(<Text color={Text.Color.INVERSE_500}>{text}</Text>)
|
|
122
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
123
|
-
color: 'rgb(113,113,123)',
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('renders with INVERSE_600 color', () => {
|
|
128
|
-
const text = faker.lorem.words(2)
|
|
129
|
-
render(<Text color={Text.Color.INVERSE_600}>{text}</Text>)
|
|
130
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
131
|
-
color: 'rgb(159,159,169)',
|
|
132
|
-
})
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
it('renders with INVERSE_700 color', () => {
|
|
136
|
-
const text = faker.lorem.words(2)
|
|
137
|
-
render(<Text color={Text.Color.INVERSE_700}>{text}</Text>)
|
|
138
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
139
|
-
color: 'rgb(212,212,216)',
|
|
140
|
-
})
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it('renders with INVERSE_800 color', () => {
|
|
144
|
-
const text = faker.lorem.words(2)
|
|
145
|
-
render(<Text color={Text.Color.INVERSE_800}>{text}</Text>)
|
|
146
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
147
|
-
color: 'rgb(228,228,231)',
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
it('renders with INVERSE_900 color', () => {
|
|
152
|
-
const text = faker.lorem.words(2)
|
|
153
|
-
render(<Text color={Text.Color.INVERSE_900}>{text}</Text>)
|
|
154
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
155
|
-
color: 'rgb(244,244,245)',
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
})
|
|
159
|
-
})
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { faker } from '@faker-js/faker'
|
|
2
|
-
import { render, screen } from '@testing-library/react-native'
|
|
3
|
-
import { Text } from '../text'
|
|
4
|
-
|
|
5
|
-
describe('@/components/text', () => {
|
|
6
|
-
describe('color passing as property', () => {
|
|
7
|
-
it('renders with TRANSPARENT color', () => {
|
|
8
|
-
const text = faker.lorem.words(2)
|
|
9
|
-
render(<Text color={Text.Color.TRANSPARENT}>{text}</Text>)
|
|
10
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
11
|
-
color: 'rgba(0,0,0,0)',
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
})
|
|
15
|
-
})
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { faker } from '@faker-js/faker'
|
|
2
|
-
import { render, screen } from '@testing-library/react-native'
|
|
3
|
-
import { Text } from '../text'
|
|
4
|
-
|
|
5
|
-
describe('@/components/text', () => {
|
|
6
|
-
describe('font family passing as property', () => {
|
|
7
|
-
it('renders with base font family style by default', () => {
|
|
8
|
-
const text = faker.lorem.words(2)
|
|
9
|
-
render(<Text>{text}</Text>)
|
|
10
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
11
|
-
fontFamily: [
|
|
12
|
-
'ui-sans-serif',
|
|
13
|
-
'-apple-system',
|
|
14
|
-
'BlinkMacSystemFont',
|
|
15
|
-
'"Segoe UI"',
|
|
16
|
-
'Roboto',
|
|
17
|
-
'Helvetica',
|
|
18
|
-
'Arial',
|
|
19
|
-
'sans-serif',
|
|
20
|
-
].join(','),
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
describe('font weight passing as property', () => {
|
|
26
|
-
it('renders with REGULAR font weight style by default', () => {
|
|
27
|
-
const text = faker.lorem.words(2)
|
|
28
|
-
render(<Text>{text}</Text>)
|
|
29
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
30
|
-
fontWeight: 400,
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('renders with THIN font weight style when provided', () => {
|
|
35
|
-
const text = faker.lorem.words(2)
|
|
36
|
-
render(<Text fontWeight={Text.FontWeight.THIN}>{text}</Text>)
|
|
37
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
38
|
-
fontWeight: 100,
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('renders with EXTRA_LIGHT font weight style when provided', () => {
|
|
43
|
-
const text = faker.lorem.words(2)
|
|
44
|
-
render(<Text fontWeight={Text.FontWeight.EXTRA_LIGHT}>{text}</Text>)
|
|
45
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
46
|
-
fontWeight: 200,
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('renders with LIGHT font weight style when provided', () => {
|
|
51
|
-
const text = faker.lorem.words(2)
|
|
52
|
-
render(<Text fontWeight={Text.FontWeight.LIGHT}>{text}</Text>)
|
|
53
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
54
|
-
fontWeight: 300,
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('renders with REGULAR font weight style when provided', () => {
|
|
59
|
-
const text = faker.lorem.words(2)
|
|
60
|
-
render(<Text fontWeight={Text.FontWeight.REGULAR}>{text}</Text>)
|
|
61
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
62
|
-
fontWeight: 400,
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('renders with MEDIUM font weight style when provided', () => {
|
|
67
|
-
const text = faker.lorem.words(2)
|
|
68
|
-
render(<Text fontWeight={Text.FontWeight.MEDIUM}>{text}</Text>)
|
|
69
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
70
|
-
fontWeight: 500,
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
it('renders with SEMIBOLD font weight style when provided', () => {
|
|
75
|
-
const text = faker.lorem.words(2)
|
|
76
|
-
render(<Text fontWeight={Text.FontWeight.SEMIBOLD}>{text}</Text>)
|
|
77
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
78
|
-
fontWeight: 600,
|
|
79
|
-
})
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('renders with BOLD font weight style when provided', () => {
|
|
83
|
-
const text = faker.lorem.words(2)
|
|
84
|
-
render(<Text fontWeight={Text.FontWeight.BOLD}>{text}</Text>)
|
|
85
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
86
|
-
fontWeight: 700,
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('renders with EXTRA_BOLD font weight style when provided', () => {
|
|
91
|
-
const text = faker.lorem.words(2)
|
|
92
|
-
render(<Text fontWeight={Text.FontWeight.EXTRA_BOLD}>{text}</Text>)
|
|
93
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
94
|
-
fontWeight: 800,
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('renders with BLACK font weight style when provided', () => {
|
|
99
|
-
const text = faker.lorem.words(2)
|
|
100
|
-
render(<Text fontWeight={Text.FontWeight.BLACK}>{text}</Text>)
|
|
101
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
102
|
-
fontWeight: 900,
|
|
103
|
-
})
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
describe('font size passing as property', () => {
|
|
108
|
-
it('renders with MD font size style by default', () => {
|
|
109
|
-
const text = faker.lorem.words(2)
|
|
110
|
-
render(<Text>{text}</Text>)
|
|
111
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
112
|
-
fontSize: 18,
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
it('renders with X2S font size style when provided', () => {
|
|
117
|
-
const text = faker.lorem.words(2)
|
|
118
|
-
render(<Text fontSize={Text.FontSize.X2S}>{text}</Text>)
|
|
119
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
120
|
-
fontSize: 12,
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
it('renders with XS font size style when provided', () => {
|
|
125
|
-
const text = faker.lorem.words(2)
|
|
126
|
-
render(<Text fontSize={Text.FontSize.XS}>{text}</Text>)
|
|
127
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
128
|
-
fontSize: 14,
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
it('renders with SM font size style when provided', () => {
|
|
133
|
-
const text = faker.lorem.words(2)
|
|
134
|
-
render(<Text fontSize={Text.FontSize.SM}>{text}</Text>)
|
|
135
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
136
|
-
fontSize: 16,
|
|
137
|
-
})
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
it('renders with MD font size style when provided', () => {
|
|
141
|
-
const text = faker.lorem.words(2)
|
|
142
|
-
render(<Text fontSize={Text.FontSize.MD}>{text}</Text>)
|
|
143
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
144
|
-
fontSize: 18,
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
it('renders with LG font size style when provided', () => {
|
|
149
|
-
const text = faker.lorem.words(2)
|
|
150
|
-
render(<Text fontSize={Text.FontSize.LG}>{text}</Text>)
|
|
151
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
152
|
-
fontSize: 20,
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('renders with XL font size style when provided', () => {
|
|
157
|
-
const text = faker.lorem.words(2)
|
|
158
|
-
render(<Text fontSize={Text.FontSize.XL}>{text}</Text>)
|
|
159
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
160
|
-
fontSize: 24,
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
it('renders with X2L font size style when provided', () => {
|
|
165
|
-
const text = faker.lorem.words(2)
|
|
166
|
-
render(<Text fontSize={Text.FontSize.X2L}>{text}</Text>)
|
|
167
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
168
|
-
fontSize: 30,
|
|
169
|
-
})
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
it('renders with X3L font size style when provided', () => {
|
|
173
|
-
const text = faker.lorem.words(2)
|
|
174
|
-
render(<Text fontSize={Text.FontSize.X3L}>{text}</Text>)
|
|
175
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
176
|
-
fontSize: 36,
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
it('renders with X4L font size style when provided', () => {
|
|
181
|
-
const text = faker.lorem.words(2)
|
|
182
|
-
render(<Text fontSize={Text.FontSize.X4L}>{text}</Text>)
|
|
183
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
184
|
-
fontSize: 48,
|
|
185
|
-
})
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
it('renders with X5L font size style when provided', () => {
|
|
189
|
-
const text = faker.lorem.words(2)
|
|
190
|
-
render(<Text fontSize={Text.FontSize.X5L}>{text}</Text>)
|
|
191
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
192
|
-
fontSize: 60,
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
})
|
|
196
|
-
})
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { faker } from '@faker-js/faker'
|
|
2
|
-
import { render, screen } from '@testing-library/react-native'
|
|
3
|
-
import { Text } from '../text'
|
|
4
|
-
|
|
5
|
-
describe('@/components/text', () => {
|
|
6
|
-
describe('text position possible property', () => {
|
|
7
|
-
it('renders with static position by default', () => {
|
|
8
|
-
const text = faker.lorem.words(2)
|
|
9
|
-
render(<Text>{text}</Text>)
|
|
10
|
-
expect(screen.getByText(text)).toHaveStyle({
|
|
11
|
-
position: 'static',
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
})
|
|
15
|
-
})
|