diff --git a/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs b/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs index ee614bf3..19076a17 100644 --- a/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs +++ b/AudioCuesheetEditor.End2EndTests/Models/AppBar.cs @@ -14,15 +14,11 @@ //along with Foobar. If not, see //. using Microsoft.Playwright; -using System.Text.RegularExpressions; namespace AudioCuesheetEditor.End2EndTests.Models { partial class AppBar(IPage page) { - [GeneratedRegex("^Open$")] - private static partial Regex OpenRegex(); - private readonly IPage _page = page; internal ILocator MenuButton => _page.GetByRole(AriaRole.Toolbar).GetByRole(AriaRole.Button, new() { Name = "More" }); @@ -64,14 +60,13 @@ internal async Task OpenFileAsync(string file) internal async Task OpenFileDialogAsync() { - await _page.GetByRole(AriaRole.Button, new() { Name = "File", Exact = true }).ClickAsync(); - await _page.Locator("div").Filter(new() { HasTextRegex = OpenRegex() }).ClickAsync(); + await _page.GetByRole(AriaRole.Toolbar).GetByRole(AriaRole.Button, new() { Name = "More" }).ClickAsync(); + await _page.GetByRole(AriaRole.Menuitem, new() { Name = "Open file" }).ClickAsync(); } - internal async Task OpenExportDialogAsync(string exportType, string fileMenuName = "File") + internal async Task OpenExportDialogAsync(string exportType) { - await _page.GetByRole(AriaRole.Button, new() { Name = fileMenuName, Exact = true }).ClickAsync(); - await _page.GetByText("Export", new() { Exact = true }).HoverAsync(); + await _page.GetByRole(AriaRole.Button, new() { Name = "Export menu" }).ClickAsync(); await _page.GetByText(exportType, new() { Exact = true }).ClickAsync(); } diff --git a/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs b/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs index 658b572b..a8b43579 100644 --- a/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs +++ b/AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs @@ -73,7 +73,7 @@ public async Task ChangeLanguage_ShouldSwitchLanguage_WhenGermanIsSelected() await Expect(TestPage.GetByText("Aufnahmeansicht")).ToBeVisibleAsync(); await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Dateien" })).ToBeVisibleAsync(); await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Wiedergabe" })).ToBeVisibleAsync(); - await bar.OpenExportDialogAsync("Textdatei", "Datei"); + await bar.OpenExportDialogAsync("Textdatei"); await Expect(TestPage.GetByRole(AriaRole.Dialog)).ToMatchAriaSnapshotAsync(@"- dialog ""Exportprofile Close"": - heading ""Exportprofile"" [level=6] - button ""Close"" diff --git a/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs b/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs index 42415043..212587fc 100644 --- a/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs +++ b/AudioCuesheetEditor.End2EndTests/Tests/Smartphone/BasicTest.cs @@ -75,7 +75,7 @@ public async Task ChangeLanguage_ShouldSwitchLanguage_WhenGermanIsSelected() await Expect(TestPage.GetByText("Aufnahmeansicht")).ToBeVisibleAsync(); await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Dateien" })).ToBeVisibleAsync(); await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Wiedergabe" })).ToBeVisibleAsync(); - await bar.OpenExportDialogAsync("Textdatei", "Datei"); + await bar.OpenExportDialogAsync("Textdatei"); await Expect(TestPage.GetByRole(AriaRole.Dialog)).ToMatchAriaSnapshotAsync(@"- dialog ""Exportprofile Close"": - heading ""Exportprofile"" [level=6] - button ""Close"" diff --git a/AudioCuesheetEditor/Shared/AppBar.de.resx b/AudioCuesheetEditor/Shared/AppBar.de.resx index 9b1a4bcd..5de0e59a 100644 --- a/AudioCuesheetEditor/Shared/AppBar.de.resx +++ b/AudioCuesheetEditor/Shared/AppBar.de.resx @@ -138,9 +138,6 @@ Cuesheet runterladen - - Export - Exportprofile @@ -153,8 +150,8 @@ Tastenkürzel - - Öffnen + + Datei öffnen Vorschauumgebung diff --git a/AudioCuesheetEditor/Shared/AppBar.razor b/AudioCuesheetEditor/Shared/AppBar.razor index 395d5e3d..5c8c03f6 100644 --- a/AudioCuesheetEditor/Shared/AppBar.razor +++ b/AudioCuesheetEditor/Shared/AppBar.razor @@ -45,19 +45,12 @@ along with Foobar. If not, see } - @if (DisplayFileMenu) - { - - - - - - @_localizer["Open"] - - @_localizer["Cuesheet"] - @_localizer["Projectfile"] - @_localizer["Textfile"] - + @if (DisplayExportMenu) + { + + @_localizer["Cuesheet"] + @_localizer["Projectfile"] + @_localizer["Textfile"] } @@ -66,11 +59,19 @@ along with Foobar. If not, see @IsoCountryCodeToFlagEmoji(culture) @culture.DisplayName } + + + + @if (DisplaySettings) { @_localizer["Settings"] } + @if (DisplayOpenFile) + { + @_localizer["Open file"] + } @_localizer["Help"] @_localizer["About"] @if (DisplayHotkeys) @@ -89,13 +90,13 @@ along with Foobar. If not, see @code { - HotKeysContext? hotKeysContext; - MudFileUpload? mudFileUpload; + HotKeysContext? _hotKeysContext; + MudFileUpload? _mudFileUpload; protected override void OnInitialized() { base.OnInitialized(); - hotKeysContext = _hotKeys.CreateContext() + _hotKeysContext = _hotKeys.CreateContext() .Add(ModKey.Ctrl, Key.z, () => TraceChangeManager.Undo()) .Add(ModKey.Ctrl, Key.y, () => TraceChangeManager.Redo()) .Add(ModKey.Ctrl, Key.s, DownloadProjectfileClicked) @@ -107,14 +108,17 @@ along with Foobar. If not, see protected override void Dispose(bool disposing) { base.Dispose(disposing); - hotKeysContext?.DisposeAsync(); + _hotKeysContext?.DisposeAsync(); } [Parameter] public Boolean DisplayUndoRedoButtonGroup { get; set; } [Parameter] - public Boolean DisplayFileMenu { get; set; } + public Boolean DisplayExportMenu { get; set; } + + [Parameter] + public Boolean DisplayOpenFile { get; set; } [Parameter] public Boolean DisplaySettings { get; set; } @@ -222,9 +226,9 @@ along with Foobar. If not, see async Task OpenFileUpload() { - if (mudFileUpload != null) + if (_mudFileUpload != null) { - await mudFileUpload.OpenFilePickerAsync(); + await _mudFileUpload.OpenFilePickerAsync(); } } diff --git a/AudioCuesheetEditor/Shared/AppBar.resx b/AudioCuesheetEditor/Shared/AppBar.resx index adabed2e..915c98b0 100644 --- a/AudioCuesheetEditor/Shared/AppBar.resx +++ b/AudioCuesheetEditor/Shared/AppBar.resx @@ -138,9 +138,6 @@ Download cuesheet - - Export - Export profiles @@ -153,8 +150,8 @@ Hotkeys - - Open + + Open file Preview environment diff --git a/AudioCuesheetEditor/Shared/Layouts/MainLayout.razor b/AudioCuesheetEditor/Shared/Layouts/MainLayout.razor index 2a9a319d..abfb1fe7 100644 --- a/AudioCuesheetEditor/Shared/Layouts/MainLayout.razor +++ b/AudioCuesheetEditor/Shared/Layouts/MainLayout.razor @@ -25,7 +25,7 @@ along with Foobar. If not, see - + @Body