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
}
})
})
+
+ 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/)
+ })
+ })
})