Add `Settings.isNotificationGroupingSupported`

See: https://github.com/electron/electron/issues/11189
pull/1/head
Daniel Gasienica 7 years ago
parent 211d54451b
commit 5d230d3778

@ -68,4 +68,66 @@ describe('Settings', () => {
});
});
});
describe('isNotificationGroupingSupported', () => {
context('on macOS', () => {
beforeEach(() => {
sandbox.stub(process, 'platform').value('darwin');
});
afterEach(() => {
sandbox.restore();
});
it('should return true', () => {
assert.isTrue(Settings.isNotificationGroupingSupported());
});
});
context('on Windows', () => {
context('version 7', () => {
beforeEach(() => {
sandbox.stub(process, 'platform').value('win32');
sandbox.stub(os, 'release').returns('7.0.0');
});
afterEach(() => {
sandbox.restore();
});
it('should return false', () => {
assert.isFalse(Settings.isNotificationGroupingSupported());
});
});
context('version 8+', () => {
beforeEach(() => {
sandbox.stub(process, 'platform').value('win32');
sandbox.stub(os, 'release').returns('8.0.0');
});
afterEach(() => {
sandbox.restore();
});
it('should return true', () => {
assert.isTrue(Settings.isNotificationGroupingSupported());
});
});
});
context('on Linux', () => {
beforeEach(() => {
sandbox.stub(process, 'platform').value('linux');
});
afterEach(() => {
sandbox.restore();
});
it('should return true', () => {
assert.isTrue(Settings.isNotificationGroupingSupported());
});
});
});
});

@ -4,3 +4,8 @@ const MIN_WINDOWS_VERSION = '8.0.0';
export const isAudioNotificationSupported = () =>
OS.isWindows(MIN_WINDOWS_VERSION) || OS.isMacOS();
// Using `Notification::tag` has a bug on Windows 7:
// https://github.com/electron/electron/issues/11189
export const isNotificationGroupingSupported = () =>
!OS.isWindows() || OS.isWindows(MIN_WINDOWS_VERSION);

Loading…
Cancel
Save