Skip to content

Commit a8cfeef

Browse files
committed
fix: tests with new improvements
1 parent b5ae7b6 commit a8cfeef

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

Iris.Components.Test/CommandPalette/CommandPaletteHostTests.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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());

Iris.Components.Test/PackageManagement/TypeIconTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void Displays_CorrectlyTyped_NumberIcon(string type)
3535
.Add(p => p.Type, type));
3636

3737
cut.Markup.Should().Contain("material-symbols-rounded");
38-
cut.Markup.Should().Contain("hashtag");
38+
cut.Markup.Should().Contain("tag");
3939
}
4040

4141
[Theory(DisplayName = "Displays correct type icon for dates")]
@@ -72,7 +72,7 @@ public void Displays_CorrectlyTyped_ObjectIcon(string type)
7272
.Add(p => p.Type, type));
7373

7474
cut.Markup.Should().Contain("material-symbols-rounded");
75-
cut.Markup.Should().Contain("brackets-curly");
75+
cut.Markup.Should().Contain("data_object");
7676
}
7777

7878
[Theory(DisplayName = "Displays array icon for types ending in '[]'")]
@@ -83,7 +83,7 @@ public void Displays_CorrectlyTyped_ArrayIcon(string type)
8383
.Add(p => p.Type, type));
8484

8585
cut.Markup.Should().Contain("material-symbols-rounded");
86-
cut.Markup.Should().Contain("brackets-square");
86+
cut.Markup.Should().Contain("data_array");
8787
}
8888

8989
[Theory(DisplayName = "Displays key icon for key/secret types")]

0 commit comments

Comments
 (0)