Skip to content
代码片段 群组 项目
提交 48973120 编辑于 作者: 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
无相关合并请求
......@@ -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(
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册