From 7ff007ec044a833461cc9380cf3f18a6cb1361e2 Mon Sep 17 00:00:00 2001 From: gabalafou Date: Tue, 5 Mar 2024 16:11:21 -0500 Subject: [PATCH] Fix test warnings (#370) --- .../environments/components/EnvironmentDropdown.tsx | 10 ++++++++-- src/styles/StyledIconButton.tsx | 2 +- .../CreateEnvironmentPackagesTableRow.test.tsx | 10 +++++++--- test/environmentDetails/SpecificationEdit.test.tsx | 1 + .../RequestedPackagesTableRow.test.tsx | 6 +++++- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/features/environments/components/EnvironmentDropdown.tsx b/src/features/environments/components/EnvironmentDropdown.tsx index 5fa5d8a8..bd2f5983 100644 --- a/src/features/environments/components/EnvironmentDropdown.tsx +++ b/src/features/environments/components/EnvironmentDropdown.tsx @@ -100,8 +100,14 @@ export const EnvironmentDropdown = ({ } > onCreateNewEnvironmentTab(e, namespace)} - disabled={!canCreate} + onClick={e => + canCreate && onCreateNewEnvironmentTab(e, namespace) + } + // Do not use the `disabled` attribute. Disable manually with + // JavaScript and the `aria-disabled` attribute, otherwise the + // tooltip won't work. More info: + // https://github.com/conda-incubator/conda-store-ui/pull/370/files#r1486492450 + aria-disabled={!canCreate} > diff --git a/src/styles/StyledIconButton.tsx b/src/styles/StyledIconButton.tsx index 11016a07..e4a39753 100644 --- a/src/styles/StyledIconButton.tsx +++ b/src/styles/StyledIconButton.tsx @@ -18,7 +18,7 @@ export const StyledIconButton = styled(Button)(({ theme }) => ({ outlineWidth: "medium", transition: "none" }, - "&:disabled": { + '&[aria-disabled="true"]': { backgroundColor: theme.palette.secondary[100], border: "none", color: theme.palette.secondary[300] diff --git a/test/environmentCreate/CreateEnvironmentPackagesTableRow.test.tsx b/test/environmentCreate/CreateEnvironmentPackagesTableRow.test.tsx index ca14148d..62cf6a64 100644 --- a/test/environmentCreate/CreateEnvironmentPackagesTableRow.test.tsx +++ b/test/environmentCreate/CreateEnvironmentPackagesTableRow.test.tsx @@ -34,9 +34,13 @@ describe("", () => { return render( mockTheme( - + + + + +
) ); diff --git a/test/environmentDetails/SpecificationEdit.test.tsx b/test/environmentDetails/SpecificationEdit.test.tsx index 0182ea8d..8862b81b 100644 --- a/test/environmentDetails/SpecificationEdit.test.tsx +++ b/test/environmentDetails/SpecificationEdit.test.tsx @@ -70,6 +70,7 @@ describe("", () => { ) diff --git a/test/requestedPackages/RequestedPackagesTableRow.test.tsx b/test/requestedPackages/RequestedPackagesTableRow.test.tsx index f0d8bb82..73c54583 100644 --- a/test/requestedPackages/RequestedPackagesTableRow.test.tsx +++ b/test/requestedPackages/RequestedPackagesTableRow.test.tsx @@ -34,7 +34,11 @@ describe("", () => { return render( mockTheme( - + + + + +
) );