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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1bdf47ab
Commit
1bdf47ab
authored
Sep 25, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix line_highlighter_spec.
parent
36a917e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
spec/javascripts/line_highlighter_spec.js
spec/javascripts/line_highlighter_spec.js
+12
-6
No files found.
spec/javascripts/line_highlighter_spec.js
View file @
1bdf47ab
...
...
@@ -18,19 +18,25 @@ import '~/line_highlighter';
beforeEach
(
function
()
{
loadFixtures
(
'
static/line_highlighter.html.raw
'
);
this
[
"
class
"
]
=
new
LineHighlighter
();
this
.
css
=
this
[
"
class
"
].
highlightClass
;
this
.
css
=
this
[
"
class
"
].
highlight
Line
Class
;
return
this
.
spies
=
{
__setLocationHash__
:
spyOn
(
this
[
"
class
"
],
'
__setLocationHash__
'
).
and
.
callFake
(
function
()
{})
};
});
describe
(
'
behavior
'
,
function
()
{
it
(
'
highlights one line given in the URL hash
'
,
function
()
{
new
LineHighlighter
(
'
#L13
'
);
new
LineHighlighter
(
{
hash
:
'
#L13
'
}
);
return
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
this
.
css
);
});
it
(
'
highlights one line given in the URL hash with given CSS class name
'
,
function
()
{
const
hiliter
=
new
LineHighlighter
({
hash
:
'
#L13
'
,
highlightLineClass
:
'
hilite
'
});
expect
(
hiliter
.
highlightLineClass
).
toBe
(
'
hilite
'
);
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
'
hilite
'
);
expect
(
$
(
'
#LC13
'
)).
not
.
toHaveClass
(
'
hll
'
);
});
it
(
'
highlights a range of lines given in the URL hash
'
,
function
()
{
var
line
,
results
;
new
LineHighlighter
(
'
#L5-25
'
);
new
LineHighlighter
(
{
hash
:
'
#L5-25
'
}
);
expect
(
$
(
"
.
"
+
this
.
css
).
length
).
toBe
(
21
);
results
=
[];
for
(
line
=
5
;
line
<=
25
;
line
+=
1
)
{
...
...
@@ -41,7 +47,7 @@ import '~/line_highlighter';
it
(
'
scrolls to the first highlighted line on initial load
'
,
function
()
{
var
spy
;
spy
=
spyOn
(
$
,
'
scrollTo
'
);
new
LineHighlighter
(
'
#L5-25
'
);
new
LineHighlighter
(
{
hash
:
'
#L5-25
'
}
);
return
expect
(
spy
).
toHaveBeenCalledWith
(
'
#L5
'
,
jasmine
.
anything
());
});
it
(
'
discards click events
'
,
function
()
{
...
...
@@ -50,10 +56,10 @@ import '~/line_highlighter';
clickLine
(
13
);
return
expect
(
spy
).
toHaveBeenPrevented
();
});
return
it
(
'
handles garbage input from the hash
'
,
function
()
{
it
(
'
handles garbage input from the hash
'
,
function
()
{
var
func
;
func
=
function
()
{
return
new
LineHighlighter
(
'
#blob-content-holder
'
);
return
new
LineHighlighter
(
{
fileHolderSelector
:
'
#blob-content-holder
'
}
);
};
return
expect
(
func
).
not
.
toThrow
();
});
...
...
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