mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
[Gutter] Clear custom gutter decorations from previous usages of a custom gutter element
This commit is contained in:
parent
192997c8cf
commit
5e766b6eee
@ -79,6 +79,21 @@ describe "TextEditorElement", ->
|
||||
jasmine.attachToDOM(element)
|
||||
expect(element.shadowRoot.querySelectorAll('.line-number').length).toBe initialCount
|
||||
|
||||
it "does not render duplicate decorations in custom gutters", ->
|
||||
editor = new TextEditor
|
||||
editor.setText('1\n2\n3')
|
||||
editor.addGutter({name: 'test-gutter'})
|
||||
marker = editor.markBufferRange([[0,0],[2,0]])
|
||||
editor.decorateMarker(marker, {type: 'gutter', gutterName: 'test-gutter'})
|
||||
element = atom.views.getView(editor)
|
||||
|
||||
jasmine.attachToDOM(element)
|
||||
initialDecorationCount = element.shadowRoot.querySelectorAll('.decoration').length
|
||||
|
||||
element.remove()
|
||||
jasmine.attachToDOM(element)
|
||||
expect(element.shadowRoot.querySelectorAll('.decoration').length).toBe initialDecorationCount
|
||||
|
||||
describe "focus and blur handling", ->
|
||||
describe "when the editor.useShadowDOM config option is true", ->
|
||||
it "proxies focus/blur events to/from the hidden input inside the shadow root", ->
|
||||
|
@ -13,6 +13,8 @@ class CustomGutterComponent
|
||||
|
||||
@domNode = atom.views.getView(@gutter)
|
||||
@decorationsNode = @domNode.firstChild
|
||||
# Clear the contents in case the domNode is being reused.
|
||||
@decorationsNode.innerHTML = ''
|
||||
|
||||
getDomNode: ->
|
||||
@domNode
|
||||
|
Loading…
Reference in New Issue
Block a user