Skip to content

Commit

Permalink
Fix test warnings (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabalafou authored Mar 5, 2024
1 parent 6813f75 commit 7ff007e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/features/environments/components/EnvironmentDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ export const EnvironmentDropdown = ({
}
>
<StyledIconButton
onClick={e => 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}
>
<AddIcon />
</StyledIconButton>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/StyledIconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ describe("<CreateEnvironmentPackagesTableRow />", () => {
return render(
mockTheme(
<Provider store={store}>
<CreateEnvironmentPackagesTableRow
requestedPackage={requestedPackage}
/>
<table>
<tbody>
<CreateEnvironmentPackagesTableRow
requestedPackage={requestedPackage}
/>
</tbody>
</table>
</Provider>
)
);
Expand Down
1 change: 1 addition & 0 deletions test/environmentDetails/SpecificationEdit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe("<SpecificationEdit />", () => {
<SpecificationEdit
descriptionUpdated={false}
onUpdateEnvironment={jest.fn()}
onSpecificationIsChanged={jest.fn()}
/>
</Provider>
)
Expand Down
6 changes: 5 additions & 1 deletion test/requestedPackages/RequestedPackagesTableRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ describe("<RequestedPackagesTableRow />", () => {
return render(
mockTheme(
<Provider store={store}>
<RequestedPackagesTableRow requestedPackage={requestedPackage} />
<table>
<tbody>
<RequestedPackagesTableRow requestedPackage={requestedPackage} />
</tbody>
</table>
</Provider>
)
);
Expand Down

0 comments on commit 7ff007e

Please sign in to comment.