Merge pull request #465 from yuya-oc/fix-tray-theme-save

Fix the setting not saved when changing tray icon theme
This commit is contained in:
Yuya Ochiai
2017-03-16 20:19:29 +09:00
committed by GitHub
3 changed files with 27 additions and 0 deletions

View File

@@ -23,6 +23,9 @@ Release date: TBD
[#430](https://github.com/mattermost/desktop/issues/430)
[#431](https://github.com/mattermost/desktop/issues/431)
#### Linux
- Fixed an issue where the setting was not saved when changing tray icon theme.
[#456](https://github.com/mattermost/desktop/issues/456)
----

View File

@@ -348,6 +348,7 @@ const SettingsPage = React.createClass({
defaultChecked={this.state.trayIconTheme === 'light' || this.state.trayIconTheme === ''}
onChange={() => {
this.setState({trayIconTheme: 'light'});
setImmediate(this.startSaveConfig);
}}
>{'Light'}</Radio>
{' '}
@@ -358,6 +359,7 @@ const SettingsPage = React.createClass({
defaultChecked={this.state.trayIconTheme === 'dark'}
onChange={() => {
this.setState({trayIconTheme: 'dark'});
setImmediate(this.startSaveConfig);
}}
>{'Dark'}</Radio>
</FormGroup>

View File

@@ -180,6 +180,28 @@ describe('browser/settings.html', function desc() {
loadSettingsPage().
isExisting('#inputShowTrayIcon').should.eventually.equal(expected);
});
describe('Save tray icon theme on linux', () => {
env.shouldTest(it, process.platform === 'linux')('should be saved when it\'s selected', () => {
env.addClientCommands(this.app.client);
return this.app.client.
loadSettingsPage().
click('#inputShowTrayIcon').
click('input[value="light"]').
pause(700). // wait auto-save
then(() => {
const config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
config0.trayIconTheme.should.equal('light');
return this.app.client;
}).
click('input[value="dark"]').
pause(700). // wait auto-save
then(() => {
const config1 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
config1.trayIconTheme.should.equal('dark');
});
});
});
});
describe('Leave app running in notification area when application window is closed', () => {