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
...
@@ -87,7 +87,7 @@ class Dispatcher
new
TreeView
()
new
TreeView
()
shortcut_handler
=
new
ShortcutsNavigation
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:blob:show'
when
'projects:blob:show'
new
BlobView
()
new
LineHighlighter
()
shortcut_handler
=
new
ShortcutsNavigation
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:labels:new'
,
'projects:labels:edit'
when
'projects:labels:new'
,
'projects:labels:edit'
new
Labels
()
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.
# Handles single- and multi-line selection and highlight for blob views.
#
#
...
@@ -26,11 +26,11 @@
...
@@ -26,11 +26,11 @@
# </pre>
# </pre>
# </div>
# </div>
# </div>
# </div>
class
@
BlobView
class
@
LineHighlighter
# Internal copy of location.hash so we're not dependent on `location` in tests
# Internal copy of location.hash so we're not dependent on `location` in tests
@
_hash
=
''
@
_hash
=
''
# Initialize a
BlobView
object
# Initialize a
LineHighlighter
object
#
#
# hash - String URL hash for dependency injection in tests
# hash - String URL hash for dependency injection in tests
constructor
:
(
hash
=
location
.
hash
)
->
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
'
,
->
describe
'
LineHighlighter
'
,
->
fixture
.
preload
(
'
blob
.html'
)
fixture
.
preload
(
'
line_highlighter
.html'
)
clickLine
=
(
number
,
eventData
=
{})
->
clickLine
=
(
number
,
eventData
=
{})
->
if
$
.
isEmptyObject
(
eventData
)
if
$
.
isEmptyObject
(
eventData
)
...
@@ -11,25 +11,25 @@ describe 'BlobView', ->
...
@@ -11,25 +11,25 @@ describe 'BlobView', ->
$
(
"#L
#{
number
}
"
).
trigger
(
e
).
click
()
$
(
"#L
#{
number
}
"
).
trigger
(
e
).
click
()
beforeEach
->
beforeEach
->
fixture
.
load
(
'
blob
.html'
)
fixture
.
load
(
'
line_highlighter
.html'
)
@
class
=
new
BlobView
()
@
class
=
new
LineHighlighter
()
@
spies
=
{
@
spies
=
{
__setLocationHash__
:
spyOn
(
@
class
,
'__setLocationHash__'
).
and
.
callFake
->
__setLocationHash__
:
spyOn
(
@
class
,
'__setLocationHash__'
).
and
.
callFake
->
}
}
describe
'behavior'
,
->
describe
'behavior'
,
->
it
'highlights one line given in the URL hash'
,
->
it
'highlights one line given in the URL hash'
,
->
new
BlobView
(
'#L13'
)
new
LineHighlighter
(
'#L13'
)
expect
(
$
(
'#LC13'
)).
toHaveClass
(
'hll'
)
expect
(
$
(
'#LC13'
)).
toHaveClass
(
'hll'
)
it
'highlights a range of lines given in the URL hash'
,
->
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
(
$
(
'.hll'
).
length
).
toBe
(
21
)
expect
(
$
(
"#LC
#{
line
}
"
)).
toHaveClass
(
'hll'
)
for
line
in
[
5
..
25
]
expect
(
$
(
"#LC
#{
line
}
"
)).
toHaveClass
(
'hll'
)
for
line
in
[
5
..
25
]
it
'scrolls to the first highlighted line on initial load'
,
->
it
'scrolls to the first highlighted line on initial load'
,
->
spy
=
spyOn
(
$
,
'scrollTo'
)
spy
=
spyOn
(
$
,
'scrollTo'
)
new
BlobView
(
'#L5-25'
)
new
LineHighlighter
(
'#L5-25'
)
expect
(
spy
).
toHaveBeenCalledWith
(
'#L5'
,
jasmine
.
anything
())
expect
(
spy
).
toHaveBeenCalledWith
(
'#L5'
,
jasmine
.
anything
())
it
'discards click events'
,
->
it
'discards click events'
,
->
...
@@ -38,7 +38,7 @@ describe 'BlobView', ->
...
@@ -38,7 +38,7 @@ describe 'BlobView', ->
expect
(
spy
).
toHaveBeenPrevented
()
expect
(
spy
).
toHaveBeenPrevented
()
it
'handles garbage input from the hash'
,
->
it
'handles garbage input from the hash'
,
->
func
=
->
new
BlobView
(
'#tree-content-holder'
)
func
=
->
new
LineHighlighter
(
'#tree-content-holder'
)
expect
(
func
).
not
.
toThrow
()
expect
(
func
).
not
.
toThrow
()
describe
'#clickHandler'
,
->
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