Skip to content

Commit

Permalink
use radio menu instead of checkbox for themes on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
a-b-r-o-w-n committed Feb 1, 2019
1 parent 56c55df commit 2c68609
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions packages/app/main/src/appMenuBuilder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ describe('AppMenuBuilder', () => {
});

it('should update the recent bots list', () => {
mockRemoteCall = jest.fn((..._args) => Promise.resolve(null));
mockRemoteCall = jest.fn(() => Promise.resolve(null));
const mockBotPath = join('path', 'to', 'bot');
const mockRecentBots = [
{ displayName: 'bot1', path: mockBotPath },
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('AppMenuBuilder', () => {
},
};
mockRemoteCall = jest.fn(commandName => {
if ((commandName = SharedConstants.Commands.Misc.GetStoreState)) {
if (commandName === SharedConstants.Commands.Misc.GetStoreState) {
return Promise.resolve(mockState);
} else {
return Promise.resolve({});
Expand All @@ -331,6 +331,7 @@ describe('AppMenuBuilder', () => {
const themeMenu = fileMenuTemplate[11];
expect(themeMenu.label).toBe('Themes');
expect(themeMenu.submenu).toHaveLength(3); // light, dark, midnight
expect(themeMenu.submenu[2].type).toBe('checkbox');
expect(themeMenu.submenu[2].label).toBe('midnight');
expect(themeMenu.submenu[2].checked).toBe(true);

Expand Down Expand Up @@ -382,7 +383,7 @@ describe('AppMenuBuilder', () => {
},
};
mockRemoteCall = jest.fn(commandName => {
if ((commandName = SharedConstants.Commands.Misc.GetStoreState)) {
if (commandName === SharedConstants.Commands.Misc.GetStoreState) {
return Promise.resolve(mockState);
} else {
return Promise.resolve({});
Expand All @@ -399,5 +400,10 @@ describe('AppMenuBuilder', () => {

const windowMenuTemplate = appMenuTemplate[4].submenu;
expect(windowMenuTemplate).toHaveLength(5);

// should set the theme menu type to radio
const fileMenuTemplate = appMenuTemplate[1].submenu;
const themeMenu = fileMenuTemplate[11];
expect(themeMenu.submenu[0].type).toBe('radio');
});
});
2 changes: 1 addition & 1 deletion packages/app/main/src/appMenuBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class AppMenuBuilder {
label: 'Themes',
submenu: availableThemes.map(t => ({
label: t.name,
type: 'checkbox',
type: isMac() ? 'radio' : 'checkbox',
checked: theme === t.name,
click: async () => {
settingsStore.dispatch(rememberTheme(t.name));
Expand Down

0 comments on commit 2c68609

Please sign in to comment.