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
d729aa73
Commit
d729aa73
authored
Sep 29, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec fix
parent
2c9ca4f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
spec/javascripts/lib/utils/common_utils_spec.js
spec/javascripts/lib/utils/common_utils_spec.js
+3
-7
No files found.
spec/javascripts/lib/utils/common_utils_spec.js
View file @
d729aa73
...
@@ -92,13 +92,12 @@ describe('common_utils', () => {
...
@@ -92,13 +92,12 @@ describe('common_utils', () => {
<div id="test" style="height: 2000px;"></div>
<div id="test" style="height: 2000px;"></div>
</div>
</div>
`
;
`
;
const
elTop
=
document
.
getElementById
(
'
test
'
).
getBoundingClientRect
().
top
;
window
.
history
.
pushState
({},
null
,
'
#test
'
);
window
.
history
.
pushState
({},
null
,
'
#test
'
);
commonUtils
.
handleLocationHash
();
commonUtils
.
handleLocationHash
();
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expect
(
window
.
scrollY
).
toBe
(
el
Top
);
expect
(
window
.
scrollY
).
toBe
(
document
.
getElementById
(
'
test
'
).
offset
Top
);
document
.
getElementById
(
'
parent
'
).
remove
();
document
.
getElementById
(
'
parent
'
).
remove
();
});
});
...
@@ -110,14 +109,13 @@ describe('common_utils', () => {
...
@@ -110,14 +109,13 @@ describe('common_utils', () => {
<div id="user-content-test" style="height: 2000px;"></div>
<div id="user-content-test" style="height: 2000px;"></div>
</div>
</div>
`
;
`
;
const
elTop
=
document
.
getElementById
(
'
user-content-test
'
).
getBoundingClientRect
().
top
;
window
.
history
.
pushState
({},
null
,
'
#test
'
);
window
.
history
.
pushState
({},
null
,
'
#test
'
);
commonUtils
.
handleLocationHash
();
commonUtils
.
handleLocationHash
();
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
user-content-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
();
document
.
getElementById
(
'
parent
'
).
remove
();
});
});
...
@@ -132,14 +130,12 @@ describe('common_utils', () => {
...
@@ -132,14 +130,12 @@ describe('common_utils', () => {
</div>
</div>
`
;
`
;
const
elTop
=
document
.
getElementById
(
'
user-content-test
'
).
getBoundingClientRect
().
top
;
window
.
history
.
pushState
({},
null
,
'
#test
'
);
window
.
history
.
pushState
({},
null
,
'
#test
'
);
commonUtils
.
handleLocationHash
();
commonUtils
.
handleLocationHash
();
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
test
'
);
expectGetElementIdToHaveBeenCalledWith
(
'
user-content-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
);
expect
(
window
.
scrollBy
).
toHaveBeenCalledWith
(
0
,
-
50
);
document
.
getElementById
(
'
parent
'
).
remove
();
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