Skip to content
Open
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
16 changes: 14 additions & 2 deletions src/autosuggest/__tests__/autosuggest-feature-metrics.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.each([

expect(useBaseComponentSpy).toHaveBeenCalledWith('Autosuggest', {
props: expect.anything(),
metadata: { hasTokens: true },
metadata: { hasTokens: true, hasAsyncLoading: false },
});
});

Expand All @@ -34,6 +34,18 @@ test('reports no token mode usage by default', () => {

expect(useBaseComponentSpy).toHaveBeenCalledWith('Autosuggest', {
props: expect.anything(),
metadata: { hasTokens: false },
metadata: { hasTokens: false, hasAsyncLoading: false },
});
});

test.each([
[true, () => {}],
[false, undefined],
])('reports async loading usage as %s in metadata', (expected, onLoadItems) => {
render(<Autosuggest {...defaultProps} onLoadItems={onLoadItems} />);

expect(useBaseComponentSpy).toHaveBeenCalledWith('Autosuggest', {
props: expect.anything(),
metadata: expect.objectContaining({ hasAsyncLoading: expected }),
});
});
1 change: 1 addition & 0 deletions src/autosuggest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Autosuggest = React.forwardRef(
},
metadata: {
hasTokens: props.tokens !== undefined,
hasAsyncLoading: Boolean(props.onLoadItems),
},
});

Expand Down
1 change: 1 addition & 0 deletions src/button-dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const ButtonDropdown = React.forwardRef(
hasCustomIcon: Boolean(iconUrl || iconSvg || iconName),
hasDisabledReason: Boolean(disabledReason),
hasDisabledReasons: hasDisabledReasonItems(items),
hasAsyncLoading: Boolean(onLoadItems),
},
});
const baseProps = getBaseProps(props);
Expand Down
12 changes: 12 additions & 0 deletions src/multiselect/__tests__/multiselect-feature-metrics.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ test('reports no dropdown-customization usage by default', () => {
}),
});
});

test.each([
[true, () => {}],
[false, undefined],
])('reports async loading usage as %s in metadata', (expected, onLoadItems) => {
render(<Multiselect {...defaultProps} onLoadItems={onLoadItems} />);

expect(useBaseComponentSpy).toHaveBeenCalledWith('Multiselect', {
props: expect.anything(),
metadata: expect.objectContaining({ hasAsyncLoading: expected }),
});
});
1 change: 1 addition & 0 deletions src/multiselect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const Multiselect = React.forwardRef(
hasDropdownHeader: Boolean(restProps.renderDropdownHeader),
hasDropdownFooter: Boolean(restProps.renderDropdownFooter),
hasDropdownAriaDescribedby: Boolean(restProps.dropdownAriaDescribedby),
hasAsyncLoading: Boolean(restProps.onLoadItems),
},
});

Expand Down
1 change: 1 addition & 0 deletions src/property-filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const PropertyFilter = React.forwardRef(
hasCustomForms,
hasEnumTokens,
hasCustomFormatters,
hasAsyncLoading: Boolean(rest.onLoadItems),
},
});

Expand Down
12 changes: 12 additions & 0 deletions src/select/__tests__/select-feature-metrics.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ test('reports no dropdown-customization usage by default', () => {
}),
});
});

test.each([
[true, () => {}],
[false, undefined],
])('reports async loading usage as %s in metadata', (expected, onLoadItems) => {
render(<Select {...defaultProps} onLoadItems={onLoadItems} />);

expect(useBaseComponentSpy).toHaveBeenCalledWith('Select', {
props: expect.anything(),
metadata: expect.objectContaining({ hasAsyncLoading: expected }),
});
});
1 change: 1 addition & 0 deletions src/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Select = React.forwardRef(
hasDropdownHeader: Boolean(restProps.renderDropdownHeader),
hasDropdownFooter: Boolean(restProps.renderDropdownFooter),
hasDropdownAriaDescribedby: Boolean(restProps.dropdownAriaDescribedby),
hasAsyncLoading: Boolean(restProps.onLoadItems),
},
});
const externalProps = getExternalProps(restProps);
Expand Down
Loading