Skip to content

Commit 57fc9f7

Browse files
committed
fixup: use label for selecting button, better ns check
1 parent b8a96f1 commit 57fc9f7

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/compass-data-modeling/src/components/drawer/collection-drawer-content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export function getIsCollectionNameValid(
9393

9494
const isDuplicate = namespacesWithoutCurrent.some(
9595
(ns) =>
96-
ns === `${toNS(namespace).database}.${collectionName}` ||
97-
ns === `${toNS(namespace).database}.${collectionName.trim()}`
96+
ns.trim() ===
97+
`${toNS(namespace).database}.${collectionName.trim()}`.trim()
9898
);
9999

100100
return {

packages/compass-data-modeling/src/components/drawer/diagram-editor-side-panel.spec.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,7 @@ describe('DiagramEditorSidePanel', function () {
280280
expect(screen.getByLabelText('Name')).to.have.value('countries');
281281
});
282282

283-
userEvent.click(
284-
screen.getByTestId('data-modeling-drawer-actions-delete-action')
285-
);
283+
userEvent.click(screen.getByLabelText(/delete collection/i));
286284

287285
await waitFor(() => {
288286
expect(screen.queryByText('countries')).not.to.exist;

packages/compass-data-modeling/src/components/drawer/diagram-editor-side-panel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ function DiagramEditorSidePanel({
5757
></CollectionDrawerContent>
5858
),
5959
actions: [
60-
{ action: 'delete', label: 'Delete', icon: 'Trash' as const },
60+
{
61+
action: 'delete',
62+
label: 'Delete Collection',
63+
icon: 'Trash' as const,
64+
},
6165
],
6266
handleAction: (actionName: string) => {
6367
if (actionName === 'delete') {

0 commit comments

Comments
 (0)