aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/controls
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2018-12-19 15:28:21 +0100
committerSonarTech <sonartech@sonarsource.com>2019-01-18 20:21:02 +0100
commit5c110414621fcfb2db1083f76ff09c4b6364757f (patch)
treee4093ebbf1a8402f4e60c4c1eb8839b2a70a5f4a /server/sonar-web/src/main/js/components/controls
parent0d3ba8c8aa4c29e46e9a687f42590ffda3fb348f (diff)
downloadsonarqube-5c110414621fcfb2db1083f76ff09c4b6364757f.tar.gz
sonarqube-5c110414621fcfb2db1083f76ff09c4b6364757f.zip
SONARCLOUD-329 Create downgrade reason page
Diffstat (limited to 'server/sonar-web/src/main/js/components/controls')
-rw-r--r--server/sonar-web/src/main/js/components/controls/Radio.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx5
2 files changed, 6 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/components/controls/Radio.tsx b/server/sonar-web/src/main/js/components/controls/Radio.tsx
index 5c690bdaba4..e389c71d664 100644
--- a/server/sonar-web/src/main/js/components/controls/Radio.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Radio.tsx
@@ -23,14 +23,15 @@ import * as classNames from 'classnames';
interface Props {
checked: boolean;
className?: string;
- onCheck: () => void;
+ onCheck: (value: string) => void;
+ value: string;
}
export default class Radio extends React.PureComponent<Props> {
handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault();
event.currentTarget.blur();
- this.props.onCheck();
+ this.props.onCheck(this.props.value);
};
render() {
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx
index f3224f519c5..a0f9eabdc8d 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx
@@ -24,11 +24,12 @@ import { click } from '../../../helpers/testUtils';
it('should render and check', () => {
const onCheck = jest.fn();
- const wrapper = shallow(<Radio checked={false} onCheck={onCheck} />);
+ const value = 'value';
+ const wrapper = shallow(<Radio checked={false} onCheck={onCheck} value={value} />);
expect(wrapper).toMatchSnapshot();
click(wrapper);
- expect(onCheck).toBeCalled();
+ expect(onCheck).toBeCalledWith(value);
wrapper.setProps({ checked: true });
expect(wrapper).toMatchSnapshot();
});