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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
8de14be2
Commit
8de14be2
authored
Aug 01, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed translate3d test
parent
48ec7025
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+1
-1
spec/javascripts/fly_out_nav_spec.js
spec/javascripts/fly_out_nav_spec.js
+5
-5
No files found.
app/assets/javascripts/fly_out_nav.js
View file @
8de14be2
...
@@ -18,7 +18,7 @@ export const showSubLevelItems = (el) => {
...
@@ -18,7 +18,7 @@ export const showSubLevelItems = (el) => {
const
top
=
calculateTop
(
boundingRect
,
$subitems
.
offsetHeight
);
const
top
=
calculateTop
(
boundingRect
,
$subitems
.
offsetHeight
);
const
isAbove
=
top
<
boundingRect
.
top
;
const
isAbove
=
top
<
boundingRect
.
top
;
$subitems
.
style
.
transform
=
`translate3d(0,
${
top
}
px, 0)`
;
$subitems
.
style
.
transform
=
`translate3d(0,
${
Math
.
floor
(
top
)
}
px, 0)`
;
if
(
isAbove
)
{
if
(
isAbove
)
{
$subitems
.
classList
.
add
(
'
is-above
'
);
$subitems
.
classList
.
add
(
'
is-above
'
);
...
...
spec/javascripts/fly_out_nav_spec.js
View file @
8de14be2
...
@@ -8,6 +8,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -8,6 +8,7 @@ describe('Fly out sidebar navigation', () => {
let
el
;
let
el
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
el
=
document
.
createElement
(
'
div
'
);
el
=
document
.
createElement
(
'
div
'
);
el
.
style
.
position
=
'
relative
'
;
document
.
body
.
appendChild
(
el
);
document
.
body
.
appendChild
(
el
);
});
});
...
@@ -89,7 +90,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -89,7 +90,7 @@ describe('Fly out sidebar navigation', () => {
describe
(
'
showSubLevelItems
'
,
()
=>
{
describe
(
'
showSubLevelItems
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
el
.
innerHTML
=
'
<div class="sidebar-sub-level-items"></div>
'
;
el
.
innerHTML
=
'
<div class="sidebar-sub-level-items"
style="position: absolute;"
></div>
'
;
});
});
it
(
'
adds is-over class to el
'
,
()
=>
{
it
(
'
adds is-over class to el
'
,
()
=>
{
...
@@ -111,18 +112,17 @@ describe('Fly out sidebar navigation', () => {
...
@@ -111,18 +112,17 @@ describe('Fly out sidebar navigation', () => {
});
});
it
(
'
sets transform of sub-items
'
,
()
=>
{
it
(
'
sets transform of sub-items
'
,
()
=>
{
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
showSubLevelItems
(
el
);
showSubLevelItems
(
el
);
expect
(
expect
(
el
.
querySelector
(
'
.sidebar-sub-level-items
'
)
.
style
.
transform
,
subItems
.
style
.
transform
,
).
toBe
(
`translate3d(0px,
${
el
.
offsetT
op
}
px, 0px)`
);
).
toBe
(
`translate3d(0px,
${
el
.
getBoundingClientRect
().
t
op
}
px, 0px)`
);
});
});
it
(
'
sets is-above when element is above
'
,
()
=>
{
it
(
'
sets is-above when element is above
'
,
()
=>
{
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
subItems
.
style
.
height
=
`
${
window
.
innerHeight
+
el
.
offsetHeight
}
px`
;
subItems
.
style
.
height
=
`
${
window
.
innerHeight
+
el
.
offsetHeight
}
px`
;
subItems
.
style
.
position
=
'
absolute
'
;
el
.
style
.
position
=
'
relative
'
;
el
.
style
.
top
=
`
${
window
.
innerHeight
-
el
.
offsetHeight
}
px`
;
el
.
style
.
top
=
`
${
window
.
innerHeight
-
el
.
offsetHeight
}
px`
;
spyOn
(
subItems
.
classList
,
'
add
'
);
spyOn
(
subItems
.
classList
,
'
add
'
);
...
...
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