summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-07-17 20:40:56 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-07-17 20:40:56 -0400
commitdd6daf465624d0a4ec2bc232f647c0d484a82351 (patch)
tree5871c17be7fb27d1a786220bc5dc7dddd13c9a87 /spec/javascripts
parent4998f7a0b5abf137abce8258beda28fe06d3803d (diff)
downloadgitlab-ce-dd6daf465624d0a4ec2bc232f647c0d484a82351.tar.gz
Add test case for clicking line number anchor iconrs-issue-988-test
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/fixtures/line_highlighter.html.haml4
-rw-r--r--spec/javascripts/line_highlighter_spec.js.coffee8
2 files changed, 11 insertions, 1 deletions
diff --git a/spec/javascripts/fixtures/line_highlighter.html.haml b/spec/javascripts/fixtures/line_highlighter.html.haml
index 15ad1d8968f..da1ebcdb23c 100644
--- a/spec/javascripts/fixtures/line_highlighter.html.haml
+++ b/spec/javascripts/fixtures/line_highlighter.html.haml
@@ -2,7 +2,9 @@
.file-content
.line-numbers
- 1.upto(25) do |i|
- %a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i}= i
+ %a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i}
+ %i.fa.fa-link
+ = i
%pre.code.highlight
%code
- 1.upto(25) do |i|
diff --git a/spec/javascripts/line_highlighter_spec.js.coffee b/spec/javascripts/line_highlighter_spec.js.coffee
index 14fa487ff7f..57453c716a5 100644
--- a/spec/javascripts/line_highlighter_spec.js.coffee
+++ b/spec/javascripts/line_highlighter_spec.js.coffee
@@ -48,6 +48,14 @@ describe 'LineHighlighter', ->
clickLine(13)
expect(spy).toHaveBeenPrevented()
+ it 'handles clicking on a child icon element', ->
+ spy = spyOn(@class, 'setHash').and.callThrough()
+
+ $('#L13 i').mousedown().click()
+
+ expect(spy).toHaveBeenCalledWith(13)
+ expect($('#LC13')).toHaveClass(@css)
+
describe 'without shiftKey', ->
it 'highlights one line when clicked', ->
clickLine(13)