Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto committed Feb 17, 2017
1 parent 100a595 commit c1e4ca7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
61 changes: 32 additions & 29 deletions web/client/components/data/identify/GeocodeViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,38 @@ const PropTypes = React.PropTypes;
const {Modal, Button} = require('react-bootstrap');

const GeocodeViewer = (props) => {
/* lngCorrected is the converted longitude in order to have the value between
the range (-180 / +180).
*/
let lngCorrected = Math.round(props.latlng.lng * 100000) / 100000;
/* the following formula apply the converion */
lngCorrected = lngCorrected - (360) * Math.floor(lngCorrected / (360) + 0.5);
return (
<div>
<span>Lat: {Math.round(props.latlng.lat * 100000) / 100000 } - Long: { lngCorrected }</span>
<Button
style={{"float": "right"}}
bsStyle="primary"
bsSize="small"
onClick={() => props.showRevGeocode({lat: props.latlng.lat, lng: lngCorrected})} >
{props.identifyRevGeocodeSubmitText}
</Button>
<Modal {...props.modalOptions} show={props.showModalReverse} bsSize="large" container={document.getElementById("body")}>
<Modal.Header>
<Modal.Title>{props.identifyRevGeocodeModalTitle}</Modal.Title>
</Modal.Header>
<Modal.Body >
<p>{props.revGeocodeDisplayName}</p>
</Modal.Body>
<Modal.Footer>
<Button bsSize="small" style={{"float": "right"}} bsStyle="primary" onClick={props.hideRevGeocode}>{props.identifyRevGeocodeCloseText}</Button>
</Modal.Footer>
</Modal>
</div>
);
if (props.latlng) {
/* lngCorrected is the converted longitude in order to have the value between
the range (-180 / +180).
*/
let lngCorrected = Math.round(props.latlng.lng * 100000) / 100000;
/* the following formula apply the converion */
lngCorrected = lngCorrected - (360) * Math.floor(lngCorrected / (360) + 0.5);
return (
<div>
<span>Lat: {Math.round(props.latlng.lat * 100000) / 100000 } - Long: { lngCorrected }</span>
<Button
style={{"float": "right"}}
bsStyle="primary"
bsSize="small"
onClick={() => props.showRevGeocode({lat: props.latlng.lat, lng: lngCorrected})} >
{props.identifyRevGeocodeSubmitText}
</Button>
<Modal {...props.modalOptions} show={props.showModalReverse} bsSize="large" container={document.getElementById("body")}>
<Modal.Header>
<Modal.Title>{props.identifyRevGeocodeModalTitle}</Modal.Title>
</Modal.Header>
<Modal.Body >
<p>{props.revGeocodeDisplayName}</p>
</Modal.Body>
<Modal.Footer>
<Button bsSize="small" style={{"float": "right"}} bsStyle="primary" onClick={props.hideRevGeocode}>{props.identifyRevGeocodeCloseText}</Button>
</Modal.Footer>
</Modal>
</div>
);
}
return <span/>;
};

GeocodeViewer.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Identify', () => {

expect(identify).toExist();
const dom = ReactDOM.findDOMNode(identify);
expect(dom.parentNode.getElementsByClassName('panel').length).toBe(1);
expect(dom.parentNode.getElementsByClassName('info-panel').length).toBe(1);
});

it('creates the Identify component with missing responses', () => {
Expand Down
3 changes: 2 additions & 1 deletion web/client/components/help/__tests__/HelpTextPanel-test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Test for HelpTextPanel', () => {

// test DEFAULTS
it('creates the component with defaults', () => {
const helpPanel = ReactDOM.render(<HelpTextPanel/>, document.getElementById("container"));
const helpPanel = ReactDOM.render(<HelpTextPanel asPanel/>, document.getElementById("container"));
expect(helpPanel).toExist();

const helpPanelDom = ReactDOM.findDOMNode(helpPanel);
Expand All @@ -45,6 +45,7 @@ describe('Test for HelpTextPanel', () => {

it('creates the component with custom props', () => {
const helpPanel = ReactDOM.render(<HelpTextPanel
asPanel
id="fooid"
isVisible={true}
title="footitle"
Expand Down

0 comments on commit c1e4ca7

Please sign in to comment.