Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
5e04dcd09358
Unverified
Commit
d729aa73
authored
Sep 29, 2017
by
Phil Hughes
Browse files
spec fix
parent
dc02f92f7168
Changes
1
Hide whitespace changes
Inline
Side-by-side
spec/javascripts/lib/utils/common_utils_spec.js
View file @
5e04dcd0
...
...
@@ -92,13 +92,12 @@ describe('common_utils', () => {
<div id="test" style="height: 2000px;"></div>
</div>
`
;
const
elTop
=
document
.
getElementById
(
'
test
'
).
getBoundingClientRect
().
top
;
window
.
history
.
pushState
({},
null
,
'
#test
'
);
commonUtils
.
handleLocationHash
();
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expect
(
window
.
scrollY
).
toBe
(
el
Top
);
expect
(
window
.
scrollY
).
toBe
(
document
.
getElementById
(
'
test
'
).
offset
Top
);
document
.
getElementById
(
'
parent
'
).
remove
();
});
...
...
@@ -110,14 +109,13 @@ describe('common_utils', () => {
<div id="user-content-test" style="height: 2000px;"></div>
</div>
`
;
const
elTop
=
document
.
getElementById
(
'
user-content-test
'
).
getBoundingClientRect
().
top
;
window
.
history
.
pushState
({},
null
,
'
#test
'
);
commonUtils
.
handleLocationHash
();
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
user-content-test
'
);
expect
(
window
.
scrollY
).
toBe
(
el
Top
);
expect
(
window
.
scrollY
).
toBe
(
document
.
getElementById
(
'
user-content-test
'
).
offset
Top
);
document
.
getElementById
(
'
parent
'
).
remove
();
});
...
...
@@ -132,14 +130,12 @@ describe('common_utils', () => {
</div>
`
;
const
elTop
=
document
.
getElementById
(
'
user-content-test
'
).
getBoundingClientRect
().
top
;
window
.
history
.
pushState
({},
null
,
'
#test
'
);
commonUtils
.
handleLocationHash
();
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
user-content-test
'
);
expect
(
window
.
scrollY
).
toBe
(
el
Top
-
50
);
expect
(
window
.
scrollY
).
toBe
(
document
.
getElementById
(
'
user-content-test
'
).
offset
Top
-
50
);
expect
(
window
.
scrollBy
).
toHaveBeenCalledWith
(
0
,
-
50
);
document
.
getElementById
(
'
parent
'
).
remove
();
...
...
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