Skip to content

Commit ccfdffe

Browse files
committed
fix: allow precise probe coordinates
1 parent 28d6473 commit ccfdffe

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/components/ProbeEditor/ProbeEditor.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ describe('validation', () => {
5656
const errorMessage = await screen.findByText('Longitude must be less than 180');
5757
expect(errorMessage).toBeInTheDocument();
5858
});
59+
60+
it('accepts coordinates with Google Maps precision', async () => {
61+
const { user } = await renderProbeEditor();
62+
const latitudeInput = await screen.findByLabelText('Latitude', { exact: false });
63+
const longitudeInput = await screen.findByLabelText('Longitude', { exact: false });
64+
65+
await user.type(latitudeInput, '34.697135');
66+
await user.type(longitudeInput, '-84.383184');
67+
68+
expect(latitudeInput).toHaveAttribute('step', 'any');
69+
expect(longitudeInput).toHaveAttribute('step', 'any');
70+
expect(latitudeInput).toBeValid();
71+
expect(longitudeInput).toBeValid();
72+
});
5973
});
6074

6175
it('renders the back button', async () => {

src/components/ProbeEditor/ProbeEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const ProbeEditor = ({
112112
})}
113113
aria-label="Latitude"
114114
placeholder="0.0"
115-
step={0.00001}
115+
step="any"
116116
type="number"
117117
/>
118118
</Field>
@@ -129,7 +129,7 @@ export const ProbeEditor = ({
129129
valueAsNumber: true,
130130
})}
131131
aria-label="Longitude"
132-
step={0.00001}
132+
step="any"
133133
type="number"
134134
placeholder="0.0"
135135
/>

0 commit comments

Comments
 (0)