File tree 4 files changed +9
-23
lines changed
4 files changed +9
-23
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
2
updateTrayIcon ,
3
- reOpenWindow ,
4
3
openExternalLink ,
5
4
setAutoLaunch ,
6
5
restoreSetting ,
@@ -11,7 +10,7 @@ const { ipcRenderer, shell } = require('electron');
11
10
const remote = require ( '@electron/remote' ) ;
12
11
13
12
describe ( 'utils/comms.ts' , ( ) => {
14
- beforeEach ( function ( ) {
13
+ beforeEach ( function ( ) {
15
14
jest . spyOn ( ipcRenderer , 'send' ) ;
16
15
} ) ;
17
16
@@ -33,12 +32,6 @@ describe('utils/comms.ts', () => {
33
32
expect ( ipcRenderer . send ) . toHaveBeenCalledWith ( 'update-icon' ) ;
34
33
} ) ;
35
34
36
- it ( 'should reopen the window' , ( ) => {
37
- reOpenWindow ( ) ;
38
- expect ( ipcRenderer . send ) . toHaveBeenCalledTimes ( 1 ) ;
39
- expect ( ipcRenderer . send ) . toHaveBeenCalledWith ( 'reopen-window' ) ;
40
- } ) ;
41
-
42
35
it ( 'should restore a setting' , ( ) => {
43
36
restoreSetting ( 'foo' , 'bar' ) ;
44
37
expect ( ipcRenderer . send ) . toHaveBeenCalledTimes ( 1 ) ;
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ export function updateTrayIcon(notificationsLength = 0): void {
20
20
}
21
21
}
22
22
23
- export function reOpenWindow ( ) : void {
24
- ipcRenderer . send ( 'reopen-window' ) ;
25
- }
26
-
27
23
export function restoreSetting ( setting , value ) : void {
28
24
ipcRenderer . send ( setting , value ) ;
29
25
}
Original file line number Diff line number Diff line change 1
1
import * as _ from 'lodash' ;
2
+ import { ipcRenderer } from 'electron' ;
2
3
3
4
import { generateGitHubWebUrl , getCommentId } from './helpers' ;
4
5
import {
@@ -128,15 +129,13 @@ describe('utils/notifications.ts', () => {
128
129
} ) ;
129
130
130
131
it ( 'should click on a native notification (with more than 1 notification)' , ( ) => {
131
- jest . spyOn ( comms , 'reOpenWindow' ) ;
132
-
133
132
const nativeNotification = notificationsHelpers . raiseNativeNotification (
134
133
mockedGithubNotifications ,
135
134
mockAccounts ,
136
135
) ;
137
136
nativeNotification . onclick ( null ) ;
138
137
139
- expect ( comms . reOpenWindow ) . toHaveBeenCalledTimes ( 1 ) ;
138
+ expect ( ipcRenderer . send ) . toHaveBeenCalledWith ( 'reopen-window' ) ;
140
139
} ) ;
141
140
142
141
it ( 'should play a sound' , ( ) => {
Original file line number Diff line number Diff line change 1
- const remote = require ( '@electron/remote' ) ;
2
-
1
+ import { ipcRenderer } from 'electron' ;
3
2
import { openInBrowser } from '../utils/helpers' ;
4
- import { reOpenWindow , updateTrayIcon } from './comms' ;
3
+ import { updateTrayIcon } from './comms' ;
5
4
import { Notification } from '../typesGithub' ;
6
5
7
6
import { AccountNotifications , SettingsState , AuthState } from '../types' ;
@@ -67,9 +66,8 @@ export const raiseNativeNotification = (
67
66
68
67
if ( notifications . length === 1 ) {
69
68
const notification = notifications [ 0 ] ;
70
- title = `${ process . platform !== 'win32' ? 'Gitify - ' : '' } ${
71
- notification . repository . full_name
72
- } `;
69
+ title = `${ process . platform !== 'win32' ? 'Gitify - ' : '' } ${ notification . repository . full_name
70
+ } `;
73
71
body = notification . subject . title ;
74
72
} else {
75
73
title = 'Gitify' ;
@@ -81,12 +79,12 @@ export const raiseNativeNotification = (
81
79
silent : true ,
82
80
} ) ;
83
81
84
- nativeNotification . onclick = function ( ) {
82
+ nativeNotification . onclick = function ( ) {
85
83
if ( notifications . length === 1 ) {
86
84
remote . getCurrentWindow ( ) . hide ( ) ;
87
85
openInBrowser ( notifications [ 0 ] , accounts ) ;
88
86
} else {
89
- reOpenWindow ( ) ;
87
+ ipcRenderer . send ( 'reopen-window' ) ;
90
88
}
91
89
} ;
92
90
You can’t perform that action at this time.
0 commit comments