@@ -65,6 +65,19 @@ export async function verifyExternalApplicationTargeting(platform = 'darwin') {
6565 menuPathItems,
6666 } ) ;
6767 controller . rebuild ( ) ;
68+ const rootItems = controller . serialize ( ) ;
69+ for ( const id of [ 'file-close-document' , 'file-close-window' ] ) {
70+ const rootItem = rootItems . find ( ( item ) => item . id === id ) ;
71+ const fileItems = rootItems . find ( ( item ) => item . id === 'file-menu' ) . submenu ;
72+ if ( [ 'win32' , 'linux' ] . includes ( platform ) ) {
73+ assert . ok ( rootItem , `${ id } is available in the first-level menu on ${ platform } ` ) ;
74+ assert . equal ( rootItem . path . length , 1 ) ;
75+ assert . ok ( ! fileItems . some ( ( item ) => item . id === id ) ) ;
76+ } else {
77+ assert . ok ( ! rootItem ) ;
78+ assert . ok ( fileItems . some ( ( item ) => item . id === id ) ) ;
79+ }
80+ }
6881 await new Promise ( ( resolve ) => setImmediate ( resolve ) ) ;
6982 const submenu = controller . getApplicationMenu ( ) . getMenuItemById ( 'file-other-app' ) ;
7083 assert . equal ( submenu . label , '在其他应用中继续阅读' ) ;
@@ -181,7 +194,11 @@ export async function verifyFileMenu(window, recents) {
181194 assert . ok ( ! file ( ) . items . some ( ( item ) => item . id === 'file-preferences' ) ) ;
182195 const externalIndex = file ( ) . items . findIndex ( ( item ) => item . id === 'file-other-app' ) ;
183196 const closeIndex = file ( ) . items . findIndex ( ( item ) => item . id === 'file-close-document' ) ;
184- assert . ok ( closeIndex > externalIndex ) ;
197+ if ( [ 'win32' , 'linux' ] . includes ( process . platform ) ) {
198+ assert . equal ( closeIndex , - 1 ) ;
199+ assert . ok ( menu ( ) . items . some ( ( item ) => item . id === 'file-close-document' ) ) ;
200+ assert . ok ( menu ( ) . items . some ( ( item ) => item . id === 'file-close-window' ) ) ;
201+ } else assert . ok ( closeIndex > externalIndex ) ;
185202 for ( const action of [ 'reveal' , process . platform === 'win32' ? 'share' : 'airdrop' ] ) {
186203 for ( const kind of [ 'original' , 'translated' ] ) {
187204 const entry = menu ( ) . getMenuItemById ( `file-${ action } -${ kind } ` ) ;
0 commit comments