Merge pull request #555 from yuya-oc/fix-x-on-first-launch

Fix close button not working when the number of servers is not zero
This commit is contained in:
Yuya Ochiai 2017-07-04 23:03:21 +09:00 committed by GitHub
commit 56ec6dedcf
3 changed files with 38 additions and 9 deletions

View file

@ -23,6 +23,8 @@ Release date: TBD
#### All Platforms #### All Platforms
- Fixed mis-aligned `+` button of tab bar. - Fixed mis-aligned `+` button of tab bar.
[#541](https://github.com/mattermost/desktop/issues/541) [#541](https://github.com/mattermost/desktop/issues/541)
- Fixed the close button of the Settings page not working on first installation.
[#552](https://github.com/mattermost/desktop/issues/552)
#### Windows #### Windows
- Fixed desktop notifications not working when the window has been minimized from inactive state. - Fixed desktop notifications not working when the window has been minimized from inactive state.

View file

@ -39,7 +39,6 @@ const SettingsPage = createReactClass({
initialState.showAddTeamForm = false; initialState.showAddTeamForm = false;
initialState.trayWasVisible = remote.getCurrentWindow().trayWasVisible; initialState.trayWasVisible = remote.getCurrentWindow().trayWasVisible;
initialState.disableClose = initialState.teams.length === 0;
if (initialState.teams.length === 0) { if (initialState.teams.length === 0) {
initialState.showAddTeamForm = true; initialState.showAddTeamForm = true;
} }
@ -454,7 +453,7 @@ const SettingsPage = createReactClass({
bsStyle='link' bsStyle='link'
style={settingsPage.close} style={settingsPage.close}
onClick={this.handleCancel} onClick={this.handleCancel}
disabled={this.state.disableClose} disabled={this.state.teams.length === 0}
> >
<span>{'×'}</span> <span>{'×'}</span>
</Button> </Button>

View file

@ -31,7 +31,8 @@ describe('browser/settings.html', function desc() {
return true; return true;
}); });
it('should show index.html when Close button is clicked', () => { describe('Close button', () => {
it('should show index.html when it\'s clicked', () => {
env.addClientCommands(this.app.client); env.addClientCommands(this.app.client);
return this.app.client. return this.app.client.
loadSettingsPage(). loadSettingsPage().
@ -40,6 +41,33 @@ describe('browser/settings.html', function desc() {
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/)); getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/));
}); });
it('should be disabled when the number of servers is zero', () => {
return this.app.stop().then(() => {
env.cleanTestConfig();
return this.app.start();
}).then(() => {
return this.app.client.waitUntilWindowLoaded().
waitForVisible('#newServerModal').
click('#cancelNewServerModal').
isEnabled('#btnClose').then((enabled) => {
enabled.should.equal(false);
}).
waitForVisible('#newServerModal', true).
pause(250).
click('#addNewServer').
waitForVisible('#newServerModal').
setValue('#teamNameInput', 'TestTeam').
setValue('#teamUrlInput', 'http://example.org').
click('#saveNewServerModal').
waitForVisible('#newServerModal', true).
waitForVisible('.AutoSaveIndicator', true).
isEnabled('#btnClose').then((enabled) => {
enabled.should.equal(true);
});
});
});
});
it('should show NewServerModal after all servers are removed', () => { it('should show NewServerModal after all servers are removed', () => {
const modalTitleSelector = '.modal-title=Remove Server'; const modalTitleSelector = '.modal-title=Remove Server';
env.addClientCommands(this.app.client); env.addClientCommands(this.app.client);