Skip to content

Commit 507bc3d

Browse files
Merge branch 'main' into 19228-controlled-tag
2 parents 492bd60 + c60111b commit 507bc3d

File tree

31 files changed

+565
-453
lines changed

31 files changed

+565
-453
lines changed

packages/react/src/components/ShapeIndicator/ShapeIndicator.mdx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { ArgTypes, Meta } from '@storybook/blocks';
1+
import { ArgTypes, Meta, Canvas } from '@storybook/blocks';
2+
import * as ShapeIndicatorStories from './ShapeIndicator.stories';
3+
import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';
24

35
<Meta isTemplate />
46

@@ -12,6 +14,9 @@ import { ArgTypes, Meta } from '@storybook/blocks';
1214
## Table of Contents
1315

1416
- [Overview](#overview)
17+
- [Kind](#kind)
18+
- [Size](#size)
19+
- [Customizing the label](#customizing-the-label)
1520
- [Component API](#component-api)
1621
- [Feedback](#feedback)
1722

@@ -31,9 +36,20 @@ function ExampleComponent() {
3136
}
3237
```
3338

39+
<Canvas
40+
of={ShapeIndicatorStories.Default}
41+
additionalActions={[
42+
{
43+
title: 'Open in Stackblitz',
44+
onClick: () => stackblitzPrefillConfig(ShapeIndicatorStories.Default),
45+
},
46+
]}
47+
/>
48+
3449
## Kind
3550

36-
Shape indicators can take the form of failed, critical, high, medium, low, cautious, undefined, stable, informative, incomplete, and draft.
51+
Shape indicators can take the form of failed, critical, high, medium, low,
52+
cautious, undefined, stable, informative, incomplete, and draft.
3753

3854
## Text Size
3955

packages/react/src/components/UnorderedList/UnorderedList-test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,15 @@ describe('UnorderedList', () => {
4646

4747
expect(screen.getByTestId('list')).toHaveClass('some-class');
4848
});
49+
50+
it('should render expressive lists', () => {
51+
const { container } = render(
52+
<UnorderedList isExpressive>
53+
<ListItem>Item</ListItem>
54+
</UnorderedList>
55+
);
56+
57+
expect(container.firstChild).toHaveClass(`${prefix}--list--unordered`);
58+
expect(container.firstChild).toHaveClass(`${prefix}--list--expressive`);
59+
});
4960
});

packages/web-components/src/components/accordion/__tests__/accordion-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('cds-accordion', function () {
2727
it('should render', async () => {
2828
const el = await fixture(accordion);
2929

30-
expect(el).dom.to.equalSnapshot();
30+
await expect(el).dom.to.equalSnapshot();
3131
});
3232

3333
describe('automated verification testing', () => {

packages/web-components/src/components/ai-skeleton/ai-skeleton-icon.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const AISkeletonIcon = {
3030
};
3131

3232
const meta = {
33-
title: 'Components/Skeleton/AISkeleton',
33+
title: 'Components/Skeleton/AI Skeleton',
3434
};
3535

3636
export default meta;

packages/web-components/src/components/badge-indicator/__tests__/badge-indicator-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('cds-badge-indicator', function () {
1515

1616
it('should render', async () => {
1717
const el = await fixture(basicBadgeIndicator);
18-
expect(el).dom.to.equalSnapshot();
18+
await expect(el).dom.to.equalSnapshot();
1919
});
2020

2121
it('should set a count', async () => {
Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,27 @@
1-
import { ArgTypes, Markdown, Meta } from '@storybook/blocks';
2-
import { cdnJs, cdnCss } from '../../globals/internal/storybook-cdn';
1+
import { ArgTypes, Canvas, Markdown, Meta } from '@storybook/blocks';
2+
import { cdnJs } from '../../globals/internal/storybook-cdn';
33
import * as ChatButtonStories from './chat-button.stories';
44

55
<Meta of={ChatButtonStories} />
66

7-
# Chat Button
7+
# Chat button
88

9-
> 💡 Check our
10-
> [CodeSandbox](https://codesandbox.io/s/github/carbon-design-system/carbon-for-ibm-dotcom/tree/main/packages/carbon-web-components/examples/codesandbox/basic/components/chat-button)
11-
> example implementation.
9+
## Table of Contents
1210

13-
[![Edit carbon-web-components](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/carbon-design-system/carbon-for-ibm-dotcom/tree/main/packages/carbon-web-components/examples/codesandbox/basic/components/chat-button)
11+
- [Component API](#component-api)
12+
- [CDN](#cdn)
13+
- [Feedback](#feedback)
1414

15-
## Getting started
15+
<Canvas of={ChatButtonStories.Default} />
1616

17-
Here's a quick example to get you started.
17+
## Component API
1818

19-
### JS (via import)
20-
21-
```javascript
22-
import '@carbon/web-components/es/components/chat-button/index.js';
23-
```
19+
<ArgTypes of="cds-chat-button" />
2420

2521
<Markdown>{`${cdnJs({ components: ['chat-button'] })}`}</Markdown>
26-
<Markdown>{`${cdnCss()}`}</Markdown>
27-
28-
```javascript
29-
import '@carbon/web-components/es/components/chat-button/index.js';
30-
import Add16 from '@carbon/icons/lib/add/16.js';
3122

32-
function App() {
33-
return html`<cds-chat-button>
34-
Primary ${Add16({ slot: 'icon' })}
35-
</cds-chat-button>`;
36-
}
37-
```
23+
## Feedback
3824

39-
## `<cds-chat-button>` attributes and properties
40-
41-
<ArgTypes of="cds-chat-button" />
42-
````
25+
Help us improve this component by providing feedback, asking questions on Slack,
26+
or updating this file on
27+
[GitHub](https://github.com/carbon-design-system/carbon/edit/main/packages/web-components/src/components/chat-button/chat-button.mdx).

packages/web-components/src/components/chat-button/chat-button.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import styles from './chat-button.scss?lit';
1616
export { CHAT_BUTTON_SIZE, CHAT_BUTTON_KIND };
1717

1818
/**
19-
* Icon Button
19+
* Chat Button
20+
*
21+
* @element cds-chat-button
2022
*
2123
*/
2224
@customElement(`${prefix}-chat-button`)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* @web/test-runner snapshot v1 */
2+
export const snapshots = {};
3+
4+
snapshots['cds-checkbox-skeleton should render'] = `<cds-checkbox-skeleton>
5+
</cds-checkbox-skeleton>
6+
`;
7+
/* end snapshot cds-checkbox-skeleton should render */

packages/web-components/src/components/checkbox/__tests__/checkbox-group-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('cds-checkbox-group', function () {
1212
const group = html`<cds-checkbox-group
1313
legend-text="Checkbox heading"></cds-checkbox-group>`;
1414
const el = await fixture(group);
15-
expect(el).dom.to.equalSnapshot();
15+
await expect(el).dom.to.equalSnapshot();
1616
});
1717

1818
it('should render helper-text', async () => {

packages/web-components/src/components/checkbox/__tests__/checkbox-skeleton-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ describe('cds-checkbox-skeleton', function () {
1111
it('should render', async () => {
1212
const skeleton = html`<cds-checkbox-skeleton></cds-checkbox-skeleton>`;
1313
const el = await fixture(skeleton);
14-
expect(el).dom.to.equalSnapshot();
14+
await expect(el).dom.to.equalSnapshot();
1515
});
1616
});

packages/web-components/src/components/checkbox/__tests__/checkbox-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('cds-checkbox', function () {
1111
it('should render', async () => {
1212
const checkbox = html`<cds-checkbox>Checkbox Label</cds-checkbox>`;
1313
const el = await fixture(checkbox);
14-
expect(el).dom.to.equalSnapshot();
14+
await expect(el).dom.to.equalSnapshot();
1515
});
1616

1717
it('should set the `id` on the <input> element', async () => {

packages/web-components/src/components/copy-button/__tests__/__snapshots__/copy-button-test.snap.js

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ snapshots['CopyButton should set tabIndex if one is passed via props'] =
99
feedback-timeout="2000"
1010
kind="primary"
1111
size="md"
12+
tab-index="0"
1213
tooltip-alignment=""
1314
tooltip-position="top"
1415
type="button"
@@ -19,13 +20,15 @@ snapshots['CopyButton should set tabIndex if one is passed via props'] =
1920
`;
2021
/* end snapshot CopyButton should set tabIndex if one is passed via props */
2122

22-
snapshots['Button props should call the click handler'] = `<cds-copy
23+
snapshots['CopyButton should add extra classes via passed button-class-name'] =
24+
`<cds-copy
2325
align="bottom"
24-
button-class-name="cds--copy-btn"
26+
button-class-name="cds--copy-btn extra-class"
2527
feedback="Copied!"
2628
feedback-timeout="2000"
2729
kind="primary"
2830
size="md"
31+
tab-index="0"
2932
tooltip-alignment=""
3033
tooltip-position="top"
3134
type="button"
@@ -34,7 +37,7 @@ snapshots['Button props should call the click handler'] = `<cds-copy
3437
</slot>
3538
</cds-copy>
3639
`;
37-
/* end snapshot Button props should call the click handler */
40+
/* end snapshot CopyButton should add extra classes via passed button-class-name */
3841

3942
snapshots['Button props should disable button if disabled prop is passed'] =
4043
`<cds-copy
@@ -45,6 +48,7 @@ snapshots['Button props should disable button if disabled prop is passed'] =
4548
feedback-timeout="2000"
4649
kind="primary"
4750
size="md"
51+
tab-index="0"
4852
tooltip-alignment=""
4953
tooltip-position="top"
5054
type="button"
@@ -55,6 +59,24 @@ snapshots['Button props should disable button if disabled prop is passed'] =
5559
`;
5660
/* end snapshot Button props should disable button if disabled prop is passed */
5761

62+
snapshots['Button props should call the click handler'] = `<cds-copy
63+
align="bottom"
64+
button-class-name="cds--copy-btn"
65+
feedback="Copied!"
66+
feedback-timeout="2000"
67+
kind="primary"
68+
size="md"
69+
tab-index="0"
70+
tooltip-alignment=""
71+
tooltip-position="top"
72+
type="button"
73+
>
74+
<slot slot="tooltip-content">
75+
</slot>
76+
</cds-copy>
77+
`;
78+
/* end snapshot Button props should call the click handler */
79+
5880
snapshots[
5981
'Feedback should make the feedback visible for a limited amount of time'
6082
] = `<cds-copy
@@ -64,6 +86,7 @@ snapshots[
6486
feedback-timeout="500"
6587
kind="primary"
6688
size="md"
89+
tab-index="0"
6790
tooltip-alignment=""
6891
tooltip-position="top"
6992
type="button"
@@ -82,6 +105,7 @@ snapshots['Feedback should be able to specify the feedback message'] =
82105
feedback-timeout="200"
83106
kind="primary"
84107
size="md"
108+
tab-index="0"
85109
tooltip-alignment=""
86110
tooltip-position="top"
87111
type="button"
@@ -101,6 +125,7 @@ snapshots[
101125
feedback-timeout="100"
102126
kind="primary"
103127
size="md"
128+
tab-index="0"
104129
tooltip-alignment=""
105130
tooltip-position="top"
106131
type="button"
@@ -110,21 +135,3 @@ snapshots[
110135
</cds-copy>
111136
`;
112137
/* end snapshot Feedback should allow users to override default feedback timeout via prop */
113-
114-
snapshots['CopyButton should add extra classes via passed button-class-name'] =
115-
`<cds-copy
116-
align="bottom"
117-
button-class-name="cds--copy-btn extra-class"
118-
feedback="Copied!"
119-
feedback-timeout="2000"
120-
kind="primary"
121-
size="md"
122-
tooltip-alignment=""
123-
tooltip-position="top"
124-
type="button"
125-
>
126-
<slot slot="tooltip-content">
127-
</slot>
128-
</cds-copy>
129-
`;
130-
/* end snapshot CopyButton should add extra classes via passed button-class-name */

packages/web-components/src/components/copy-button/__tests__/copy-button-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('CopyButton', () => {
1515
</cds-copy-button>
1616
`);
1717
expect(el.getAttribute('tabindex')).to.equal('2');
18-
expect(el).shadowDom.to.equalSnapshot();
18+
await expect(el).shadowDom.to.equalSnapshot();
1919
});
2020

2121
it('should add extra classes via passed button-class-name', async () => {
@@ -30,7 +30,7 @@ describe('CopyButton', () => {
3030
?.querySelector('cds-copy')
3131
?.shadowRoot?.querySelector('button');
3232
expect(button).to.have.class('extra-class');
33-
expect(el).shadowDom.to.equalSnapshot();
33+
await expect(el).shadowDom.to.equalSnapshot();
3434
});
3535
});
3636

@@ -45,7 +45,7 @@ describe('Button props', () => {
4545
?.querySelector('cds-copy')
4646
?.shadowRoot?.querySelector('button');
4747
expect(button).to.have.attribute('disabled');
48-
expect(el).shadowDom.to.equalSnapshot();
48+
await expect(el).shadowDom.to.equalSnapshot();
4949
});
5050

5151
it('should call the click handler', async () => {
@@ -64,7 +64,7 @@ describe('Button props', () => {
6464
?.shadowRoot?.querySelector('button');
6565
button?.click();
6666
expect(clicked).to.be.true;
67-
expect(el).shadowDom.to.equalSnapshot();
67+
await expect(el).shadowDom.to.equalSnapshot();
6868
});
6969
});
7070

@@ -95,7 +95,7 @@ describe('Feedback', () => {
9595
'Expected feedback to disappear',
9696
{ timeout: 3000 }
9797
);
98-
expect(el).shadowDom.to.equalSnapshot();
98+
await expect(el).shadowDom.to.equalSnapshot();
9999
});
100100

101101
it('should be able to specify the feedback message', async () => {
@@ -141,7 +141,7 @@ describe('Feedback', () => {
141141
?.querySelector('cds-tooltip-content')
142142
?.textContent?.trim()
143143
).to.not.equal(customFeedback);
144-
expect(el).shadowDom.to.equalSnapshot();
144+
await expect(el).shadowDom.to.equalSnapshot();
145145
});
146146

147147
it('should allow users to override default feedback timeout via prop', async () => {
@@ -182,6 +182,6 @@ describe('Feedback', () => {
182182
timeout: customTimeout + 300,
183183
}
184184
);
185-
expect(el).shadowDom.to.equalSnapshot();
185+
await expect(el).shadowDom.to.equalSnapshot();
186186
});
187187
});

packages/web-components/src/components/icon-indicator/docs/overview.mdx

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)