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
Tatuya Kamada
gitlab-ce
Commits
32366d18
Commit
32366d18
authored
Jun 15, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename BlobView to LineHighlighter
parent
1f88d9b5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+1
-1
app/assets/javascripts/line_highlighter.js.coffee
app/assets/javascripts/line_highlighter.js.coffee
+3
-3
spec/javascripts/fixtures/line_highlighter.html.haml
spec/javascripts/fixtures/line_highlighter.html.haml
+0
-0
spec/javascripts/line_highlighter_spec.js.coffee
spec/javascripts/line_highlighter_spec.js.coffee
+9
-9
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
32366d18
...
...
@@ -87,7 +87,7 @@ class Dispatcher
new
TreeView
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:blob:show'
new
BlobView
()
new
LineHighlighter
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:labels:new'
,
'projects:labels:edit'
new
Labels
()
...
...
app/assets/javascripts/
blob/blob
.js.coffee
→
app/assets/javascripts/
line_highlighter
.js.coffee
View file @
32366d18
#
BlobView
#
LineHighlighter
#
# Handles single- and multi-line selection and highlight for blob views.
#
...
...
@@ -26,11 +26,11 @@
# </pre>
# </div>
# </div>
class
@
BlobView
class
@
LineHighlighter
# Internal copy of location.hash so we're not dependent on `location` in tests
@
_hash
=
''
# Initialize a
BlobView
object
# Initialize a
LineHighlighter
object
#
# hash - String URL hash for dependency injection in tests
constructor
:
(
hash
=
location
.
hash
)
->
...
...
spec/javascripts/fixtures/
blob
.html.haml
→
spec/javascripts/fixtures/
line_highlighter
.html.haml
View file @
32366d18
File moved
spec/javascripts/
blob/blob
_spec.js.coffee
→
spec/javascripts/
line_highlighter
_spec.js.coffee
View file @
32366d18
#= require
blob/blob
#= require
line_highlighter
describe
'
BlobView
'
,
->
fixture
.
preload
(
'
blob
.html'
)
describe
'
LineHighlighter
'
,
->
fixture
.
preload
(
'
line_highlighter
.html'
)
clickLine
=
(
number
,
eventData
=
{})
->
if
$
.
isEmptyObject
(
eventData
)
...
...
@@ -11,25 +11,25 @@ describe 'BlobView', ->
$
(
"#L
#{
number
}
"
).
trigger
(
e
).
click
()
beforeEach
->
fixture
.
load
(
'
blob
.html'
)
@
class
=
new
BlobView
()
fixture
.
load
(
'
line_highlighter
.html'
)
@
class
=
new
LineHighlighter
()
@
spies
=
{
__setLocationHash__
:
spyOn
(
@
class
,
'__setLocationHash__'
).
and
.
callFake
->
}
describe
'behavior'
,
->
it
'highlights one line given in the URL hash'
,
->
new
BlobView
(
'#L13'
)
new
LineHighlighter
(
'#L13'
)
expect
(
$
(
'#LC13'
)).
toHaveClass
(
'hll'
)
it
'highlights a range of lines given in the URL hash'
,
->
new
BlobView
(
'#L5-25'
)
new
LineHighlighter
(
'#L5-25'
)
expect
(
$
(
'.hll'
).
length
).
toBe
(
21
)
expect
(
$
(
"#LC
#{
line
}
"
)).
toHaveClass
(
'hll'
)
for
line
in
[
5
..
25
]
it
'scrolls to the first highlighted line on initial load'
,
->
spy
=
spyOn
(
$
,
'scrollTo'
)
new
BlobView
(
'#L5-25'
)
new
LineHighlighter
(
'#L5-25'
)
expect
(
spy
).
toHaveBeenCalledWith
(
'#L5'
,
jasmine
.
anything
())
it
'discards click events'
,
->
...
...
@@ -38,7 +38,7 @@ describe 'BlobView', ->
expect
(
spy
).
toHaveBeenPrevented
()
it
'handles garbage input from the hash'
,
->
func
=
->
new
BlobView
(
'#tree-content-holder'
)
func
=
->
new
LineHighlighter
(
'#tree-content-holder'
)
expect
(
func
).
not
.
toThrow
()
describe
'#clickHandler'
,
->
...
...
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