Allow atom-pane to be shrunk independently of its contents' width

This commit is contained in:
Antonio Scandurra
2016-05-30 14:49:29 +02:00
parent 5eb0a03cd6
commit 2fb757791b
2 changed files with 18 additions and 1 deletions

View File

@@ -1,12 +1,13 @@
PaneContainer = require '../src/pane-container'
describe "PaneElement", ->
[paneElement, container, pane] = []
[paneElement, container, containerElement, pane] = []
beforeEach ->
spyOn(atom.applicationDelegate, "open")
container = new PaneContainer(config: atom.config, confirm: atom.confirm.bind(atom))
containerElement = atom.views.getView(container)
pane = container.getActivePane()
paneElement = atom.views.getView(pane)
@@ -195,3 +196,18 @@ describe "PaneElement", ->
event = buildDragEvent("drop", [])
paneElement.dispatchEvent(event)
expect(atom.applicationDelegate.open).not.toHaveBeenCalled()
describe "resize", ->
it "shrinks independently of its contents' width", ->
jasmine.attachToDOM(containerElement)
item = document.createElement('div')
item.style.width = "2000px"
item.style.height = "30px"
paneElement.insertBefore(item, paneElement.children[0])
paneElement.style.flexGrow = 0.1
expect(paneElement.getBoundingClientRect().width).toBeGreaterThan(0)
expect(paneElement.getBoundingClientRect().width).toBeLessThan(item.getBoundingClientRect().width)
paneElement.style.flexGrow = 0
expect(paneElement.getBoundingClientRect().width).toBe(0)

View File

@@ -48,6 +48,7 @@ atom-pane-container {
-webkit-flex: 1;
-webkit-flex-direction: column;
overflow: visible;
min-width: 0;
.item-views {
-webkit-flex: 1;