diff --git a/src/browser/index.jsx b/src/browser/index.jsx
index f961cae1..38be3d3f 100644
--- a/src/browser/index.jsx
+++ b/src/browser/index.jsx
@@ -55,7 +55,7 @@ var MainPage = React.createClass({
var visibility = visible ? 'visible' : 'hidden';
return {
position: 'absolute',
- top: 42,
+ top: (this.props.teams.length > 1) ? 42 : 0,
right: 0,
bottom: 0,
left: 0,
@@ -64,19 +64,16 @@ var MainPage = React.createClass({
},
render: function() {
var thisObj = this;
- var tabs = this.props.teams.map(function(team, index) {
- var badge;
- if (thisObj.state.unreadCounts[index] != 0) {
- badge = (
- { thisObj.state.unreadCounts[index] }
- );
- }
- return (
- { team.name }
- { ' ' }
- { badge }
- );
- });
+
+ var tabs_row;
+ if (this.props.teams.length > 1) {
+ tabs_row = (
+
+
+
+ );
+ }
+
var views = this.props.teams.map(function(team, index) {
var handleUnreadCountChange = function(count) {
thisObj.handleUnreadCountChange(index, count);
@@ -87,21 +84,41 @@ var MainPage = React.createClass({
return ()
});
+ var views_row = (
+ { views }
+
);
return (
-
-
-
-
- { views }
-
+ { tabs_row }
+ { views_row }
);
}
});
+var TabBar = React.createClass({
+ render: function() {
+ var thisObj = this;
+ var tabs = this.props.teams.map(function(team, index) {
+ var badge;
+ if (thisObj.props.unreadCounts[index] != 0) {
+ badge = (
+ { thisObj.props.unreadCounts[index] }
+ );
+ }
+ return (
+ { team.name }
+ { ' ' }
+ { badge }
+ );
+ });
+ return (
+
+ );
+ }
+});
var MattermostView = React.createClass({
getInitialState: function() {
diff --git a/test/browser_test.js b/test/browser_test.js
index a689e9e2..746ce496 100644
--- a/test/browser_test.js
+++ b/test/browser_test.js
@@ -106,10 +106,22 @@ describe('electron-mattermost', function() {
}]
};
- before(function() {
+ beforeEach(function() {
fs.writeFileSync(config_file_path, JSON.stringify(config));
});
+ it('should NOT show tabs when there is one team', function() {
+ fs.writeFileSync(config_file_path, JSON.stringify({
+ url: mattermost_url
+ }));
+ return client
+ .init()
+ .isExisting('#tabBar').then(function(isExisting) {
+ isExisting.should.be.false();
+ })
+ .end();
+ });
+
it('should set src of webview from config file', function() {
return client
.init()