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
8a6d236d
Commit
8a6d236d
authored
Aug 07, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix eslint
parent
d689f9a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
59 deletions
+1
-59
app/assets/javascripts/repo/services/repo_service.js
app/assets/javascripts/repo/services/repo_service.js
+1
-0
spec/javascripts/helpers/scroll_helper_spec.js
spec/javascripts/helpers/scroll_helper_spec.js
+0
-59
No files found.
app/assets/javascripts/repo/services/repo_service.js
View file @
8a6d236d
/* global Flash */
import
axios
from
'
axios
'
;
import
Store
from
'
../stores/repo_store
'
;
import
Api
from
'
../../api
'
;
...
...
spec/javascripts/helpers/scroll_helper_spec.js
deleted
100644 → 0
View file @
d689f9a8
import
$
from
'
jquery
'
;
import
ScrollHelper
from
'
~/helpers/scroll_helper
'
;
describe
(
'
ScrollHelper
'
,
()
=>
{
const
width
=
10
;
describe
(
'
getScrollWidth
'
,
()
=>
{
const
parent
=
jasmine
.
createSpyObj
(
'
parent
'
,
[
'
css
'
,
'
appendTo
'
,
'
remove
'
]);
const
child
=
jasmine
.
createSpyObj
(
'
child
'
,
[
'
css
'
,
'
appendTo
'
,
'
get
'
]);
let
scrollWidth
;
beforeEach
(()
=>
{
spyOn
(
$
.
fn
,
'
init
'
).
and
.
returnValues
(
parent
,
child
);
spyOn
(
jasmine
.
Fixtures
.
prototype
,
'
cleanUp
'
);
// disable jasmine-jquery cleanup, we dont want it but its imported in test_bundle :(
parent
.
css
.
and
.
returnValue
(
parent
);
child
.
css
.
and
.
returnValue
(
child
);
child
.
get
.
and
.
returnValue
({
offsetWidth
:
width
,
});
scrollWidth
=
ScrollHelper
.
getScrollWidth
();
});
it
(
'
inserts 2 nested hidden scrollable divs, calls parents outerWidth, removes parent and returns the width
'
,
()
=>
{
const
initArgs
=
$
.
fn
.
init
.
calls
.
allArgs
();
expect
(
initArgs
[
0
][
0
]).
toEqual
(
'
<div>
'
);
expect
(
initArgs
[
1
][
0
]).
toEqual
(
'
<div>
'
);
expect
(
parent
.
css
).
toHaveBeenCalledWith
({
visibility
:
'
hidden
'
,
width
:
100
,
overflow
:
'
scroll
'
,
});
expect
(
child
.
css
).
toHaveBeenCalledWith
({
width
:
100
,
});
expect
(
child
.
appendTo
).
toHaveBeenCalledWith
(
parent
);
expect
(
parent
.
appendTo
).
toHaveBeenCalledWith
(
'
body
'
);
expect
(
child
.
get
).
toHaveBeenCalledWith
(
0
);
expect
(
parent
.
remove
).
toHaveBeenCalled
();
expect
(
scrollWidth
).
toEqual
(
100
-
width
);
});
});
describe
(
'
setScrollWidth
'
,
()
=>
{
it
(
'
calls getScrollWidth and sets data-scroll-width
'
,
()
=>
{
spyOn
(
$
.
fn
,
'
find
'
).
and
.
callThrough
();
spyOn
(
$
.
fn
,
'
attr
'
);
spyOn
(
ScrollHelper
,
'
getScrollWidth
'
).
and
.
returnValue
(
width
);
ScrollHelper
.
setScrollWidth
();
expect
(
$
.
fn
.
find
).
toHaveBeenCalledWith
(
'
body
'
);
expect
(
$
.
fn
.
attr
).
toHaveBeenCalledWith
(
'
data-scroll-width
'
,
width
);
expect
(
ScrollHelper
.
getScrollWidth
).
toHaveBeenCalled
();
});
});
});
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