11describe " bracket matching" , ->
2- [editorElement , editor , buffer ] = []
2+ [editorElement , editor , buffer , gutter ] = []
33
44 beforeEach ->
55 atom .config .set ' bracket-matcher.autocompleteBrackets' , true
@@ -20,19 +20,29 @@ describe "bracket matching", ->
2020 editor = atom .workspace .getActiveTextEditor ()
2121 editorElement = atom .views .getView (editor)
2222 buffer = editor .getBuffer ()
23+ gutter = editor .gutterWithName (' line-number' )
2324
2425 describe " matching bracket highlighting" , ->
26+ beforeEach ->
27+ atom .config .set ' bracket-matcher.highlightMatchingLineNumber' , true
28+
2529 expectNoHighlights = ->
2630 decorations = editor .getHighlightDecorations ().filter (decoration) -> decoration .properties .class is ' bracket-matcher'
2731 expect (decorations .length ).toBe 0
2832
2933 expectHighlights = (startBufferPosition , endBufferPosition ) ->
3034 decorations = editor .getHighlightDecorations ().filter (decoration) -> decoration .properties .class is ' bracket-matcher'
35+ gutterDecorations = editor .getLineNumberDecorations ().filter (gutterDecoration) -> gutterDecoration .properties .class is ' bracket-matcher'
36+
3137 expect (decorations .length ).toBe 2
38+ expect (gutterDecorations .length ).toBe 2
3239
3340 expect (decorations[0 ].marker .getStartBufferPosition ()).toEqual startBufferPosition
3441 expect (decorations[1 ].marker .getStartBufferPosition ()).toEqual endBufferPosition
3542
43+ expect (gutterDecorations[0 ].marker .getStartBufferPosition ()).toEqual startBufferPosition
44+ expect (gutterDecorations[1 ].marker .getStartBufferPosition ()).toEqual endBufferPosition
45+
3646 describe " when the cursor is before a starting pair" , ->
3747 it " highlights the starting pair and ending pair" , ->
3848 editor .moveToEndOfLine ()
@@ -234,6 +244,14 @@ describe "bracket matching", ->
234244 editor .getLastCursor ().destroy ()
235245 expectHighlights ([0 , 28 ], [12 , 0 ])
236246
247+ describe " when highlightMatchingLineNumber config is disabled" , ->
248+ it " does not highlight the gutter" , ->
249+ atom .config .set (' bracket-matcher.highlightMatchingLineNumber' , false )
250+ editor .moveToEndOfLine ()
251+ editor .moveLeft ()
252+ gutterDecorations = editor .getLineNumberDecorations ().filter (gutterDecoration) -> gutterDecoration .properties .class is ' bracket-matcher'
253+ expect (gutterDecorations .length ).toBe 0
254+
237255 describe " when the cursor moves off (clears) a selection next to a starting or ending pair" , ->
238256 it " highlights the starting pair and ending pair" , ->
239257 editor .moveToEndOfLine ()
0 commit comments