@@ -29,24 +29,20 @@ public void Mounts_two_hotkeys_for_ctrl_and_cmd()
2929 var cut = RenderComponent < CommandPaletteHost > ( ) ;
3030
3131 var hotkeys = cut . FindComponents < MudHotkey > ( ) ;
32- hotkeys . Should ( ) . HaveCount ( 2 ) ;
32+ hotkeys . Should ( ) . HaveCount ( 4 ) ;
3333
34- var modifiers = hotkeys
35- . Select ( h => h . Instance . KeyModifiers . Single ( ) )
36- . ToArray ( ) ;
37-
38- modifiers . Should ( ) . Contain ( JsKeyModifier . ControlLeft ) ;
39- modifiers . Should ( ) . Contain ( JsKeyModifier . MetaLeft ) ;
40-
41- hotkeys . Should ( ) . OnlyContain ( h => h . Instance . Key == JsKey . KeyK ) ;
34+ var paletteHotkeys = hotkeys . Where ( h => h . Instance . Key == JsKey . KeyK ) . ToArray ( ) ;
35+ paletteHotkeys . Should ( ) . HaveCount ( 2 ) ;
36+ paletteHotkeys . SelectMany ( h => h . Instance . KeyModifiers ) . Should ( ) . Contain ( JsKeyModifier . ControlLeft ) ;
37+ paletteHotkeys . SelectMany ( h => h . Instance . KeyModifiers ) . Should ( ) . Contain ( JsKeyModifier . MetaLeft ) ;
4238 }
4339
4440 [ Fact ( DisplayName = "Pressing the hotkey opens the CommandPaletteDialog via IDialogService" ) ]
4541 public async Task Hotkey_opens_command_palette_dialog ( )
4642 {
4743 var cut = RenderComponent < CommandPaletteHost > ( ) ;
4844 var ctrlHotkey = cut . FindComponents < MudHotkey > ( )
49- . Single ( h => h . Instance . KeyModifiers . Contains ( JsKeyModifier . ControlLeft ) ) ;
45+ . Single ( h => h . Instance . Key == JsKey . KeyK && h . Instance . KeyModifiers . Contains ( JsKeyModifier . ControlLeft ) ) ;
5046
5147 await cut . InvokeAsync ( ( ) => ctrlHotkey . Instance . MudHotkeyProviderJsCallback ( ) ) ;
5248
@@ -62,7 +58,7 @@ public async Task Hotkey_does_not_stack_when_palette_already_open()
6258 _paletteService . MarkOpened ( ) ;
6359 var cut = RenderComponent < CommandPaletteHost > ( ) ;
6460 var ctrlHotkey = cut . FindComponents < MudHotkey > ( )
65- . Single ( h => h . Instance . KeyModifiers . Contains ( JsKeyModifier . ControlLeft ) ) ;
61+ . Single ( h => h . Instance . Key == JsKey . KeyK && h . Instance . KeyModifiers . Contains ( JsKeyModifier . ControlLeft ) ) ;
6662
6763 await cut . InvokeAsync ( ( ) => ctrlHotkey . Instance . MudHotkeyProviderJsCallback ( ) ) ;
6864
@@ -76,7 +72,8 @@ await _dialogService.DidNotReceive().ShowAsync(
7672 public async Task Both_hotkeys_open_palette ( )
7773 {
7874 var cut = RenderComponent < CommandPaletteHost > ( ) ;
79- var hotkeys = cut . FindComponents < MudHotkey > ( ) . ToArray ( ) ;
75+ var hotkeys = cut . FindComponents < MudHotkey > ( )
76+ . Where ( h => h . Instance . Key == JsKey . KeyK ) . ToArray ( ) ;
8077
8178 // First press: Ctrl+K. Then mark closed (simulating dialog close) and press Cmd+K.
8279 await cut . InvokeAsync ( ( ) => hotkeys [ 0 ] . Instance . MudHotkeyProviderJsCallback ( ) ) ;
0 commit comments