Skip to content

Commit

Permalink
fix: removed test stories (#17973)
Browse files Browse the repository at this point in the history
Co-authored-by: Taylor Jones <[email protected]>
Co-authored-by: Nikhil Tomar <[email protected]>
  • Loading branch information
3 people authored Nov 6, 2024
1 parent d459e8c commit a6defa9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 177 deletions.
36 changes: 0 additions & 36 deletions packages/react/src/components/ComboBox/ComboBox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,42 +65,6 @@ export default {
},
};

export const DownshiftActionsTest = () => {
const downshiftActions = useRef();

return (
<div style={{ width: 300 }}>
<ComboBox
onChange={() => {}}
id="carbon-combobox"
items={items}
itemToString={(item) => (item ? item.text : '')}
titleText="ComboBox title"
helperText="Combobox helper text"
downshiftActions={downshiftActions}
downshiftProps={{
onStateChange: (changes) => {
console.log('onStateChange changes', changes);

if (changes.selectedItem === null) {
downshiftActions?.current?.openMenu?.();
return;
}
if (changes?.isOpen && changes?.inputValue === 'Option 1') {
downshiftActions?.current?.setInputValue?.('');
return;
}
if (!changes?.isOpen && changes?.inputValue !== 'Option 1') {
downshiftActions?.current?.setInputValue?.('Option 1');
return;
}
},
}}
/>
</div>
);
};

export const Default = () => (
<div style={{ width: 300 }}>
<ComboBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,144 +297,3 @@ Playground.argTypes = {
},
},
};

export const Test = () => {
const rows = [
{ id: '1', name: 'John', lastName: 'Doe' },
{ id: '2', name: 'Jane', lastName: 'Doe' },
];
const headers = [
{ key: 'name', header: 'Name' },
{ key: 'lastName', header: 'Last Name' },
];
return (
<div>
<DataTable rows={rows} headers={headers}>
{({
rows,
headers,
getHeaderProps,
getRowProps,
getSelectionProps,
getToolbarProps,
getBatchActionProps,
onInputChange,
selectedRows,
getTableProps,
getTableContainerProps,
selectRow,
}) => {
const batchActionProps = {
...getBatchActionProps({
onSelectAll: () => {
rows.map((row) => {
if (!row.isSelected) {
selectRow(row.id);
}
});
},
}),
};
return (
<TableContainer
title="DataTable"
description="With batch actions. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas accumsan mauris sed congue egestas. Integer varius mauris vel arcu pulvinar bibendum non sit amet ligula. Nullam ut nisi eu tellus aliquet vestibulum vel sit amet odio."
{...getTableContainerProps()}>
<TableToolbar {...getToolbarProps()}>
<TableBatchActions {...batchActionProps}>
<TableBatchAction
tabIndex={batchActionProps.shouldShowBatchActions ? 0 : -1}
renderIcon={TrashCan}>
Delete
</TableBatchAction>
<TableBatchAction
hasIconOnly
iconDescription="Add"
tooltipPosition="bottom"
tabIndex={batchActionProps.shouldShowBatchActions ? 0 : -1}
renderIcon={Add}>
Delete
</TableBatchAction>
<TableBatchAction
hasIconOnly
iconDescription="Save"
tooltipPosition="bottom"
tabIndex={batchActionProps.shouldShowBatchActions ? 0 : -1}
renderIcon={Save}>
Save
</TableBatchAction>
<TableBatchAction
tabIndex={batchActionProps.shouldShowBatchActions ? 0 : -1}
renderIcon={Download}>
Download
</TableBatchAction>
</TableBatchActions>
<TableToolbarContent
// style={{
// clipPath: batchActionProps.shouldShowBatchActions
// ? 'polygon(0 0, 100% 0, 100% 0, 0 0)'
// : 'none',
// }}
aria-hidden={batchActionProps.shouldShowBatchActions}>
<TableToolbarSearch
tabIndex={batchActionProps.shouldShowBatchActions ? -1 : 0}
onChange={onInputChange}
/>
<TableToolbarMenu
tabIndex={batchActionProps.shouldShowBatchActions ? -1 : 0}>
<TableToolbarAction>Action 1</TableToolbarAction>
<TableToolbarAction>Action 2</TableToolbarAction>
<TableToolbarAction>Action 3</TableToolbarAction>
</TableToolbarMenu>
<TableToolbarFilter
onApplyFilter={() => {}}
onResetFilter={() => {}}
/>
<Button
tabIndex={batchActionProps.shouldShowBatchActions ? -1 : 0}
kind="primary">
Add new
</Button>
</TableToolbarContent>
</TableToolbar>
<Table {...getTableProps()} aria-label="sample table">
<TableHead>
<TableRow>
<TableSelectAll {...getSelectionProps()} />
{headers.map((header, i) => (
<TableHeader
key={i}
{...getHeaderProps({
header,
})}>
{header.header}
</TableHeader>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row, i) => (
<TableRow
key={i}
{...getRowProps({
row,
})}>
<TableSelectRow
{...getSelectionProps({
row,
})}
/>
{row.cells.map((cell) => (
<TableCell key={cell.id}>{cell.value}</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}}
</DataTable>
</div>
);
};

0 comments on commit a6defa9

Please sign in to comment.