mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Handle addition/removal of ‘gutter-hidden’ attribute
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
@@ -30,6 +30,17 @@ describe "TextEditorElement", ->
|
||||
element = jasmineContent.firstChild
|
||||
expect(element.getModel().getText()).toBe 'testing'
|
||||
|
||||
describe "when attributes change", ->
|
||||
it "honors addition/removal of the 'gutter-hidden' attribute", ->
|
||||
element = new TextEditorElement
|
||||
expect(element.getModel().isGutterVisible()).toBe true
|
||||
|
||||
element.setAttributeNode(document.createAttribute("gutter-hidden"))
|
||||
expect(element.getModel().isGutterVisible()).toBe false
|
||||
|
||||
element.removeAttribute('gutter-hidden')
|
||||
expect(element.getModel().isGutterVisible()).toBe true
|
||||
|
||||
describe "when the model is assigned", ->
|
||||
it "adds the 'mini' attribute if .isMini() returns true on the model", ->
|
||||
element = new TextEditorElement
|
||||
|
||||
@@ -71,6 +71,10 @@ class TextEditorElement extends HTMLElement
|
||||
@unmountComponent()
|
||||
@emitter.emit("did-detach")
|
||||
|
||||
attributeChangedCallback: (name, oldValue, newValue) ->
|
||||
if name is 'gutter-hidden'
|
||||
@getModel().setGutterVisible(not @hasAttribute('gutter-hidden'))
|
||||
|
||||
initialize: (model) ->
|
||||
@setModel(model)
|
||||
this
|
||||
|
||||
Reference in New Issue
Block a user