playbook_ui 14.7.0.pre.rc.16 → 14.7.0.pre.rc.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +21 -28
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +37 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +13 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +37 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +67 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +40 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +51 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +26 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +11 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +59 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +20 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +13 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +12 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +8 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +81 -0
- data/dist/chunks/_weekday_stacked-Bu2Zfe7P.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +4 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +21 -3
- data/dist/chunks/_weekday_stacked-BygKGkw1.js +0 -45
@@ -0,0 +1,81 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '@testing-library/react'
|
3
|
+
import { ensureAccessible } from '../utilities/test-utils'
|
4
|
+
import { SkeletonLoading } from 'playbook-ui'
|
5
|
+
|
6
|
+
/* See these resources for more testing info:
|
7
|
+
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
8
|
+
- https://jestjs.io/docs/en/using-matchers
|
9
|
+
*/
|
10
|
+
|
11
|
+
describe('SkeletonLoading', () => {
|
12
|
+
const defaultProps = {
|
13
|
+
data: { testid: 'skeleton-loading' }
|
14
|
+
}
|
15
|
+
|
16
|
+
it('should be accessible', async () => {
|
17
|
+
ensureAccessible(SkeletonLoading, defaultProps)
|
18
|
+
})
|
19
|
+
|
20
|
+
it('renders with default props', () => {
|
21
|
+
const { container } = render(<SkeletonLoading {...defaultProps} />)
|
22
|
+
const skeleton = screen.getByTestId('skeleton-loading')
|
23
|
+
|
24
|
+
expect(skeleton).toBeInTheDocument()
|
25
|
+
expect(skeleton).toHaveClass('pb_skeleton_loading')
|
26
|
+
expect(container.querySelectorAll('div[class*="border_radius_"]')).toHaveLength(1)
|
27
|
+
})
|
28
|
+
|
29
|
+
it('renders multiple skeleton items based on stack prop', () => {
|
30
|
+
const props = {
|
31
|
+
...defaultProps,
|
32
|
+
stack: 3
|
33
|
+
}
|
34
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
35
|
+
|
36
|
+
expect(container.querySelectorAll('div[class*="border_radius_"]')).toHaveLength(3)
|
37
|
+
})
|
38
|
+
|
39
|
+
it('applies custom styles correctly', () => {
|
40
|
+
const props = {
|
41
|
+
...defaultProps,
|
42
|
+
height: '24px',
|
43
|
+
width: '50%',
|
44
|
+
borderRadius: 'lg',
|
45
|
+
color: 'light',
|
46
|
+
dark: true
|
47
|
+
}
|
48
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
49
|
+
const skeletonItem = container.querySelector('div[class*="border_radius_"]')
|
50
|
+
|
51
|
+
expect(skeletonItem).toHaveClass('border_radius_lg')
|
52
|
+
expect(skeletonItem).toHaveClass('dark')
|
53
|
+
})
|
54
|
+
|
55
|
+
it('applies gap class to items after first one', () => {
|
56
|
+
const props = {
|
57
|
+
...defaultProps,
|
58
|
+
stack: 3,
|
59
|
+
gap: 'md'
|
60
|
+
}
|
61
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
62
|
+
const skeletonItems = container.querySelectorAll('div[class*="border_radius_"]')
|
63
|
+
|
64
|
+
expect(skeletonItems[0]).not.toHaveClass('gap_md')
|
65
|
+
expect(skeletonItems[1]).toHaveClass('gap_md')
|
66
|
+
expect(skeletonItems[2]).toHaveClass('gap_md')
|
67
|
+
})
|
68
|
+
|
69
|
+
it('handles no gap properly', () => {
|
70
|
+
const props = {
|
71
|
+
...defaultProps,
|
72
|
+
stack: 2,
|
73
|
+
gap: 'none'
|
74
|
+
}
|
75
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
76
|
+
const skeletonItems = container.querySelectorAll('div[class*="border_radius_"]')
|
77
|
+
|
78
|
+
expect(skeletonItems[0]).not.toHaveClass('gap_none')
|
79
|
+
expect(skeletonItems[1]).not.toHaveClass('gap_none')
|
80
|
+
})
|
81
|
+
})
|