|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | 6 | import assert from 'assert'; |
7 | | -import { $ } from '../../../../browser/dom.js'; |
| 7 | +import { $, ModifierKeyEmitter } from '../../../../browser/dom.js'; |
8 | 8 | import { unthemedMenuStyles } from '../../../../browser/ui/menu/menu.js'; |
9 | 9 | import { MenuBar } from '../../../../browser/ui/menu/menubar.js'; |
10 | 10 | import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../common/utils.js'; |
@@ -65,20 +65,33 @@ suite('Menubar', () => { |
65 | 65 | ensureNoDisposablesAreLeakedInTestSuite(); |
66 | 66 | const container = $('.container'); |
67 | 67 |
|
68 | | - const menubar = new MenuBar(container, { |
69 | | - enableMnemonics: true, |
70 | | - visibility: 'visible' |
71 | | - }, unthemedMenuStyles); |
| 68 | + const withMenuMenubar = (callback: (menubar: MenuBar) => void) => { |
| 69 | + const menubar = new MenuBar(container, { |
| 70 | + enableMnemonics: true, |
| 71 | + visibility: 'visible' |
| 72 | + }, unthemedMenuStyles); |
| 73 | + |
| 74 | + callback(menubar); |
| 75 | + |
| 76 | + menubar.dispose(); |
| 77 | + ModifierKeyEmitter.disposeInstance(); |
| 78 | + }; |
72 | 79 |
|
73 | 80 | test('English File menu renders mnemonics', function () { |
74 | | - validateMenuBarItem(menubar, container, '&File', 'File', 'F'); |
| 81 | + withMenuMenubar(menubar => { |
| 82 | + validateMenuBarItem(menubar, container, '&File', 'File', 'F'); |
| 83 | + }); |
75 | 84 | }); |
76 | 85 |
|
77 | 86 | test('Russian File menu renders mnemonics', function () { |
78 | | - validateMenuBarItem(menubar, container, '&Файл', 'Файл', 'Ф'); |
| 87 | + withMenuMenubar(menubar => { |
| 88 | + validateMenuBarItem(menubar, container, '&Файл', 'Файл', 'Ф'); |
| 89 | + }); |
79 | 90 | }); |
80 | 91 |
|
81 | 92 | test('Chinese File menu renders mnemonics', function () { |
82 | | - validateMenuBarItem(menubar, container, '文件(&F)', '文件', 'F'); |
| 93 | + withMenuMenubar(menubar => { |
| 94 | + validateMenuBarItem(menubar, container, '文件(&F)', '文件', 'F'); |
| 95 | + }); |
83 | 96 | }); |
84 | 97 | }); |
0 commit comments