Merge pull request #1674 from atom/ns-scrollbar-style

Apply 'scrollbars-visible-always/when-scrolling' class to WorkspaceView
This commit is contained in:
Nathan Sobo
2014-03-04 20:08:25 +02:00
3 changed files with 18 additions and 0 deletions

View File

@@ -41,6 +41,7 @@
"random-words": "0.0.1",
"runas": "0.5.x",
"scandal": "0.15.0",
"scrollbar-style": "^0.1.0",
"season": ">=1.0.2 <2.0",
"semver": "1.1.4",
"serializable": "1.x",

View File

@@ -241,3 +241,11 @@ describe "WorkspaceView", ->
expect(atom.workspaceView.getActivePane().getItems()).toHaveLength 1
atom.workspaceView.trigger('core:close')
expect(atom.workspaceView.getActivePane().getItems()).toHaveLength 0
describe "the scrollbar visibility class", ->
it "has a class based on the style of the scrollbar", ->
scrollbarStyle = require 'scrollbar-style'
scrollbarStyle.emitValue 'legacy'
expect(atom.workspaceView).toHaveClass 'scrollbars-visible-always'
scrollbarStyle.emitValue 'overlay'
expect(atom.workspaceView).toHaveClass 'scrollbars-visible-when-scrolling'

View File

@@ -3,6 +3,7 @@ path = require 'path'
Q = require 'q'
_ = require 'underscore-plus'
Delegator = require 'delegato'
scrollbarStyle = require 'scrollbar-style'
{$, $$, View} = require './space-pen-extensions'
fs = require 'fs-plus'
Workspace = require './workspace'
@@ -81,6 +82,14 @@ class WorkspaceView extends View
@subscribe @model, 'uri-opened', => @trigger 'uri-opened'
@subscribe scrollbarStyle, (style) =>
@removeClass('scrollbars-visible-always scrollbars-visible-when-scrolling')
switch style
when 'legacy'
@addClass("scrollbars-visible-always")
when 'overlay'
@addClass("scrollbars-visible-when-scrolling")
@updateTitle()
@on 'focus', (e) => @handleFocus(e)