@pushwoosh/dumb-components 2.9.7 → 2.9.8

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { CircularSkeleton, RectangularSkeleton } from '../styles';
4
+ describe('RectangularSkeleton', () => {
5
+ it('keeps style props off the DOM and still paints them', () => {
6
+ render(_jsx(RectangularSkeleton, {
7
+ "data-testid": "rect",
8
+ width: 120,
9
+ height: 16,
10
+ color: "red",
11
+ borderRadius: 4
12
+ }));
13
+ const node = screen.getByTestId('rect');
14
+ expect(node).not.toHaveAttribute('width');
15
+ expect(node).not.toHaveAttribute('height');
16
+ expect(node).not.toHaveAttribute('color');
17
+ expect(node).not.toHaveAttribute('borderradius');
18
+ expect(getComputedStyle(node)).toMatchObject({
19
+ width: '120px',
20
+ height: '16px',
21
+ backgroundColor: 'rgb(255, 0, 0)',
22
+ borderRadius: '4px'
23
+ });
24
+ });
25
+ it('still forwards regular attributes', () => {
26
+ render(_jsx(RectangularSkeleton, {
27
+ "data-testid": "rect",
28
+ title: "loading",
29
+ "aria-busy": "true",
30
+ width: 1,
31
+ height: 1
32
+ }));
33
+ const node = screen.getByTestId('rect');
34
+ expect(node).toHaveAttribute('title', 'loading');
35
+ expect(node).toHaveAttribute('aria-busy', 'true');
36
+ });
37
+ });
38
+ describe('CircularSkeleton', () => {
39
+ it('keeps style props off the DOM and still paints them', () => {
40
+ render(_jsx(CircularSkeleton, {
41
+ "data-testid": "circle",
42
+ "aria-label": "avatar",
43
+ diameter: 32,
44
+ color: "red"
45
+ }));
46
+ const node = screen.getByTestId('circle');
47
+ expect(node).not.toHaveAttribute('diameter');
48
+ expect(node).not.toHaveAttribute('color');
49
+ expect(node).toHaveAttribute('aria-label', 'avatar');
50
+ expect(getComputedStyle(node)).toMatchObject({
51
+ width: '32px',
52
+ height: '32px',
53
+ backgroundColor: 'rgb(255, 0, 0)'
54
+ });
55
+ });
56
+ });
@@ -15,6 +15,8 @@ const skeletonCommonCss = css(["background-color:", ";animation:", " 1.5s ease-i
15
15
  }) => !color && accentCycleCss);
16
16
  /** Pulsing rectangular loading placeholder of a fixed `width`/`height`. */
17
17
  export const RectangularSkeleton = styled.div.withConfig({
18
+ shouldForwardProp: prop => !['width', 'height', 'color', 'borderRadius'].includes(prop)
19
+ }).withConfig({
18
20
  displayName: "RectangularSkeleton",
19
21
  componentId: "sc-mdyfd6-0"
20
22
  })(["width:", ";height:", ";", " ", ""], ({
@@ -24,6 +26,8 @@ export const RectangularSkeleton = styled.div.withConfig({
24
26
  }) => toCssValue(height), skeletonCommonCss, borderRadiusCss);
25
27
  /** Pulsing circular loading placeholder of a given `diameter` (e.g. for avatars). */
26
28
  export const CircularSkeleton = styled.div.withConfig({
29
+ shouldForwardProp: prop => !['diameter', 'color'].includes(prop)
30
+ }).withConfig({
27
31
  displayName: "CircularSkeleton",
28
32
  componentId: "sc-mdyfd6-1"
29
33
  })(["width:", ";height:", ";border-radius:100%;", ""], ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.9.7",
3
+ "version": "2.9.8",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",