Skip to content

Commit 4b19a36

Browse files
authored
fix(Skeleton): 배경색을 overlay로 한다 (#1031)
* fix(Skeleton): 배경색을 overlay로 한다 * chore: lint * chore: lint
1 parent 1af160c commit 4b19a36

File tree

3 files changed

+432
-1
lines changed

3 files changed

+432
-1
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { baseTheme } from '@vibrant-ui/theme';
2+
import type { ReactRenderer } from '@vibrant-ui/utils/testing-web';
3+
import { createReactRenderer } from '@vibrant-ui/utils/testing-web';
4+
import { Skeleton } from './Skeleton';
5+
6+
describe('<Skeleton />', () => {
7+
const { render } = createReactRenderer();
8+
let renderer: ReactRenderer;
9+
let element: HTMLElement;
10+
11+
describe('when basic Skeleton is rendered', () => {
12+
beforeEach(async () => {
13+
renderer = render(<Skeleton data-testid="skeleton" width={100} height={50} rounded="md" />);
14+
15+
element = await renderer.findByTestId('skeleton');
16+
});
17+
18+
it('should have correct dimensions and styles', () => {
19+
expect(element).toHaveStyleRule('width', '100px');
20+
expect(element).toHaveStyleRule('height', '50px');
21+
expect(element).toHaveStyleRule('background-color', baseTheme.colors.light.overlay);
22+
});
23+
24+
it('match snapshot', () => {
25+
expect(renderer.container).toMatchSnapshot();
26+
});
27+
});
28+
29+
describe('when Skeleton.Text is rendered', () => {
30+
beforeEach(async () => {
31+
renderer = render(<Skeleton.Text data-testid="skeleton-text" lines={3} typography="body1" />);
32+
});
33+
34+
it('should render correct number of lines', async () => {
35+
const lines = await renderer.findAllByRole('generic');
36+
// VStack + (3 lines * 2 components per line)
37+
38+
expect(lines.length).toBeGreaterThan(3);
39+
});
40+
41+
it('match snapshot', () => {
42+
expect(renderer.container).toMatchSnapshot();
43+
});
44+
});
45+
46+
describe('when Skeleton.Avatar is rendered', () => {
47+
beforeEach(async () => {
48+
renderer = render(<Skeleton.Avatar data-testid="skeleton-avatar" size="md" />);
49+
});
50+
51+
it('match snapshot', () => {
52+
expect(renderer.container).toMatchSnapshot();
53+
});
54+
});
55+
56+
describe('when Skeleton.Button is rendered', () => {
57+
beforeEach(async () => {
58+
renderer = render(<Skeleton.Button data-testid="skeleton-button" size="md" />);
59+
});
60+
61+
it('match snapshot', () => {
62+
expect(renderer.container).toMatchSnapshot();
63+
});
64+
});
65+
66+
describe('when Skeleton.Image is rendered', () => {
67+
beforeEach(async () => {
68+
renderer = render(<Skeleton.Image data-testid="skeleton-image" width={200} ratio={1.5} />);
69+
});
70+
71+
it('match snapshot', () => {
72+
expect(renderer.container).toMatchSnapshot();
73+
});
74+
});
75+
});

packages/vibrant-components/src/lib/Skeleton/Skeleton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { SkeletonTextProps } from './SkeletonText';
1616
import { SkeletonText } from './SkeletonText';
1717

1818
export const Skeleton = withSkeletonVariation(props => (
19-
<Box backgroundColor="disable" {...props} />
19+
<Box backgroundColor="overlay" {...props} />
2020
)) as ComponentWithRef<SkeletonProps> & {
2121
Image: ComponentWithRef<SkeletonImageProps>;
2222
Button: ComponentWithRef<SkeletonButtonProps>;

0 commit comments

Comments
 (0)