Use ipc eval in spec
This commit is contained in:
parent
e62092ebb2
commit
83c69b56a4
2 changed files with 6 additions and 10 deletions
|
@ -10,9 +10,12 @@ describe 'menu module', ->
|
|||
assert.equal menu.items[0].extra, 'field'
|
||||
|
||||
it 'does not modify the specified template', ->
|
||||
template = [label: 'text', submenu: [label: 'sub']]
|
||||
builtTemplate = ipcRenderer.sendSync('menu-build-from-template', template)
|
||||
assert.deepStrictEqual builtTemplate, template
|
||||
template = ipcRenderer.sendSync 'eval', """
|
||||
var template = [{label: 'text', submenu: [{label: 'sub'}]}];
|
||||
require('electron').Menu.buildFromTemplate(template);
|
||||
template;
|
||||
"""
|
||||
assert.deepStrictEqual template, [label: 'text', submenu: [label: 'sub']]
|
||||
|
||||
describe 'Menu.buildFromTemplate should reorder based on item position specifiers', ->
|
||||
it 'should position before existing item', ->
|
||||
|
|
|
@ -3,7 +3,6 @@ const app = electron.app;
|
|||
const ipcMain = electron.ipcMain;
|
||||
const dialog = electron.dialog;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const Menu = electron.Menu;
|
||||
|
||||
const path = require('path');
|
||||
|
||||
|
@ -43,12 +42,6 @@ ipcMain.on('echo', function(event, msg) {
|
|||
event.returnValue = msg;
|
||||
});
|
||||
|
||||
// Verify Menu.buildFromTemplate does not modify the specified template
|
||||
ipcMain.on('menu-build-from-template', function(event, template) {
|
||||
Menu.buildFromTemplate(template);
|
||||
event.returnValue = template;
|
||||
})
|
||||
|
||||
if (process.argv[2] == '--ci') {
|
||||
process.removeAllListeners('uncaughtException');
|
||||
process.on('uncaughtException', function(error) {
|
||||
|
|
Loading…
Reference in a new issue