Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e21e1ae0
Commit
e21e1ae0
authored
Apr 14, 2020
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant 'presentationContainer' ref
presentationContainer was found to be redundant and unnecssary
parent
c590762c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
25 deletions
+18
-25
ee/app/assets/javascripts/design_management/components/design_presentation.vue
...ipts/design_management/components/design_presentation.vue
+9
-12
ee/spec/frontend/design_management/components/design_presentation_spec.js
.../design_management/components/design_presentation_spec.js
+9
-13
No files found.
ee/app/assets/javascripts/design_management/components/design_presentation.vue
View file @
e21e1ae0
...
...
@@ -102,8 +102,8 @@ export default {
this
.
overlayPosition
=
{};
}
const
{
presentation
Container
}
=
this
.
$refs
;
if
(
!
presentation
Container
)
return
;
const
{
presentation
Viewport
}
=
this
.
$refs
;
if
(
!
presentation
Viewport
)
return
;
// default to center
this
.
overlayPosition
=
{
...
...
@@ -112,10 +112,10 @@ export default {
};
// if the overlay overflows, then don't center
if
(
this
.
overlayDimensions
.
width
>
presentation
Container
.
offsetWidth
)
{
if
(
this
.
overlayDimensions
.
width
>
presentation
Viewport
.
offsetWidth
)
{
this
.
overlayPosition
.
left
=
'
0
'
;
}
if
(
this
.
overlayDimensions
.
height
>
presentation
Container
.
offsetHeight
)
{
if
(
this
.
overlayDimensions
.
height
>
presentation
Viewport
.
offsetHeight
)
{
this
.
overlayPosition
.
top
=
'
0
'
;
}
},
...
...
@@ -243,12 +243,12 @@ export default {
this
.
isDraggingDesign
=
false
;
},
isDesignOverflowing
()
{
const
{
presentation
Container
}
=
this
.
$refs
;
if
(
!
presentation
Container
)
return
false
;
const
{
presentation
Viewport
}
=
this
.
$refs
;
if
(
!
presentation
Viewport
)
return
false
;
return
(
presentation
Container
.
scrollWidth
>
presentationContainer
.
offsetWidth
||
presentation
Container
.
scrollHeight
>
presentationContainer
.
offsetHeight
presentation
Viewport
.
scrollWidth
>
presentationViewport
.
offsetWidth
||
presentation
Viewport
.
scrollHeight
>
presentationViewport
.
offsetHeight
);
},
},
...
...
@@ -269,10 +269,7 @@ export default {
@
touchend=
"onPresentationMouseup"
@
touchcancel=
"onPresentationMouseup"
>
<div
ref=
"presentationContainer"
class=
"h-100 w-100 d-flex align-items-center position-relative"
>
<div
class=
"h-100 w-100 d-flex align-items-center position-relative"
>
<design-image
v-if=
"image"
:image=
"image"
...
...
ee/spec/frontend/design_management/components/design_presentation_spec.js
View file @
e21e1ae0
...
...
@@ -216,10 +216,8 @@ describe('Design management design presentation component', () => {
});
it
(
'
sets overlay position correctly when overlay is smaller than viewport
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationContainer
,
'
offsetWidth
'
,
'
get
'
).
mockReturnValue
(
200
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationContainer
,
'
offsetHeight
'
,
'
get
'
)
.
mockReturnValue
(
200
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationViewport
,
'
offsetWidth
'
,
'
get
'
).
mockReturnValue
(
200
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationViewport
,
'
offsetHeight
'
,
'
get
'
).
mockReturnValue
(
200
);
wrapper
.
vm
.
setOverlayPosition
();
expect
(
wrapper
.
vm
.
overlayPosition
).
toEqual
({
...
...
@@ -229,10 +227,8 @@ describe('Design management design presentation component', () => {
});
it
(
'
sets overlay position correctly when overlay width is larger than viewports
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationContainer
,
'
offsetWidth
'
,
'
get
'
).
mockReturnValue
(
50
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationContainer
,
'
offsetHeight
'
,
'
get
'
)
.
mockReturnValue
(
200
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationViewport
,
'
offsetWidth
'
,
'
get
'
).
mockReturnValue
(
50
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentationViewport
,
'
offsetHeight
'
,
'
get
'
).
mockReturnValue
(
200
);
wrapper
.
vm
.
setOverlayPosition
();
expect
(
wrapper
.
vm
.
overlayPosition
).
toEqual
({
...
...
@@ -242,8 +238,8 @@ describe('Design management design presentation component', () => {
});
it
(
'
sets overlay position correctly when overlay height is larger than viewports
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentation
Container
,
'
offsetWidth
'
,
'
get
'
).
mockReturnValue
(
200
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentation
Container
,
'
offsetHeight
'
,
'
get
'
).
mockReturnValue
(
50
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentation
Viewport
,
'
offsetWidth
'
,
'
get
'
).
mockReturnValue
(
200
);
jest
.
spyOn
(
wrapper
.
vm
.
$refs
.
presentation
Viewport
,
'
offsetHeight
'
,
'
get
'
).
mockReturnValue
(
50
);
wrapper
.
vm
.
setOverlayPosition
();
expect
(
wrapper
.
vm
.
overlayPosition
).
toEqual
({
...
...
@@ -405,7 +401,7 @@ describe('Design management design presentation component', () => {
`
(
'
sets lastDragPosition when design $scenario
'
,
({
width
,
height
})
=>
{
createComponent
();
mockRefDimensions
(
wrapper
.
vm
.
$refs
.
presentation
Container
,
wrapper
.
vm
.
$refs
.
presentation
Viewport
,
{
width
:
100
,
height
:
100
},
{
width
,
height
},
);
...
...
@@ -424,7 +420,7 @@ describe('Design management design presentation component', () => {
createComponent
({},
{
lastDragPosition
});
mockRefDimensions
(
wrapper
.
vm
.
$refs
.
presentation
Container
,
wrapper
.
vm
.
$refs
.
presentation
Viewport
,
{
width
:
100
,
height
:
100
},
{
width
:
50
,
height
:
50
},
);
...
...
@@ -451,7 +447,7 @@ describe('Design management design presentation component', () => {
// mock a design that overflows
mockRefDimensions
(
wrapper
.
vm
.
$refs
.
presentation
Container
,
wrapper
.
vm
.
$refs
.
presentation
Viewport
,
{
width
:
10
,
height
:
10
},
{
width
:
20
,
height
:
20
},
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment