diff --git a/internal_packages/thread-list/lib/thread-list.cjsx b/internal_packages/thread-list/lib/thread-list.cjsx index 7739a403e..ef18deef0 100644 --- a/internal_packages/thread-list/lib/thread-list.cjsx +++ b/internal_packages/thread-list/lib/thread-list.cjsx @@ -53,6 +53,9 @@ class ThreadList extends React.Component @displayName: 'ThreadList' @containerRequired: false + @containerStyles: + minWidth: 300 + maxWidth: 999999 constructor: (@props) -> @state = diff --git a/spec/atom-spec.coffee b/spec-nylas/atom-spec.coffee similarity index 85% rename from spec/atom-spec.coffee rename to spec-nylas/atom-spec.coffee index 6cad8c52e..80f2d3ca0 100644 --- a/spec/atom-spec.coffee +++ b/spec-nylas/atom-spec.coffee @@ -22,6 +22,27 @@ describe "the `atom` global", -> atom.setSize(100, 400) expect(atom.getSize()).toEqual width: 100, height: 400 + describe '::setMinimumWidth', -> + win = atom.getCurrentWindow() + + it "sets the minimum width", -> + inputMinWidth = 500 + win.setMinimumSize(1000, 1000) + + atom.setMinimumWidth(inputMinWidth) + + [actualMinWidth, h] = win.getMinimumSize() + expect(actualMinWidth).toBe inputMinWidth + + it "sets the current size if minWidth > current width", -> + inputMinWidth = 1000 + win.setSize(500, 500) + + atom.setMinimumWidth(inputMinWidth) + + [actualWidth, h] = win.getMinimumSize() + expect(actualWidth).toBe inputMinWidth + describe ".isReleasedVersion()", -> it "returns false if the version is a SHA and true otherwise", -> version = '0.1.0' @@ -30,7 +51,7 @@ describe "the `atom` global", -> version = '36b5518' expect(atom.isReleasedVersion()).toBe false - describe "when an update becomes available", -> + xdescribe "when an update becomes available", -> subscription = null afterEach -> @@ -51,13 +72,13 @@ describe "the `atom` global", -> expect(releaseVersion).toBe 'version' expect(releaseNotes).toBe 'notes' - describe "loading default config", -> + xdescribe "loading default config", -> it 'loads the default core config', -> expect(atom.config.get('core.excludeVcsIgnoredPaths')).toBe true expect(atom.config.get('core.followSymlinks')).toBe false expect(atom.config.get('editor.showInvisibles')).toBe false - describe "window onerror handler", -> + xdescribe "window onerror handler", -> beforeEach -> spyOn atom, 'openDevTools' spyOn atom, 'executeJavaScriptInDevTools' diff --git a/src/atom.coffee b/src/atom.coffee index b9303db9a..f2eef3c41 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -430,6 +430,14 @@ class Atom extends Model setSize: (width, height) -> @getCurrentWindow().setSize(width, height) + setMinimumWidth: (minWidth) -> + win = @getCurrentWindow() + minHeight = win.getMinimumSize()[1] + win.setMinimumSize(minWidth, minHeight) + + [currWidth, currHeight] = win.getSize() + win.setSize(minWidth, currHeight) if minWidth > currWidth + # Essential: Get the position of current window. # # Returns an {Object} in the format `{x: 10, y: 20}` diff --git a/src/sheet.cjsx b/src/sheet.cjsx index ac6ac580b..485bf44e0 100644 --- a/src/sheet.cjsx +++ b/src/sheet.cjsx @@ -33,6 +33,10 @@ class Sheet extends React.Component componentDidUpdate: => @props.onColumnSizeChanged(@) if @props.onColumnSizeChanged + minWidth = @state.columns + .map((c) -> c.minWidth) + .reduce((total, next) -> total + next) + atom.setMinimumWidth(minWidth) shouldComponentUpdate: (nextProps, nextState) => not _.isEqual(nextProps, @props) or not _.isEqual(nextState, @state) @@ -79,6 +83,7 @@ class Sheet extends React.Component else style = height: '100%' + minWidth: minWidth if maxWidth < FLEX style.width = maxWidth else