mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
Panel containers have the orientation
This commit is contained in:
parent
5c2e55861c
commit
83e5873f3b
@ -30,10 +30,13 @@ describe "PanelContainerElement", ->
|
||||
modelConstructor: TestPanelItem
|
||||
viewConstructor: TestPanelItemElement
|
||||
|
||||
container = new PanelContainer({viewRegistry})
|
||||
container = new PanelContainer({viewRegistry, orientation: 'left'})
|
||||
element = container.getView()
|
||||
jasmineContent.appendChild(element)
|
||||
|
||||
it 'has an oritation attribute with value from the model', ->
|
||||
expect(element.getAttribute('orientation')).toBe 'left'
|
||||
|
||||
it 'removes the element when the container is destroyed', ->
|
||||
expect(element.parentNode).toBe jasmineContent
|
||||
container.destroy()
|
||||
|
@ -11,6 +11,8 @@ class PanelContainerElement extends HTMLElement
|
||||
@subscriptions.add @model.onDidRemovePanel(@panelRemoved.bind(this))
|
||||
@subscriptions.add @model.onDidDestroy(@destroyed.bind(this))
|
||||
|
||||
@setAttribute('orientation', @model.getOrientation())
|
||||
|
||||
panelAdded: ({panel, index}) ->
|
||||
if index >= @childNodes.length
|
||||
@appendChild(panel.getView())
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Public:
|
||||
module.exports =
|
||||
class PanelContainer
|
||||
constructor: ({@viewRegistry}) ->
|
||||
constructor: ({@viewRegistry, @orientation}) ->
|
||||
@emitter = new Emitter
|
||||
@subscriptions = new CompositeDisposable
|
||||
@panels = []
|
||||
@ -33,6 +33,8 @@ class PanelContainer
|
||||
|
||||
getView: -> @viewRegistry.getView(this)
|
||||
|
||||
getOrientation: -> @orientation
|
||||
|
||||
getPanels: -> @panels
|
||||
|
||||
addPanel: (panel) ->
|
||||
|
Loading…
Reference in New Issue
Block a user