Add tests for settings
This commit is contained in:
@@ -141,8 +141,8 @@ var SettingsPage = React.createClass({
|
|||||||
onChange={ this.handleChangeHideMenuBar } />);
|
onChange={ this.handleChangeHideMenuBar } />);
|
||||||
}
|
}
|
||||||
if (process.platform === 'darwin' || process.platform === 'linux') {
|
if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||||
options.push(<Input key="inputShowTrayIcon" ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon } onChange={ this.handleChangeShowTrayIcon }
|
options.push(<Input key="inputShowTrayIcon" id="inputShowTrayIcon" ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon }
|
||||||
/>);
|
onChange={ this.handleChangeShowTrayIcon } />);
|
||||||
}
|
}
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
options.push(<Input key="inputTrayIconTheme" ref="trayIconTheme" type="select" label="Icon theme (Need to restart the application)" value={ this.state.trayIconTheme } onChange={ this.handleChangeTrayIconTheme }>
|
options.push(<Input key="inputTrayIconTheme" ref="trayIconTheme" type="select" label="Icon theme (Need to restart the application)" value={ this.state.trayIconTheme } onChange={ this.handleChangeTrayIconTheme }>
|
||||||
@@ -154,7 +154,8 @@ var SettingsPage = React.createClass({
|
|||||||
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
|
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
|
||||||
//OSX has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
//OSX has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
||||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||||
options.push(<Input key="inputAutoStart" ref="autostart" type="checkbox" label="Start app on login." checked={ this.state.autostart } onChange={ this.handleChangeAutoStart } />);
|
options.push(<Input key="inputAutoStart" id="inputAutoStart" ref="autostart" type="checkbox" label="Start app on login." checked={ this.state.autostart } onChange={ this.handleChangeAutoStart }
|
||||||
|
/>);
|
||||||
}
|
}
|
||||||
var options_row = (options.length > 0) ? (
|
var options_row = (options.length > 0) ? (
|
||||||
<Row>
|
<Row>
|
||||||
@@ -193,7 +194,7 @@ var SettingsPage = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
notifications_row = (
|
notifications_row = (
|
||||||
<Row>
|
<Row id="notificationsRow">
|
||||||
<Col md={ 12 }>
|
<Col md={ 12 }>
|
||||||
<h3>Notifications</h3> Configure, that the taskicon in the taskbar blinks when new message arrives.
|
<h3>Notifications</h3> Configure, that the taskicon in the taskbar blinks when new message arrives.
|
||||||
{ notificationElements }
|
{ notificationElements }
|
||||||
|
@@ -84,19 +84,25 @@ describe('browser/settings.html', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be saved as config.json', function() {
|
[true, false].forEach(function(v) {
|
||||||
|
it(`should be saved as config.json: ${v}`, function() {
|
||||||
env.shouldTestForPlatforms(this, ['win32', 'linux']);
|
env.shouldTestForPlatforms(this, ['win32', 'linux']);
|
||||||
return this.app.restart().then(() => {
|
return this.app.restart().then(() => {
|
||||||
addClientCommands(this.app.client);
|
addClientCommands(this.app.client);
|
||||||
return this.app.client
|
return this.app.client
|
||||||
.loadSettingsPage()
|
.loadSettingsPage()
|
||||||
.click('#inputHideMenuBar input')
|
.isSelected('#inputHideMenuBar input').then((isSelected) => {
|
||||||
|
if (isSelected !== v) {
|
||||||
|
return this.app.client.click('#inputHideMenuBar input')
|
||||||
|
}
|
||||||
|
})
|
||||||
.click('#btnSave')
|
.click('#btnSave')
|
||||||
.pause(1000)
|
.pause(1000)
|
||||||
})
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const saved_config = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
const saved_config = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
saved_config.hideMenuBar.should.be.true;
|
saved_config.hideMenuBar.should.equal(v);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -143,7 +149,36 @@ describe('browser/settings.html', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Start app on login', function() {
|
||||||
|
it('should appear on win32 or linux', function() {
|
||||||
|
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
||||||
|
addClientCommands(this.app.client);
|
||||||
|
return this.app.client
|
||||||
|
.loadSettingsPage()
|
||||||
|
.isExisting('#inputAutoStart').should.eventually.equal(expected)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Show tray icon', function() {
|
||||||
|
it('should appear on darwin or linux', function() {
|
||||||
|
const expected = (process.platform === 'darwin' || process.platform === 'linux');
|
||||||
|
addClientCommands(this.app.client);
|
||||||
|
return this.app.client
|
||||||
|
.loadSettingsPage()
|
||||||
|
.isExisting('#inputShowTrayIcon').should.eventually.equal(expected)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Notifications', function() {
|
||||||
|
it('should appear on win32', function() {
|
||||||
|
const expected = (process.platform === 'win32');
|
||||||
|
addClientCommands(this.app.client);
|
||||||
|
return this.app.client
|
||||||
|
.loadSettingsPage()
|
||||||
|
.isExisting('#notificationsRow').should.eventually.equal(expected)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user