mirror of
https://github.com/electron/electron.git
synced 2026-02-18 02:51:53 -05:00
fix: Stricter Testing For Menu Items (#13992)
This PR includes stricter testing for empty objects so that false context menus are not created along with the tests to ensure future compatibility.
This commit is contained in:
@@ -42,6 +42,23 @@ describe('Menu module', () => {
|
||||
}).to.not.throw()
|
||||
})
|
||||
|
||||
it('does throw exceptions for empty objects and null values', () => {
|
||||
expect(() => {
|
||||
Menu.buildFromTemplate([{}, null])
|
||||
}).to.throw(/Invalid template for MenuItem: must have at least one of label, role or type/)
|
||||
})
|
||||
|
||||
it('does throw exception for object without role, label, or type attribute', () => {
|
||||
expect(() => {
|
||||
Menu.buildFromTemplate([{ 'visible': true }])
|
||||
}).to.throw(/Invalid template for MenuItem: must have at least one of label, role or type/)
|
||||
})
|
||||
it('does throw exception for undefined', () => {
|
||||
expect(() => {
|
||||
Menu.buildFromTemplate([undefined])
|
||||
}).to.throw(/Invalid template for MenuItem: must have at least one of label, role or type/)
|
||||
})
|
||||
|
||||
describe('Menu sorting and building', () => {
|
||||
describe('sorts groups', () => {
|
||||
it('does a simple sort', () => {
|
||||
|
||||
Reference in New Issue
Block a user