-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metrics with status unknown in the details view of the 'Metrics' metr…
…ic did not show a question mark. Fixes #935.
- Loading branch information
Showing
3 changed files
with
20 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters