mirror of
https://github.com/electron/electron.git
synced 2026-01-25 15:28:11 -05:00
Add spec for invalid menu item type
This commit is contained in:
@@ -70,7 +70,7 @@ const MenuItem = function (options) {
|
||||
this.overrideProperty('checked', false)
|
||||
|
||||
if (!MenuItem.types.includes(this.type)) {
|
||||
throw new Error(`Unknown menu type ${this.type}`)
|
||||
throw new Error(`Unknown menu item type: ${this.type}`)
|
||||
}
|
||||
|
||||
this.commandId = ++nextCommandId
|
||||
|
||||
@@ -359,4 +359,17 @@ describe('menu module', function () {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('MenuItem with invalid type', function () {
|
||||
it('throws an exception', function () {
|
||||
assert.throws(function () {
|
||||
var menu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: 'text',
|
||||
type: 'not-a-type'
|
||||
}
|
||||
])
|
||||
}, /Unknown menu item type: not-a-type/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user