Use ‘atom-pane-axis’ custom tag name for PaneAxisElement

This commit is contained in:
Nathan Sobo 2014-10-08 11:32:58 -07:00
parent ee9284e228
commit ddf36a013c
6 changed files with 27 additions and 29 deletions

View File

@ -74,13 +74,13 @@ describe "PaneContainerView", ->
describe "serialization", ->
it "can be serialized and deserialized, and correctly adjusts dimensions of deserialized panes after attach", ->
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('.pane-row > :contains(1)')).toExist()
expect(newContainer.find('.pane-row > .pane-column > :contains(2)')).toExist()
expect(newContainer.find('.pane-row > .pane-column > :contains(3)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(2)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(3)')).toExist()
newContainer.height(200).width(300).attachToDom()
expect(newContainer.find('.pane-row > :contains(1)').width()).toBe 150
expect(newContainer.find('.pane-row > .pane-column > :contains(2)').height()).toBe 100
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)').width()).toBe 150
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(2)').height()).toBe 100
describe "if there are empty panes after deserialization", ->
beforeEach ->
@ -90,14 +90,14 @@ describe "PaneContainerView", ->
describe "if the 'core.destroyEmptyPanes' config option is false (the default)", ->
it "leaves the empty panes intact", ->
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('.pane-row > :contains(1)')).toExist()
expect(newContainer.find('.pane-row > .pane-column > atom-pane').length).toBe 2
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane').length).toBe 2
describe "if the 'core.destroyEmptyPanes' config option is true", ->
it "removes empty panes on deserialization", ->
atom.config.set('core.destroyEmptyPanes', true)
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('.pane-row, .pane-column')).not.toExist()
expect(newContainer.find('atom-pane-axis.horizontal, atom-pane-axis.vertical')).not.toExist()
expect(newContainer.find('> :contains(1)')).toExist()
describe "pane-container:active-pane-item-changed", ->

View File

@ -289,7 +289,7 @@ describe "PaneView", ->
expect(paneModel.isActive()).toBe true
describe "when a pane is split", ->
it "builds the appropriate pane-row and pane-column views", ->
it "builds the appropriateatom-pane-axis.horizontal and pane-column views", ->
pane1 = pane
pane1Model = pane.getModel()
pane.activateItem(editor1)
@ -300,11 +300,11 @@ describe "PaneView", ->
pane2 = containerModel.getView(pane2Model).__spacePenView
pane3 = containerModel.getView(pane3Model).__spacePenView
expect(container.find('> .pane-row > atom-pane').toArray()).toEqual [pane1[0]]
expect(container.find('> .pane-row > .pane-column > atom-pane').toArray()).toEqual [pane2[0], pane3[0]]
expect(container.find('> atom-pane-axis.horizontal > atom-pane').toArray()).toEqual [pane1[0]]
expect(container.find('> atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane').toArray()).toEqual [pane2[0], pane3[0]]
pane1Model.destroy()
expect(container.find('> .pane-column > atom-pane').toArray()).toEqual [pane2[0], pane3[0]]
expect(container.find('> atom-pane-axis.vertical > atom-pane').toArray()).toEqual [pane2[0], pane3[0]]
describe "serialization", ->
it "focuses the pane after attach only if had focus when serialized", ->

View File

@ -82,10 +82,10 @@ describe "WorkspaceView", ->
simulateReload()
expect(atom.workspaceView.getEditorViews().length).toBe 4
editorView1 = atom.workspaceView.panes.find('.pane-row > atom-pane .editor:eq(0)').view()
editorView3 = atom.workspaceView.panes.find('.pane-row > atom-pane .editor:eq(1)').view()
editorView2 = atom.workspaceView.panes.find('.pane-row > .pane-column > atom-pane .editor:eq(0)').view()
editorView4 = atom.workspaceView.panes.find('.pane-row > .pane-column > atom-pane .editor:eq(1)').view()
editorView1 = atom.workspaceView.panes.find('atom-pane-axis.horizontal > atom-pane .editor:eq(0)').view()
editorView3 = atom.workspaceView.panes.find('atom-pane-axis.horizontal > atom-pane .editor:eq(1)').view()
editorView2 = atom.workspaceView.panes.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane .editor:eq(0)').view()
editorView4 = atom.workspaceView.panes.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane .editor:eq(1)').view()
expect(editorView1.getEditor().getPath()).toBe atom.project.resolve('a')
expect(editorView2.getEditor().getPath()).toBe atom.project.resolve('b')

View File

@ -17,9 +17,9 @@ class PaneAxisElement extends HTMLElement
switch @model.getOrientation()
when 'horizontal'
@classList.add('pane-row')
@classList.add('horizontal', 'pane-row')
when 'vertical'
@classList.add('pane-column')
@classList.add('vertical', 'pane-column')
childAdded: ({child, index}) ->
view = @model.getView(child)
@ -39,6 +39,4 @@ class PaneAxisElement extends HTMLElement
hasFocus: ->
this is document.activeElement or @contains(document.activeElement)
module.exports = PaneAxisElement = document.registerElement 'atom-pane-axis',
prototype: PaneAxisElement.prototype
extends: 'div'
module.exports = PaneAxisElement = document.registerElement 'atom-pane-axis', prototype: PaneAxisElement.prototype

View File

@ -7,13 +7,13 @@
display: -webkit-flex;
-webkit-flex: 1;
.pane-column {
atom-pane-axis.vertical {
display: -webkit-flex;
-webkit-flex: 1;
-webkit-flex-direction: column;
}
.pane-row {
atom-pane-axis.horizontal {
display: -webkit-flex;
-webkit-flex: 1;
-webkit-flex-direction: row;

View File

@ -28,14 +28,14 @@ h6 {
background-color: @app-background-color;
font-family: @font-family;
.horizontal {
> .horizontal {
display: -webkit-flex;
height: 100%;
}
.vertical {
display: -webkit-flex;
-webkit-flex: 1;
-webkit-flex-flow: column;
> .vertical {
display: -webkit-flex;
-webkit-flex: 1;
-webkit-flex-flow: column;
}
}
}