diff --git a/gsa/src/web/components/icon/restoreicon.js b/gsa/src/web/components/icon/restoreicon.js index 95a164c11d..ca4431d8fd 100644 --- a/gsa/src/web/components/icon/restoreicon.js +++ b/gsa/src/web/components/icon/restoreicon.js @@ -20,9 +20,7 @@ import withSvgIcon from './withSvgIcon'; import {ReactComponent as Icon} from './svg/restore.svg'; -const RestoreIcon = withSvgIcon({ - active: true, -})(Icon); +const RestoreIcon = withSvgIcon()(Icon); export default RestoreIcon; diff --git a/gsa/src/web/components/icon/svgicon.js b/gsa/src/web/components/icon/svgicon.js index 7e34c4b581..65b54e0000 100644 --- a/gsa/src/web/components/icon/svgicon.js +++ b/gsa/src/web/components/icon/svgicon.js @@ -46,12 +46,20 @@ const Styled = styled.span` } `; -const SvgIcon = ({active = true, children, to, value, onClick, ...other}) => ( +const SvgIcon = ({ + disabled = false, + active = !disabled, + children, + to, + value, + onClick, + ...other +}) => ( { event.preventDefault(); event.stopPropagation(); diff --git a/gsa/src/web/components/icon/testing.js b/gsa/src/web/components/icon/testing.js index 1a74a312e6..0b4fdcf282 100644 --- a/gsa/src/web/components/icon/testing.js +++ b/gsa/src/web/components/icon/testing.js @@ -21,6 +21,7 @@ import React from 'react'; import {render, fireEvent} from 'web/utils/testing'; +import Theme from 'web/utils/theme'; import {ICON_SIZE_SMALL_PIXELS} from './withIconSize'; @@ -42,6 +43,23 @@ export const testIcon = Icon => { expect(handler).toHaveBeenCalledWith('1'); }); + + test('should change appearance when disabled', () => { + const {element} = render(); + + expect(element).toHaveStyleRule('fill', Theme.inputBorderGray, { + modifier: '& svg path', + }); + }); + + test('should not call clickhandler when disabled', () => { + const handler = jest.fn(); + const {element} = render(); + + fireEvent.click(element); + + expect(handler).not.toHaveBeenCalled(); + }); }; // vim: set ts=2 sw=2 tw=80: diff --git a/gsa/src/web/components/pagination/pagination.js b/gsa/src/web/components/pagination/pagination.js index f8fe8e0967..96318d207d 100644 --- a/gsa/src/web/components/pagination/pagination.js +++ b/gsa/src/web/components/pagination/pagination.js @@ -63,12 +63,12 @@ const Pagination = ({ @@ -78,12 +78,12 @@ const Pagination = ({