Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/button/__tests__/analytics-metadata.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ function renderButton(props: ButtonProps = {}) {
return createWrapper(renderResult.container).findButton()!;
}

const getMetadata = (label: string, variant: string, disabled?: boolean) => {
const getMetadata = (label: string, variant: string, disabled?: boolean, description?: string) => {
const metadata: GeneratedAnalyticsMetadataFragment = {
contexts: [
{
type: 'component',
detail: {
name: 'awsui.Button',
label,
...(description ? { description } : {}),
properties: {
variant,
disabled: disabled ? 'true' : 'false',
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('Button renders correct analytics metadata', () => {
const wrapper = renderButton({ children: 'inline button text', disabled: true, disabledReason: 'reason' });
validateComponentNameAndLabels(wrapper.getElement(), labels);
expect(getGeneratedAnalyticsMetadata(wrapper.getElement())).toEqual(
getMetadata('inline button text', 'normal', true)
getMetadata('inline button text', 'normal', true, 'reason')
);
});
test('when it has text content and aria label', () => {
Expand Down
1 change: 1 addition & 0 deletions src/flashbar/__tests__/analytics-metadata.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const getMetadata = (itemPosition?: number, stackItems = false, expanded?: boole
detail: {
name: 'awsui.Flashbar',
label: 'Notifications',
...(stackItems && itemsCount > 0 ? { description: 'Notifications bar11110' } : {}),
properties: {
stackItems: `${!!stackItems}`,
itemsCount: `${itemsCount}`,
Expand Down
Loading