summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-15 17:53:39 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-06-19 04:31:24 -0400
commit32366d18118281b32b5e770824d637a01d15093b (patch)
treee8241017935ec6a01632b060b45429f2471dba9e
parent1f88d9b56f02ab05aa1ea055a53627b4c934cf51 (diff)
downloadgitlab-ce-32366d18118281b32b5e770824d637a01d15093b.tar.gz
Rename BlobView to LineHighlighter
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee2
-rw-r--r--app/assets/javascripts/line_highlighter.js.coffee (renamed from app/assets/javascripts/blob/blob.js.coffee)6
-rw-r--r--spec/javascripts/fixtures/line_highlighter.html.haml (renamed from spec/javascripts/fixtures/blob.html.haml)0
-rw-r--r--spec/javascripts/line_highlighter_spec.js.coffee (renamed from spec/javascripts/blob/blob_spec.js.coffee)18
4 files changed, 13 insertions, 13 deletions
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index b7ebe6a5c89..84873e389ea 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -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()
diff --git a/app/assets/javascripts/blob/blob.js.coffee b/app/assets/javascripts/line_highlighter.js.coffee
index 6df5e870d85..a60a04783ac 100644
--- a/app/assets/javascripts/blob/blob.js.coffee
+++ b/app/assets/javascripts/line_highlighter.js.coffee
@@ -1,4 +1,4 @@
-# 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) ->
diff --git a/spec/javascripts/fixtures/blob.html.haml b/spec/javascripts/fixtures/line_highlighter.html.haml
index 15ad1d8968f..15ad1d8968f 100644
--- a/spec/javascripts/fixtures/blob.html.haml
+++ b/spec/javascripts/fixtures/line_highlighter.html.haml
diff --git a/spec/javascripts/blob/blob_spec.js.coffee b/spec/javascripts/line_highlighter_spec.js.coffee
index a6f68a53f99..d9a1ff2d5bb 100644
--- a/spec/javascripts/blob/blob_spec.js.coffee
+++ b/spec/javascripts/line_highlighter_spec.js.coffee
@@ -1,7 +1,7 @@
-#= 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', ->