BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8de14be2
Unverified
Commit
8de14be2
authored
Aug 01, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed translate3d test
parent
48ec7025
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+1
-1
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) => {
const
top
=
calculateTop
(
boundingRect
,
$subitems
.
offsetHeight
);
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
)
{
$subitems
.
classList
.
add
(
'is-above'
);
...
...
spec/javascripts/fly_out_nav_spec.js
View file @
8de14be2
...
...
@@ -8,6 +8,7 @@ describe('Fly out sidebar navigation', () => {
let
el
;
beforeEach
(()
=>
{
el
=
document
.
createElement
(
'div'
);
el
.
style
.
position
=
'relative'
;
document
.
body
.
appendChild
(
el
);
});
...
...
@@ -89,7 +90,7 @@ describe('Fly out sidebar navigation', () => {
describe
(
'showSubLevelItems'
,
()
=>
{
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'
,
()
=>
{
...
...
@@ -111,18 +112,17 @@ describe('Fly out sidebar navigation', () => {
});
it
(
'sets transform of sub-items'
,
()
=>
{
const
subItems
=
el
.
querySelector
(
'.sidebar-sub-level-items'
);
showSubLevelItems
(
el
);
expect
(
el
.
querySelector
(
'.sidebar-sub-level-items'
)
.
style
.
transform
,
).
toBe
(
`translate3d(0px,
${
el
.
offsetT
op
}
px, 0px)`
);
subItems
.
style
.
transform
,
).
toBe
(
`translate3d(0px,
${
el
.
getBoundingClientRect
().
t
op
}
px, 0px)`
);
});
it
(
'sets is-above when element is above'
,
()
=>
{
const
subItems
=
el
.
querySelector
(
'.sidebar-sub-level-items'
);
subItems
.
style
.
height
=
`
${
window
.
innerHeight
+
el
.
offsetHeight
}
px`
;
subItems
.
style
.
position
=
'absolute'
;
el
.
style
.
position
=
'relative'
;
el
.
style
.
top
=
`
${
window
.
innerHeight
-
el
.
offsetHeight
}
px`
;
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