playbook_ui 16.1.0.pre.rc.1 → 16.1.0.pre.rc.2

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +4 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +2 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.html.erb +64 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.md +18 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +51 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +34 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +19 -0
  13. data/app/pb_kits/playbook/pb_table/docs/_sections.yml +68 -0
  14. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.html.erb +39 -0
  15. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.md +3 -0
  16. data/app/pb_kits/playbook/pb_textarea/docs/example.yml +1 -0
  17. data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +4 -10
  18. data/app/pb_kits/playbook/pb_textarea/textarea.rb +28 -0
  19. data/app/pb_kits/playbook/utilities/test/globalProps/borderRadius.test.js +33 -0
  20. data/app/pb_kits/playbook/utilities/test/globalProps/bottom.test.js +60 -0
  21. data/app/pb_kits/playbook/utilities/test/globalProps/cursor.test.js +42 -0
  22. data/app/pb_kits/playbook/utilities/test/globalProps/dark.test.js +33 -0
  23. data/app/pb_kits/playbook/utilities/test/globalProps/gap.test.js +87 -0
  24. data/app/pb_kits/playbook/utilities/test/globalProps/height.test.js +68 -0
  25. data/app/pb_kits/playbook/utilities/test/globalProps/htmlOptions.test.js +510 -0
  26. data/app/pb_kits/playbook/utilities/test/globalProps/left.test.js +60 -0
  27. data/app/pb_kits/playbook/utilities/test/globalProps/lineHeight.test.js +33 -0
  28. data/app/pb_kits/playbook/utilities/test/globalProps/margin.test.js +95 -0
  29. data/app/pb_kits/playbook/utilities/test/globalProps/numberSpacing.test.js +33 -0
  30. data/app/pb_kits/playbook/utilities/test/globalProps/overflow.test.js +68 -0
  31. data/app/pb_kits/playbook/utilities/test/globalProps/padding.test.js +95 -0
  32. data/app/pb_kits/playbook/utilities/test/globalProps/position.test.js +33 -0
  33. data/app/pb_kits/playbook/utilities/test/globalProps/right.test.js +60 -0
  34. data/app/pb_kits/playbook/utilities/test/globalProps/shadow.test.js +33 -0
  35. data/app/pb_kits/playbook/utilities/test/globalProps/textAlign.test.js +41 -0
  36. data/app/pb_kits/playbook/utilities/test/globalProps/top.test.js +60 -0
  37. data/app/pb_kits/playbook/utilities/test/globalProps/verticalAlign.test.js +40 -0
  38. data/app/pb_kits/playbook/utilities/test/globalProps/width.test.js +66 -0
  39. data/app/pb_kits/playbook/utilities/test/globalProps/zIndex.test.js +50 -0
  40. data/lib/playbook/version.rb +1 -1
  41. metadata +28 -2
@@ -0,0 +1,60 @@
1
+ import React from 'react'
2
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
3
+ import { render, screen } from '../../test-utils'
4
+ import Body from '../../../pb_body/_body'
5
+ import Button from '../../../pb_button/_button'
6
+ import Card from '../../../pb_card/_card'
7
+ import Title from '../../../pb_title/_title'
8
+ import Flex from '../../../pb_flex/_flex'
9
+ import Link from '../../../pb_link/_link'
10
+ import Badge from '../../../pb_badge/_badge'
11
+
12
+ const validSizes = ['xs', 'sm', 'md', 'lg', 'xl']
13
+
14
+ // NOTE: TextInput excluded - positioning props are not valid for input elements
15
+ // Test left prop with string values
16
+ testGlobalProp(
17
+ 'left',
18
+ validSizes,
19
+ (v) => `left_${v}`,
20
+ null,
21
+ [Body, Button, Card, Title, Flex, Link, Badge]
22
+ )
23
+
24
+ // Test left prop with object values (inset) - tested separately due to object value complexity
25
+ test('Global Props: left returns proper class name with object values (inset)', () => {
26
+ const testCases = [
27
+ { value: { value: 'md', inset: true }, expected: 'left_md_inset' },
28
+ { value: { value: 'lg', inset: false }, expected: 'left_lg' },
29
+ { value: { value: 'sm', inset: true }, expected: 'left_sm_inset' }
30
+ ]
31
+
32
+ testCases.forEach(({ value, expected }) => {
33
+ const testId = `body-left-object-${value.value}-${value.inset}`
34
+ render(
35
+ <Body
36
+ data={{ testid: testId }}
37
+ left={value}
38
+ text="Hi"
39
+ />
40
+ )
41
+ const kit = screen.getByTestId(testId)
42
+ expect(kit).toHaveClass(expected)
43
+ })
44
+ })
45
+
46
+ testGlobalPropAbsence(
47
+ 'left',
48
+ ['left_xs', 'left_sm', 'left_md', 'left_lg', 'left_xl'],
49
+ undefined,
50
+ { skipNull: true }
51
+ )
52
+
53
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
54
+ testGlobalPropInvalidValues(
55
+ 'left',
56
+ ['invalid', 'bad_value', 'not_a_size', 'special-chars!@#'],
57
+ ['left_invalid', 'left_bad_value', 'left_not_a_size', 'left_special-chars!@#'],
58
+ undefined,
59
+ { skipKnownIssues: true }
60
+ )
@@ -0,0 +1,33 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import Flex from '../../../pb_flex/_flex'
7
+ import Link from '../../../pb_link/_link'
8
+ import Badge from '../../../pb_badge/_badge'
9
+
10
+ // NOTE: TextInput excluded - lineHeight is not a valid prop for input elements
11
+ testGlobalProp(
12
+ 'lineHeight',
13
+ ['loosest', 'looser', 'loose', 'normal', 'tight', 'tighter', 'tightest'],
14
+ (v) => `line_height_${v}`,
15
+ null,
16
+ [Body, Button, Card, Title, Flex, Link, Badge]
17
+ )
18
+
19
+ testGlobalPropAbsence(
20
+ 'lineHeight',
21
+ ['line_height_loosest', 'line_height_looser', 'line_height_loose', 'line_height_normal', 'line_height_tight', 'line_height_tighter', 'line_height_tightest'],
22
+ undefined,
23
+ { skipNull: true }
24
+ )
25
+
26
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
27
+ testGlobalPropInvalidValues(
28
+ 'lineHeight',
29
+ ['invalid', 'bad_value', 'not_a_line_height', 'special-chars!@#'],
30
+ ['line_height_invalid', 'line_height_bad_value', 'line_height_not_a_line_height', 'line_height_special-chars!@#'],
31
+ undefined,
32
+ { skipKnownIssues: true }
33
+ )
@@ -0,0 +1,95 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import TextInput from '../../../pb_text_input/_text_input'
7
+ import Flex from '../../../pb_flex/_flex'
8
+ import Link from '../../../pb_link/_link'
9
+ import Badge from '../../../pb_badge/_badge'
10
+
11
+ const validValues = ['none', 'xs', 'sm', 'md', 'lg', 'xl', 'auto', 'initial', 'inherit']
12
+
13
+ // Test margin prop
14
+ testGlobalProp(
15
+ 'margin',
16
+ validValues,
17
+ (v) => `m_${v}`,
18
+ null,
19
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
20
+ )
21
+
22
+ // Test marginX prop
23
+ testGlobalProp(
24
+ 'marginX',
25
+ validValues,
26
+ (v) => `mx_${v}`,
27
+ null,
28
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
29
+ )
30
+
31
+ // Test marginY prop
32
+ testGlobalProp(
33
+ 'marginY',
34
+ validValues,
35
+ (v) => `my_${v}`,
36
+ null,
37
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
38
+ )
39
+
40
+ // Test marginTop prop
41
+ testGlobalProp(
42
+ 'marginTop',
43
+ validValues,
44
+ (v) => `mt_${v}`,
45
+ null,
46
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
47
+ )
48
+
49
+ // Test marginBottom prop
50
+ testGlobalProp(
51
+ 'marginBottom',
52
+ validValues,
53
+ (v) => `mb_${v}`,
54
+ null,
55
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
56
+ )
57
+
58
+ // Test marginLeft prop
59
+ testGlobalProp(
60
+ 'marginLeft',
61
+ validValues,
62
+ (v) => `ml_${v}`,
63
+ null,
64
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
65
+ )
66
+
67
+ // Test marginRight prop
68
+ testGlobalProp(
69
+ 'marginRight',
70
+ validValues,
71
+ (v) => `mr_${v}`,
72
+ null,
73
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
74
+ )
75
+
76
+ // Test absence for all margin props
77
+ const marginProps = ['margin', 'marginX', 'marginY', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight']
78
+ marginProps.forEach((propName) => {
79
+ const prefix = propName === 'margin' ? 'm' : propName === 'marginX' ? 'mx' : propName === 'marginY' ? 'my' : propName === 'marginTop' ? 'mt' : propName === 'marginBottom' ? 'mb' : propName === 'marginLeft' ? 'ml' : 'mr'
80
+ testGlobalPropAbsence(
81
+ propName,
82
+ [`${prefix}_xs`, `${prefix}_sm`, `${prefix}_md`, `${prefix}_lg`, `${prefix}_xl`],
83
+ undefined,
84
+ { skipNull: true }
85
+ )
86
+ })
87
+
88
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
89
+ testGlobalPropInvalidValues(
90
+ 'margin',
91
+ ['invalid', 'bad_value', 'not_a_size', 'special-chars!@#'],
92
+ ['m_invalid', 'm_bad_value', 'm_not_a_size', 'm_special-chars!@#'],
93
+ undefined,
94
+ { skipKnownIssues: true }
95
+ )
@@ -0,0 +1,33 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import Flex from '../../../pb_flex/_flex'
7
+ import Link from '../../../pb_link/_link'
8
+ import Badge from '../../../pb_badge/_badge'
9
+
10
+ // NOTE: TextInput excluded - numberSpacing is not a valid prop for input elements
11
+ testGlobalProp(
12
+ 'numberSpacing',
13
+ ['tabular'],
14
+ (v) => `ns_${v}`,
15
+ null,
16
+ [Body, Button, Card, Title, Flex, Link, Badge]
17
+ )
18
+
19
+ testGlobalPropAbsence(
20
+ 'numberSpacing',
21
+ ['ns_tabular'],
22
+ undefined,
23
+ { skipNull: true }
24
+ )
25
+
26
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
27
+ testGlobalPropInvalidValues(
28
+ 'numberSpacing',
29
+ ['invalid', 'bad_value', 'not_tabular', 'special-chars!@#'],
30
+ ['ns_invalid', 'ns_bad_value', 'ns_not_tabular', 'ns_special-chars!@#'],
31
+ undefined,
32
+ { skipKnownIssues: true }
33
+ )
@@ -0,0 +1,68 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import Flex from '../../../pb_flex/_flex'
7
+ import Link from '../../../pb_link/_link'
8
+ import Badge from '../../../pb_badge/_badge'
9
+
10
+ const validValues = ['scroll', 'visible', 'hidden', 'auto']
11
+
12
+ // NOTE: TextInput excluded - overflow properties are not valid props for input elements
13
+ // Test overflow prop
14
+ testGlobalProp(
15
+ 'overflow',
16
+ validValues,
17
+ (v) => `overflow_${v}`,
18
+ null,
19
+ [Body, Button, Card, Title, Flex, Link, Badge]
20
+ )
21
+
22
+ testGlobalPropAbsence(
23
+ 'overflow',
24
+ ['overflow_scroll', 'overflow_visible', 'overflow_hidden', 'overflow_auto'],
25
+ undefined,
26
+ { skipNull: true }
27
+ )
28
+
29
+ // Test overflowX prop
30
+ testGlobalProp(
31
+ 'overflowX',
32
+ validValues,
33
+ (v) => `overflow_x_${v}`,
34
+ null,
35
+ [Body, Button, Card, Title, Flex, Link, Badge]
36
+ )
37
+
38
+ testGlobalPropAbsence(
39
+ 'overflowX',
40
+ ['overflow_x_scroll', 'overflow_x_visible', 'overflow_x_hidden', 'overflow_x_auto'],
41
+ undefined,
42
+ { skipNull: true }
43
+ )
44
+
45
+ // Test overflowY prop
46
+ testGlobalProp(
47
+ 'overflowY',
48
+ validValues,
49
+ (v) => `overflow_y_${v}`,
50
+ null,
51
+ [Body, Button, Card, Title, Flex, Link, Badge]
52
+ )
53
+
54
+ testGlobalPropAbsence(
55
+ 'overflowY',
56
+ ['overflow_y_scroll', 'overflow_y_visible', 'overflow_y_hidden', 'overflow_y_auto'],
57
+ undefined,
58
+ { skipNull: true }
59
+ )
60
+
61
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
62
+ testGlobalPropInvalidValues(
63
+ 'overflow',
64
+ ['invalid', 'bad_value', 'not_an_overflow', 'special-chars!@#'],
65
+ ['overflow_invalid', 'overflow_bad_value', 'overflow_not_an_overflow', 'overflow_special-chars!@#'],
66
+ undefined,
67
+ { skipKnownIssues: true }
68
+ )
@@ -0,0 +1,95 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import TextInput from '../../../pb_text_input/_text_input'
7
+ import Flex from '../../../pb_flex/_flex'
8
+ import Link from '../../../pb_link/_link'
9
+ import Badge from '../../../pb_badge/_badge'
10
+
11
+ const validValues = ['none', 'xs', 'sm', 'md', 'lg', 'xl', 'auto', 'initial', 'inherit']
12
+
13
+ // Test padding prop
14
+ testGlobalProp(
15
+ 'padding',
16
+ validValues,
17
+ (v) => `p_${v}`,
18
+ null,
19
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
20
+ )
21
+
22
+ // Test paddingX prop
23
+ testGlobalProp(
24
+ 'paddingX',
25
+ validValues,
26
+ (v) => `px_${v}`,
27
+ null,
28
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
29
+ )
30
+
31
+ // Test paddingY prop
32
+ testGlobalProp(
33
+ 'paddingY',
34
+ validValues,
35
+ (v) => `py_${v}`,
36
+ null,
37
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
38
+ )
39
+
40
+ // Test paddingTop prop
41
+ testGlobalProp(
42
+ 'paddingTop',
43
+ validValues,
44
+ (v) => `pt_${v}`,
45
+ null,
46
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
47
+ )
48
+
49
+ // Test paddingBottom prop
50
+ testGlobalProp(
51
+ 'paddingBottom',
52
+ validValues,
53
+ (v) => `pb_${v}`,
54
+ null,
55
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
56
+ )
57
+
58
+ // Test paddingLeft prop
59
+ testGlobalProp(
60
+ 'paddingLeft',
61
+ validValues,
62
+ (v) => `pl_${v}`,
63
+ null,
64
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
65
+ )
66
+
67
+ // Test paddingRight prop
68
+ testGlobalProp(
69
+ 'paddingRight',
70
+ validValues,
71
+ (v) => `pr_${v}`,
72
+ null,
73
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
74
+ )
75
+
76
+ // Test absence for all padding props
77
+ const paddingProps = ['padding', 'paddingX', 'paddingY', 'paddingTop', 'paddingBottom', 'paddingLeft', 'paddingRight']
78
+ paddingProps.forEach((propName) => {
79
+ const prefix = propName === 'padding' ? 'p' : propName === 'paddingX' ? 'px' : propName === 'paddingY' ? 'py' : propName === 'paddingTop' ? 'pt' : propName === 'paddingBottom' ? 'pb' : propName === 'paddingLeft' ? 'pl' : 'pr'
80
+ testGlobalPropAbsence(
81
+ propName,
82
+ [`${prefix}_xs`, `${prefix}_sm`, `${prefix}_md`, `${prefix}_lg`, `${prefix}_xl`],
83
+ undefined,
84
+ { skipNull: true }
85
+ )
86
+ })
87
+
88
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
89
+ testGlobalPropInvalidValues(
90
+ 'padding',
91
+ ['invalid', 'bad_value', 'not_a_size', 'special-chars!@#'],
92
+ ['p_invalid', 'p_bad_value', 'p_not_a_size', 'p_special-chars!@#'],
93
+ undefined,
94
+ { skipKnownIssues: true }
95
+ )
@@ -0,0 +1,33 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import TextInput from '../../../pb_text_input/_text_input'
7
+ import Flex from '../../../pb_flex/_flex'
8
+ import Link from '../../../pb_link/_link'
9
+ import Badge from '../../../pb_badge/_badge'
10
+
11
+ testGlobalProp(
12
+ 'position',
13
+ ['relative', 'absolute', 'fixed', 'sticky'],
14
+ (v) => `position_${v}`,
15
+ null,
16
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
17
+ )
18
+
19
+ testGlobalPropAbsence(
20
+ 'position',
21
+ ['position_relative', 'position_absolute', 'position_fixed', 'position_sticky'],
22
+ undefined,
23
+ { skipNull: true }
24
+ )
25
+
26
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
27
+ testGlobalPropInvalidValues(
28
+ 'position',
29
+ ['invalid', 'bad_value', 'not_a_position', 'static', 'special-chars!@#'],
30
+ ['position_invalid', 'position_bad_value', 'position_not_a_position', 'position_static', 'position_special-chars!@#'],
31
+ undefined,
32
+ { skipKnownIssues: true }
33
+ )
@@ -0,0 +1,60 @@
1
+ import React from 'react'
2
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
3
+ import { render, screen } from '../../test-utils'
4
+ import Body from '../../../pb_body/_body'
5
+ import Button from '../../../pb_button/_button'
6
+ import Card from '../../../pb_card/_card'
7
+ import Title from '../../../pb_title/_title'
8
+ import Flex from '../../../pb_flex/_flex'
9
+ import Link from '../../../pb_link/_link'
10
+ import Badge from '../../../pb_badge/_badge'
11
+
12
+ const validSizes = ['xs', 'sm', 'md', 'lg', 'xl']
13
+
14
+ // NOTE: TextInput excluded - positioning props are not valid for input elements
15
+ // Test right prop with string values
16
+ testGlobalProp(
17
+ 'right',
18
+ validSizes,
19
+ (v) => `right_${v}`,
20
+ null,
21
+ [Body, Button, Card, Title, Flex, Link, Badge]
22
+ )
23
+
24
+ // Test right prop with object values (inset) - tested separately due to object value complexity
25
+ test('Global Props: right returns proper class name with object values (inset)', () => {
26
+ const testCases = [
27
+ { value: { value: 'md', inset: true }, expected: 'right_md_inset' },
28
+ { value: { value: 'lg', inset: false }, expected: 'right_lg' },
29
+ { value: { value: 'sm', inset: true }, expected: 'right_sm_inset' }
30
+ ]
31
+
32
+ testCases.forEach(({ value, expected }) => {
33
+ const testId = `body-right-object-${value.value}-${value.inset}`
34
+ render(
35
+ <Body
36
+ data={{ testid: testId }}
37
+ right={value}
38
+ text="Hi"
39
+ />
40
+ )
41
+ const kit = screen.getByTestId(testId)
42
+ expect(kit).toHaveClass(expected)
43
+ })
44
+ })
45
+
46
+ testGlobalPropAbsence(
47
+ 'right',
48
+ ['right_xs', 'right_sm', 'right_md', 'right_lg', 'right_xl'],
49
+ undefined,
50
+ { skipNull: true }
51
+ )
52
+
53
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
54
+ testGlobalPropInvalidValues(
55
+ 'right',
56
+ ['invalid', 'bad_value', 'not_a_size', 'special-chars!@#'],
57
+ ['right_invalid', 'right_bad_value', 'right_not_a_size', 'right_special-chars!@#'],
58
+ undefined,
59
+ { skipKnownIssues: true }
60
+ )
@@ -0,0 +1,33 @@
1
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import TextInput from '../../../pb_text_input/_text_input'
7
+ import Flex from '../../../pb_flex/_flex'
8
+ import Link from '../../../pb_link/_link'
9
+ import Badge from '../../../pb_badge/_badge'
10
+
11
+ testGlobalProp(
12
+ 'shadow',
13
+ ['none', 'deep', 'deeper', 'deepest'],
14
+ (v) => `shadow_${v}`,
15
+ null,
16
+ [Body, Button, Card, Title, TextInput, Flex, Link, Badge]
17
+ )
18
+
19
+ testGlobalPropAbsence(
20
+ 'shadow',
21
+ ['shadow_none', 'shadow_deep', 'shadow_deeper', 'shadow_deepest'],
22
+ undefined,
23
+ { skipNull: true }
24
+ )
25
+
26
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
27
+ testGlobalPropInvalidValues(
28
+ 'shadow',
29
+ ['invalid', 'bad_value', 'not_a_shadow', 'special-chars!@#'],
30
+ ['shadow_invalid', 'shadow_bad_value', 'shadow_not_a_shadow', 'shadow_special-chars!@#'],
31
+ undefined,
32
+ { skipKnownIssues: true }
33
+ )
@@ -0,0 +1,41 @@
1
+ import { testGlobalProp, testGlobalPropResponsiveWithDefault, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import { camelToSnakeCase } from '../../../utilities/text'
3
+ import Body from '../../../pb_body/_body'
4
+ import Button from '../../../pb_button/_button'
5
+ import Card from '../../../pb_card/_card'
6
+ import Title from '../../../pb_title/_title'
7
+ import Flex from '../../../pb_flex/_flex'
8
+ import Link from '../../../pb_link/_link'
9
+ import Badge from '../../../pb_badge/_badge'
10
+
11
+ // NOTE: TextInput excluded - textAlign is not a valid prop for input elements
12
+ testGlobalProp(
13
+ 'textAlign',
14
+ ['start', 'end', 'left', 'right', 'center', 'justify', 'justifyAll', 'matchParent'],
15
+ (v) => `text_align_${v}`,
16
+ (size, v) => `text_align_${size}_${camelToSnakeCase(v)}`,
17
+ [Body, Button, Card, Title, Flex, Link, Badge]
18
+ )
19
+
20
+ testGlobalPropResponsiveWithDefault(
21
+ 'textAlign',
22
+ { default: 'center', xs: 'left', sm: 'center', md: 'right' },
23
+ (v) => `text_align_${camelToSnakeCase(v)}`,
24
+ (size, v) => `text_align_${size}_${camelToSnakeCase(v)}`
25
+ )
26
+
27
+ testGlobalPropAbsence(
28
+ 'textAlign',
29
+ ['text_align_start', 'text_align_end', 'text_align_center', 'text_align_left', 'text_align_right'],
30
+ undefined,
31
+ { skipNull: true }
32
+ )
33
+
34
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
35
+ testGlobalPropInvalidValues(
36
+ 'textAlign',
37
+ ['invalid', 'bad_value', 'not_an_alignment', 'special-chars!@#'],
38
+ ['text_align_invalid', 'text_align_bad_value', 'text_align_not_an_alignment', 'text_align_special-chars!@#'],
39
+ undefined,
40
+ { skipKnownIssues: true }
41
+ )
@@ -0,0 +1,60 @@
1
+ import React from 'react'
2
+ import { testGlobalProp, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
3
+ import { render, screen } from '../../test-utils'
4
+ import Body from '../../../pb_body/_body'
5
+ import Button from '../../../pb_button/_button'
6
+ import Card from '../../../pb_card/_card'
7
+ import Title from '../../../pb_title/_title'
8
+ import Flex from '../../../pb_flex/_flex'
9
+ import Link from '../../../pb_link/_link'
10
+ import Badge from '../../../pb_badge/_badge'
11
+
12
+ const validSizes = ['xs', 'sm', 'md', 'lg', 'xl']
13
+
14
+ // NOTE: TextInput excluded - positioning props are not valid for input elements
15
+ // Test top prop with string values
16
+ testGlobalProp(
17
+ 'top',
18
+ validSizes,
19
+ (v) => `top_${v}`,
20
+ null,
21
+ [Body, Button, Card, Title, Flex, Link, Badge]
22
+ )
23
+
24
+ // Test top prop with object values (inset) - tested separately due to object value complexity
25
+ test('Global Props: top returns proper class name with object values (inset)', () => {
26
+ const testCases = [
27
+ { value: { value: 'md', inset: true }, expected: 'top_md_inset' },
28
+ { value: { value: 'lg', inset: false }, expected: 'top_lg' },
29
+ { value: { value: 'sm', inset: true }, expected: 'top_sm_inset' }
30
+ ]
31
+
32
+ testCases.forEach(({ value, expected }) => {
33
+ const testId = `body-top-object-${value.value}-${value.inset}`
34
+ render(
35
+ <Body
36
+ data={{ testid: testId }}
37
+ text="Hi"
38
+ top={value}
39
+ />
40
+ )
41
+ const kit = screen.getByTestId(testId)
42
+ expect(kit).toHaveClass(expected)
43
+ })
44
+ })
45
+
46
+ testGlobalPropAbsence(
47
+ 'top',
48
+ ['top_xs', 'top_sm', 'top_md', 'top_lg', 'top_xl'],
49
+ undefined,
50
+ { skipNull: true }
51
+ )
52
+
53
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
54
+ testGlobalPropInvalidValues(
55
+ 'top',
56
+ ['invalid', 'bad_value', 'not_a_size', 'special-chars!@#'],
57
+ ['top_invalid', 'top_bad_value', 'top_not_a_size', 'top_special-chars!@#'],
58
+ undefined,
59
+ { skipKnownIssues: true }
60
+ )
@@ -0,0 +1,40 @@
1
+ import { testGlobalProp, testGlobalPropResponsiveWithDefault, testGlobalPropAbsence, testGlobalPropInvalidValues } from './globalPropsTestHelper'
2
+ import Body from '../../../pb_body/_body'
3
+ import Button from '../../../pb_button/_button'
4
+ import Card from '../../../pb_card/_card'
5
+ import Title from '../../../pb_title/_title'
6
+ import Flex from '../../../pb_flex/_flex'
7
+ import Link from '../../../pb_link/_link'
8
+ import Badge from '../../../pb_badge/_badge'
9
+
10
+ // NOTE: TextInput excluded - verticalAlign is not a valid prop for input elements
11
+ testGlobalProp(
12
+ 'verticalAlign',
13
+ ['baseline', 'super', 'top', 'middle', 'bottom', 'sub', 'text-top', 'text-bottom'],
14
+ (v) => `vertical_align_${v}`,
15
+ (size, v) => `vertical_align_${size}_${v}`,
16
+ [Body, Button, Card, Title, Flex, Link, Badge]
17
+ )
18
+
19
+ testGlobalPropResponsiveWithDefault(
20
+ 'verticalAlign',
21
+ { default: 'middle', xs: 'top', sm: 'middle', md: 'bottom' },
22
+ (v) => `vertical_align_${v}`,
23
+ (size, v) => `vertical_align_${size}_${v}`
24
+ )
25
+
26
+ testGlobalPropAbsence(
27
+ 'verticalAlign',
28
+ ['vertical_align_baseline', 'vertical_align_top', 'vertical_align_middle', 'vertical_align_bottom'],
29
+ undefined,
30
+ { skipNull: true }
31
+ )
32
+
33
+ // NOTE: Currently using skipKnownIssues: true because globalProps.ts generates classes for invalid values
34
+ testGlobalPropInvalidValues(
35
+ 'verticalAlign',
36
+ ['invalid', 'bad_value', 'not_an_alignment', 'special-chars!@#'],
37
+ ['vertical_align_invalid', 'vertical_align_bad_value', 'vertical_align_not_an_alignment', 'vertical_align_special-chars!@#'],
38
+ undefined,
39
+ { skipKnownIssues: true }
40
+ )