Skip to content

Commit 6fba9ce

Browse files
committed
Update test
1 parent 84dc505 commit 6fba9ce

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

polaris-react/src/components/Inline/tests/Inline.test.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,49 @@ describe('<Inline />', () => {
1717

1818
expect(stack).toContainReactText(childText);
1919
});
20+
21+
it('renders custom properties by default', () => {
22+
const stack = mountWithApp(<Inline>{renderChildren()}</Inline>);
23+
24+
expect(stack).toContainReactComponent('div', {
25+
style: expect.objectContaining({
26+
'--pc-inline-align': 'start',
27+
'--pc-inline-block-align': 'center',
28+
'--pc-inline-wrap': 'wrap',
29+
}) as React.CSSProperties,
30+
});
31+
});
32+
33+
it('overrides custom properties if they are passed in', () => {
34+
const stack = mountWithApp(
35+
<Inline align="center" blockAlign="start" gap="10">
36+
{renderChildren()}
37+
</Inline>,
38+
);
39+
40+
expect(stack).toContainReactComponent('div', {
41+
style: expect.objectContaining({
42+
'--pc-inline-align': 'center',
43+
'--pc-inline-block-align': 'start',
44+
'--pc-inline-wrap': 'wrap',
45+
'--pc-inline-gap-xs': 'var(--p-space-10)',
46+
}) as React.CSSProperties,
47+
});
48+
});
49+
50+
it('accepts gap based on breakpoints', () => {
51+
const stack = mountWithApp(
52+
<Inline gap={{xs: '2', md: '8'}}>{renderChildren()}</Inline>,
53+
);
54+
55+
expect(stack).toContainReactComponent('div', {
56+
style: expect.objectContaining({
57+
'--pc-inline-align': 'start',
58+
'--pc-inline-block-align': 'center',
59+
'--pc-inline-wrap': 'wrap',
60+
'--pc-inline-gap-xs': 'var(--p-space-2)',
61+
'--pc-inline-gap-md': 'var(--p-space-8)',
62+
}) as React.CSSProperties,
63+
});
64+
});
2065
});

0 commit comments

Comments
 (0)