mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Merge pull request #4305 from atom/ns-add-legacy-panel-classes
Add legacy panel classes for theme support
This commit is contained in:
commit
85d6689344
@ -64,6 +64,8 @@ describe "PanelContainerElement", ->
|
||||
container.addPanel(panel1)
|
||||
expect(element.childNodes.length).toBe 1
|
||||
expect(element.childNodes[0]).toHaveClass 'left'
|
||||
expect(element.childNodes[0]).toHaveClass 'tool-panel' # legacy selector support
|
||||
expect(element.childNodes[0]).toHaveClass 'panel-left' # legacy selector support
|
||||
|
||||
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
|
||||
|
||||
@ -93,6 +95,8 @@ describe "PanelContainerElement", ->
|
||||
container.addPanel(panel1)
|
||||
expect(element.childNodes.length).toBe 1
|
||||
expect(element.childNodes[0]).toHaveClass 'bottom'
|
||||
expect(element.childNodes[0]).toHaveClass 'tool-panel' # legacy selector support
|
||||
expect(element.childNodes[0]).toHaveClass 'panel-bottom' # legacy selector support
|
||||
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
|
||||
expect(panel1.getView()).toHaveClass 'one'
|
||||
|
||||
@ -129,3 +133,14 @@ describe "PanelContainerElement", ->
|
||||
|
||||
expect(panel1.getView().style.display).not.toBe 'none'
|
||||
expect(panel2.getView().style.display).toBe 'none'
|
||||
|
||||
it "adds the 'modal' class to panels", ->
|
||||
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
|
||||
container.addPanel(panel1)
|
||||
|
||||
expect(panel1.getView()).toHaveClass 'modal'
|
||||
|
||||
# legacy selector support
|
||||
expect(panel1.getView()).not.toHaveClass 'tool-panel'
|
||||
expect(panel1.getView()).toHaveClass 'overlay'
|
||||
expect(panel1.getView()).toHaveClass 'from-top'
|
||||
|
@ -500,4 +500,3 @@ describe "Workspace", ->
|
||||
|
||||
expect(panel).toBeDefined()
|
||||
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
|
||||
expect(panel.getClassName()).toBe 'overlay from-top' # the default
|
||||
|
@ -15,6 +15,11 @@ class PanelContainerElement extends HTMLElement
|
||||
panelAdded: ({panel, index}) ->
|
||||
panelElement = panel.getView()
|
||||
panelElement.classList.add(@model.getLocation())
|
||||
if @model.isModal()
|
||||
panelElement.classList.add("overlay", "from-top")
|
||||
else
|
||||
panelElement.classList.add("tool-panel", "panel-#{@model.getLocation()}")
|
||||
|
||||
if index >= @childNodes.length
|
||||
@appendChild(panelElement)
|
||||
else
|
||||
|
@ -682,8 +682,6 @@ class Workspace extends Model
|
||||
#
|
||||
# Returns a {Panel}
|
||||
addModalPanel: (options={}) ->
|
||||
# TODO: remove these default classes. They are to supoprt existing themes.
|
||||
options.className ?= 'overlay from-top'
|
||||
@addPanel('modal', options)
|
||||
|
||||
addPanel: (location, options) ->
|
||||
|
Loading…
Reference in New Issue
Block a user