Skip to content

Commit

Permalink
Metrics with status unknown in the details view of the 'Metrics' metr…
Browse files Browse the repository at this point in the history
…ic did not show a question mark. Fixes #935.
  • Loading branch information
fniessink committed Jan 14, 2020
1 parent f5e08fc commit 981bb22
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
16 changes: 8 additions & 8 deletions components/frontend/src/metric/StatusIcon.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { Icon } from 'semantic-ui-react';

export function StatusIcon({ status}) {
const status_icon = {
target_met: 'check', near_target_met: 'warning', debt_target_met: 'money',
target_not_met: 'x', null: 'question'
}[status];
return (
<Icon size='large' name={status_icon} />
)
export function StatusIcon({ status }) {
const status_icon = {
target_met: 'check', near_target_met: 'warning', debt_target_met: 'money',
target_not_met: 'x', null: 'question'
}[status || null];
return (
<Icon size='large' name={status_icon} />
)
}
17 changes: 11 additions & 6 deletions components/frontend/src/metric/StatusIcon.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { mount } from 'enzyme';
import { StatusIcon } from './StatusIcon';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<StatusIcon status="target_met" />, div);
ReactDOM.unmountComponentAtNode(div);
});
describe('<StatusIcon/>' , () => {
it('renders a checkmark if the status is target_met', () => {
const wrapper = mount(<StatusIcon status="target_met" />);
expect(wrapper.find("Icon").prop("name")).toBe("check");
})
it('renders a question mark if the status is missing', () => {
const wrapper = mount(<StatusIcon/>);
expect(wrapper.find("Icon").prop("name")).toBe("question");
})
})
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix Checkmarx landing url. Fixes [#919](https://github.com/ICTU/quality-time/issues/919).
- Remove plaintext passwords from HTML. Fixes [#921](https://github.com/ICTU/quality-time/issues/921).
- Remove private tokens from URLs logged by the collector. Fixes [#934](https://github.com/ICTU/quality-time/issues/934).
- Metrics with status unknown in the details view of the 'Metrics' metric did not show a question mark. Fixes [#935](https://github.com/ICTU/quality-time/issues/935).

## [1.2.0] - [2019-12-10]

Expand Down

0 comments on commit 981bb22

Please sign in to comment.