Commit 48973120 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'update-image-diff-note-no-floats' into 'master'

Ensure an annotation's position is of type Int

See merge request gitlab-org/gitlab!29556
parents 0d4e1ad3 b1404dd5
......@@ -201,10 +201,10 @@ export default {
const { x, y } = coordinates;
const { width, height } = this.overlayDimensions;
return {
x,
y,
width,
height,
x: Math.round(x),
y: Math.round(y),
width: Math.round(width),
height: Math.round(height),
};
},
openCommentForm(coordinates) {
......
......@@ -443,6 +443,23 @@ describe('Design management design presentation component', () => {
});
});
describe('getAnnotationPositon', () => {
it.each`
coordinates | overlayDimensions | position
${{ x: 100, y: 100 }} | ${{ width: 50, height: 50 }} | ${{ x: 100, y: 100, width: 50, height: 50 }}
${{ x: 100.2, y: 100.5 }} | ${{ width: 50.6, height: 50.0 }} | ${{ x: 100, y: 101, width: 51, height: 50 }}
`('returns correct annotation position', ({ coordinates, overlayDimensions, position }) => {
createComponent(undefined, {
overlayDimensions: {
width: overlayDimensions.width,
height: overlayDimensions.height,
},
});
expect(wrapper.vm.getAnnotationPositon(coordinates)).toStrictEqual(position);
});
});
describe('when design is overflowing', () => {
beforeEach(() => {
createComponent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment