File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ The `menu` object has the following instance methods:
6161
6262#### ` menu.popup(options) `
6363
64- * ` options ` Object
64+ * ` options ` Object (optional)
6565 * ` window ` [ BrowserWindow] ( browser-window.md ) (optional) - Default is the focused window.
6666 * ` x ` Number (optional) - Default is the current mouse cursor position.
6767 Must be declared if ` y ` is declared.
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Menu.prototype._init = function () {
4747 this . delegate = delegate
4848}
4949
50- Menu . prototype . popup = function ( options ) {
50+ Menu . prototype . popup = function ( options = { } ) {
5151 if ( options == null || typeof options !== 'object' ) {
5252 throw new TypeError ( 'Options must be an object' )
5353 }
Original file line number Diff line number Diff line change @@ -633,10 +633,16 @@ describe('Menu module', () => {
633633
634634 it ( 'throws an error if options is not an object' , ( ) => {
635635 expect ( ( ) => {
636- menu . popup ( )
636+ menu . popup ( 'this is a string, not an object' )
637637 } ) . to . throw ( / O p t i o n s m u s t b e a n o b j e c t / )
638638 } )
639639
640+ it ( 'allows for options to be optional' , ( ) => {
641+ expect ( ( ) => {
642+ menu . popup ( { } )
643+ } ) . to . not . throw ( )
644+ } )
645+
640646 it ( 'should emit menu-will-show event' , ( done ) => {
641647 menu . on ( 'menu-will-show' , ( ) => { done ( ) } )
642648 menu . popup ( { window : w } )
You can’t perform that action at this time.
0 commit comments