mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Highlight the tab for the initial active edit session
This commit is contained in:
@@ -18,7 +18,7 @@ describe "Tabs", ->
|
||||
rootView.remove()
|
||||
|
||||
describe "@activate", ->
|
||||
fit "appends a status bear to all existing and new editors", ->
|
||||
it "appends a status bear to all existing and new editors", ->
|
||||
expect(rootView.panes.find('.pane').length).toBe 1
|
||||
expect(rootView.panes.find('.pane > .tabs').length).toBe 1
|
||||
editor.splitRight()
|
||||
@@ -26,9 +26,13 @@ describe "Tabs", ->
|
||||
expect(rootView.panes.find('.pane > .tabs').length).toBe 2
|
||||
|
||||
describe "#initialize()", ->
|
||||
fit "creates a tab for each edit session on the editor to which the tab-strip belongs", ->
|
||||
it "creates a tab for each edit session on the editor to which the tab-strip belongs", ->
|
||||
expect(editor.editSessions.length).toBe 2
|
||||
expect(tabs.find('.tab').length).toBe 2
|
||||
|
||||
expect(tabs.find('.tab:eq(0) .file-name').text()).toBe editor.editSessions[0].buffer.getBaseName()
|
||||
expect(tabs.find('.tab:eq(1) .file-name').text()).toBe editor.editSessions[1].buffer.getBaseName()
|
||||
|
||||
it "highlights the tab for the current active edit session", ->
|
||||
expect(editor.getActiveEditSessionIndex()).toBe 1
|
||||
expect(tabs.find('.tab:eq(1)')).toHaveClass 'active'
|
||||
|
||||
@@ -19,7 +19,10 @@ class Tabs extends View
|
||||
@div class: 'tabs'
|
||||
|
||||
initialize: (@editor) ->
|
||||
for editSession in @editor.editSessions
|
||||
for editSession, index in @editor.editSessions
|
||||
@append $$ ->
|
||||
@div class: 'tab', =>
|
||||
@div editSession.buffer.getBaseName(), class: 'file-name'
|
||||
|
||||
activeIndex = @editor.getActiveEditSessionIndex()
|
||||
@children(":eq(#{activeIndex})").addClass('active')
|
||||
|
||||
@@ -9,12 +9,17 @@
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
padding: 4px;
|
||||
background: #555;
|
||||
background: #3a3a3a;
|
||||
color: white;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
.tab.active {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
.tab:last-child {
|
||||
margin-right: 4px;
|
||||
}
|
||||
Reference in New Issue
Block a user