Rename shouldShowAudioNotificationSetting

Use `isAudioNotificationSupported` to make it less presentation layer specific.
This commit is contained in:
Daniel Gasienica 2018-02-26 13:26:40 -05:00
parent 105eb95391
commit 85b121aca4
4 changed files with 9 additions and 10 deletions

View file

@ -606,12 +606,12 @@
</div> </div>
</div> </div>
<br /> <br />
{{ #shouldShowAudioNotificationSetting }} {{ #isAudioNotificationSupported }}
<div class='audio-notification-setting'> <div class='audio-notification-setting'>
<input type='checkbox' name='audio-notification' id='audio-notification'/> <input type='checkbox' name='audio-notification' id='audio-notification'/>
<label for='audio-notification'>{{ audioNotificationDescription }}</label> <label for='audio-notification'>{{ audioNotificationDescription }}</label>
</div> </div>
{{ /shouldShowAudioNotificationSetting }} {{ /isAudioNotificationSupported }}
</div> </div>
</script> </script>
<script type='text/x-tmpl-mustache' id='syncSettings'> <script type='text/x-tmpl-mustache' id='syncSettings'>

View file

@ -1,4 +1,4 @@
const OS = require('../os'); const OS = require('../os');
exports.shouldShowAudioNotificationSetting = () => exports.isAudioNotificationSupported = () =>
!OS.isLinux(); !OS.isLinux();

View file

@ -70,7 +70,7 @@
name: 'theme-setting', name: 'theme-setting',
event: 'change-theme' event: 'change-theme'
}); });
if (Settings.shouldShowAudioNotificationSetting()) { if (Settings.isAudioNotificationSupported()) {
new CheckboxView({ new CheckboxView({
el: this.$('.audio-notification-setting'), el: this.$('.audio-notification-setting'),
defaultValue: false, defaultValue: false,
@ -104,8 +104,7 @@
noNameOrMessage: i18n('noNameOrMessage'), noNameOrMessage: i18n('noNameOrMessage'),
nameOnly: i18n('nameOnly'), nameOnly: i18n('nameOnly'),
audioNotificationDescription: i18n('audioNotificationDescription'), audioNotificationDescription: i18n('audioNotificationDescription'),
shouldShowAudioNotificationSetting: isAudioNotificationSupported: Settings.isAudioNotificationSupported(),
Settings.shouldShowAudioNotificationSetting(),
themeAndroidDark: i18n('themeAndroidDark'), themeAndroidDark: i18n('themeAndroidDark'),
hideMenuBar: i18n('hideMenuBar'), hideMenuBar: i18n('hideMenuBar'),
}; };

View file

@ -7,7 +7,7 @@ const Settings = require('../../../js/modules/types/settings');
describe('Settings', () => { describe('Settings', () => {
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();
describe('shouldShowAudioNotificationSetting', () => { describe('isAudioNotificationSupported', () => {
context('on macOS', () => { context('on macOS', () => {
beforeEach(() => { beforeEach(() => {
sandbox.stub(process, 'platform').value('darwin'); sandbox.stub(process, 'platform').value('darwin');
@ -18,7 +18,7 @@ describe('Settings', () => {
}); });
it('should return true', () => { it('should return true', () => {
assert.isTrue(Settings.shouldShowAudioNotificationSetting()); assert.isTrue(Settings.isAudioNotificationSupported());
}); });
}); });
@ -32,7 +32,7 @@ describe('Settings', () => {
}); });
it('should return true', () => { it('should return true', () => {
assert.isTrue(Settings.shouldShowAudioNotificationSetting()); assert.isTrue(Settings.isAudioNotificationSupported());
}); });
}); });
@ -46,7 +46,7 @@ describe('Settings', () => {
}); });
it('should return false', () => { it('should return false', () => {
assert.isFalse(Settings.shouldShowAudioNotificationSetting()); assert.isFalse(Settings.isAudioNotificationSupported());
}); });
}); });
}); });