]> khamidou — GitHub mirrors - electron.git/commitdiff
Use Menu.buildFromTemplate instead of raw menu APIs.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 14 Aug 2013 13:49:13 +0000 (21:49 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 14 Aug 2013 13:49:13 +0000 (21:49 +0800)
spec/api/menu.coffee

index c0551a699880e2b87a07994b1afedd2f351e78b1..a2b8f28292d513f18a1b5c37c4c37ccf5084fcb4 100644 (file)
@@ -26,12 +26,11 @@ describe 'Menu API', ->
 
   describe 'MenuItem.click', ->
     it 'should be called with the item object passed', (done) ->
-      menu = new Menu
-      menuItem = new MenuItem
+      menu = Menu.buildFromTemplate [
         label: 'text'
         click: (item) ->
           assert.equal item.constructor.name, 'MenuItem'
           assert.equal item.label, 'text'
           done()
-      menu.append menuItem
-      menu.delegate.executeCommand menuItem.commandId
+      ]
+      menu.delegate.executeCommand menu.items[0].commandId